Applicatie afmaken en GUI-flow herstellen

Voegt boodschappenlijsten, productbeheer, realtime synchronisatie en browsercache-updates toe. Herstelt login- en sessiegedrag en maakt database-seeding herhaalbaar.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-08-07 20:44:05 +02:00
parent 26a820b41a
commit ce68182c08
23 changed files with 552 additions and 163 deletions
+19 -83
View File
@@ -2,106 +2,42 @@ require("dotenv").config();
const db = require("../config/database");
const categories = [
["Groente", "🥬"],
["Fruit", "🍎"],
["Zuivel", "🥛"],
["Brood", "🍞"],
["Dranken", "🥤"],
["Huishouden", "🧻"]
];
const products = [
[
"Melk",
3
],
[
"Bananen",
2
],
[
"Brood",
4
],
[
"Koffie",
5
],
[
"WC papier",
6
]
["Melk", "Zuivel"],
["Bananen", "Fruit"],
["Brood", "Brood"],
["Koffie", "Dranken"],
["WC papier", "Huishouden"]
];
const insertCategory = db.prepare(`
INSERT OR IGNORE INTO categories (name, icon) VALUES (?, ?)
`);
const insertProduct = db.prepare(`
INSERT OR IGNORE INTO products
(
name,
category_id
)
VALUES (?,?)
INSERT OR IGNORE INTO products (name, category_id) VALUES (?, ?)
`);
const seedProducts = db.transaction(() => {
for(const product of products){
insertProduct.run(product);
}
});
seedProducts();
const insert = db.prepare(`
INSERT OR IGNORE INTO categories
(name, icon)
VALUES (?,?)
`);
const seed = db.transaction(() => {
db.transaction(() => {
for (const category of categories) {
insert.run(category);
insertCategory.run(category);
}
});
for (const [name, categoryName] of products) {
const category = db.prepare(
"SELECT id FROM categories WHERE name = ?"
).get(categoryName);
insertProduct.run(name, category.id);
}
})();
seed();
console.log("Seed voltooid.");
console.log("Seed voltooid.");