zie vorige message
This commit is contained in:
@@ -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) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user