Versie module 1 van 26-7

This commit is contained in:
2026-07-26 22:18:52 +02:00
commit 26a820b41a
39 changed files with 3663 additions and 0 deletions
+59
View File
@@ -0,0 +1,59 @@
const db = require("../config/database");
class HouseholdService {
createForUser(userId, name) {
const create =
db.transaction(() => {
const household =
db.prepare(`
INSERT INTO households
(name)
VALUES (?)
`).run(name);
db.prepare(`
INSERT INTO household_members
(
household_id,
user_id,
role
)
VALUES (?, ?, ?)
`).run(
household.lastInsertRowid,
userId,
"OWNER"
);
return household.lastInsertRowid;
});
return create();
}
}
module.exports = new HouseholdService();