Events: toggle switch to activate/deactivate (single-active)
- Replace the 'Set active' button / 'Active' pill in the Events table with a toggle switch. Activating an event deactivates all others (enforced by the existing DB trigger + partial unique index); deactivating just turns it off. - Add deactivateEvent() API helper. - Update docs (admin-app.md, next-steps.md).
This commit is contained in:
1 parent
a54ce69c4d
commit
8054d0ace2
4 files changed
+21
-20
No files matched your search
@@ -159,6 +159,12 @@ export async function activateEvent(id: string): Promise<void> {
|
||||
if (error) throw new ApiError(error.message);
|
||||
}
|
||||
|
||||
/** Deactivate an event (sets is_active = false). */
|
||||
export async function deactivateEvent(id: string): Promise<void> {
|
||||
const { error } = await supabase.from('events').update({ is_active: false }).eq('id', id);
|
||||
if (error) throw new ApiError(error.message);
|
||||
}
|
||||
|
||||
// ---- Points ------------------------------------------------------------------
|
||||
|
||||
/** Admin manual points adjustment for the active event (audited as 'admin'). */
|
||||
|
||||
Reference in new issue
Block a user