delete list

This commit is contained in:
2026-08-29 16:54:25 +02:00
parent d3bc028fce
commit 2912f7c455
8 changed files with 105 additions and 21 deletions
+11
View File
@@ -72,6 +72,17 @@ class ShoppingListController {
res.json({ success: true });
}
deleteList(req, res) {
const list = ShoppingListRepository.findById(req.params.id, req.user.household_id);
if (!list) return res.status(404).json({ error: "Lijst niet gevonden" });
const result = ShoppingListRepository.deleteList(list.id);
if (result.changes === 0) return res.status(404).json({ error: "Lijst niet gevonden" });
this.broadcastUpdate(req, list.id);
res.json({ success: true });
}
broadcastUpdate(req, listId) {
if (req.app.locals.io) {
req.app.locals.io.to(`list:${listId}`).emit("list:updated", { listId });