From 73d5475e7a5ef3b3f9c0448de9d734ffcdeb19b3 Mon Sep 17 00:00:00 2001 From: Seth Trowbridge Date: Thu, 3 Jul 2025 14:50:48 -0400 Subject: [PATCH] passes started --- app.js | 9 +++++++++ db.js | 8 ++++++-- db_pass.csv | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index dde89f2..7ac845d 100644 --- a/app.js +++ b/app.js @@ -1,5 +1,14 @@ import DB from "./db.js"; +const Pass = DB({path:"./db_pass.csv", cols:6, load(i, part, desk, user, role, work, data){ + return [i.toString(), {part, desk, user, role, work, data}]; +}}); + +await Pass.load(); +const p1 = Pass.find("0"); +console.log("Pass", p1); + + /** @typedef {{name:string, time:number, work:WorkData[], need:string[], make:string[]}} PartData */ const Part = DB({ path:"./db_part.csv", diff --git a/db.js b/db.js index 91f6332..1adb5ee 100644 --- a/db.js +++ b/db.js @@ -46,11 +46,13 @@ async function DB(url, cols, onRow) { } } + +const instances = {}; /** @import DBTypes from "./types.d.ts" */ /** @type {DBTypes.Builder} */ export default function(params) { - return { + const obj = { list:{}, load(){ let index = 0; @@ -64,4 +66,6 @@ export default function(params) find(id){return this.list[id];}, save(){}, }; -} \ No newline at end of file + + return obj; +} diff --git a/db_pass.csv b/db_pass.csv index 8673873..9a21c04 100644 --- a/db_pass.csv +++ b/db_pass.csv @@ -1 +1 @@ -August 2025,./db_part.csv,./db_work.csv,./db_desk.csv \ No newline at end of file +./db_part.csv,./db_desk.csv,./db_user.csv,./db_role.csv,./db_work.csv,August 2025