diff --git a/app.js b/app.js index c4e1538..dde89f2 100644 --- a/app.js +++ b/app.js @@ -35,6 +35,7 @@ const Work = DB({ return ["", workObj]; } }); + /**@type {(work:WorkData)=>void} */ const WorkMake =(work)=> { @@ -46,10 +47,10 @@ const WorkMake =(work)=> part.make.forEach(itr); }; - /** @typedef {"all"|"one"} DeskMode*/ /** @typedef {[need:Record, make:string[], ...role:string[]]} DeskJSON */ /** @typedef {{name:string, mode:DeskMode, need:Record, make:string[], role:string[]}} DeskData */ + /** @type {(desk:DeskData)=>[dirtyNeed:string[], dirtyMake:string[]]} */ const Scan =(desk)=> { @@ -93,14 +94,15 @@ const Scan =(desk)=> console.log("scan", dirtyNeed, dirtyMake); return [dirtyNeed, dirtyMake]; }; + const Desk = DB({ path:"./db_desk.csv", cols:4, - load(_i, id, name, /** @type {DeskMode}*/mode, data) + load(_i, id, name, mode, data) { /**@type {DeskJSON} */ const [need, make, ...role] = JSON.parse(data); - const deskObj = { name, mode, need, make, role }; + const deskObj = { name, mode:/**@type{DeskMode}*/(mode), need, make, role }; make.forEach(partId=>Part.find(partId).make.push(id)); Object.keys(need).forEach(partId=>Part.find(partId).need.push(id)); diff --git a/db_desk.csv b/db_desk.csv index d3a4735..31894b0 100644 --- a/db_desk.csv +++ b/db_desk.csv @@ -1 +1 @@ -d1,Desk One,all,[{"p1":1, "p2":1},["p3"],"r1"] +d1,Desk One,all,[{"p1":1, "p2":1, "p4":0},["p3"],"r1"] diff --git a/db_part.csv b/db_part.csv index 16b3d6b..c113a6c 100644 --- a/db_part.csv +++ b/db_part.csv @@ -1,3 +1,4 @@ p1,Part 1 p2,Part 2 p3,Part 3 +p4,Part Empty diff --git a/db_pass.csv b/db_pass.csv new file mode 100644 index 0000000..8673873 --- /dev/null +++ b/db_pass.csv @@ -0,0 +1 @@ +August 2025,./db_part.csv,./db_work.csv,./db_desk.csv \ No newline at end of file diff --git a/db_work.json b/db_work.json deleted file mode 100644 index 91f912f..0000000 --- a/db_work.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "p1":{ - "u1":{ - "1":{"key1": "value1", "key2": "value2"} - } - } -} \ No newline at end of file