zie vorige message

This commit is contained in:
2026-08-09 19:55:00 +02:00
parent c37b8956d4
commit 7ef4852efd
15 changed files with 98 additions and 16 deletions
+17
View File
@@ -3,6 +3,23 @@ const db = require("../config/database");
class HouseholdService {
findByInviteCode(code) {
const match = /^HOUSEHOLD_(\d+)$/.exec((code || "").trim().toUpperCase());
if (!match) return null;
return db.prepare(
"SELECT id FROM households WHERE id = ?"
).get(Number.parseInt(match[1], 10));
}
addMember(householdId, userId) {
return db.prepare(`
INSERT INTO household_members (household_id, user_id, role)
VALUES (?, ?, 'MEMBER')
`).run(householdId, userId);
}
createForUser(userId, name) {