Favorieten toegevoegd aan de navigatiebalk en sidebar.

This commit is contained in:
2026-08-29 19:53:28 +02:00
parent 2912f7c455
commit ce07575d5e
19 changed files with 355 additions and 29 deletions
+31
View File
@@ -72,6 +72,37 @@ class ShoppingListRepository {
`).run(listId);
}
clearItems(listId) {
return db.prepare(`
DELETE FROM shopping_list_items
WHERE list_id = ?
`).run(listId);
}
addItems(listId, items) {
if (!items.length) return 0;
const insert = db.prepare(`
INSERT INTO shopping_list_items (list_id, product_id, amount, checked, sort_order)
VALUES (?, ?, ?, ?, ?)
`);
const transaction = db.transaction(() => {
for (const item of items) {
insert.run(
listId,
item.product_id,
item.amount ?? 1,
item.checked ?? 0,
item.sort_order ?? 0
);
}
});
transaction();
return items.length;
}
deleteItem(listId, itemId) {
return db.prepare(`
DELETE FROM shopping_list_items WHERE id = ? AND list_id = ?