v0.7.4 bug fixes

This commit is contained in:
2026-03-11 18:36:07 -04:00
parent 6ad9584ea9
commit 8202c838f5
11 changed files with 132 additions and 71 deletions

View File

@@ -21,7 +21,14 @@ const PORT = process.env.PORT || 3000;
// Init DB
initDb();
seedAdmin();
getOrCreateSupportGroup(); // Ensure Support group exists
// Ensure Support group exists and all admins are members
const supportGroupId = getOrCreateSupportGroup();
if (supportGroupId) {
const db = getDb();
const admins = db.prepare("SELECT id FROM users WHERE role = 'admin' AND status = 'active'").all();
const insert = db.prepare('INSERT OR IGNORE INTO group_members (group_id, user_id) VALUES (?, ?)');
for (const a of admins) insert.run(supportGroupId, a.id);
}
// Middleware
app.use(cors());