Phase 3: admin magic-link auth and event setup screens
- /login sends a Supabase magic link (admin emails only); /auth/confirm completes sign-in; proxy.ts guards /admin and every server action re-checks with requireAdmin(), since actions are plain POST endpoints. - /admin lists, creates, duplicates and deletes events. - /admin/events/[eventId] edits teams (colour, order) and games with criteria, presets and notes. All input goes through zod schemas that mirror the database constraints so errors read as plain sentences. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -18,7 +18,7 @@ Next.js (App Router) on Vercel · Supabase (Postgres + Auth + Realtime Broadcast
|
||||
| `PUT /api/judge/[token]/scores` | judge | Upsert one score `{teamId, criterionId, value}` |
|
||||
| `POST /api/judge-open/[openToken]` | judge | `{name}` → `{judgeToken}` |
|
||||
|
||||
Admin mutations = server actions. Middleware protects `/admin/*`: must be logged in AND email in `ADMIN_EMAILS`.
|
||||
Admin mutations = server actions. `src/proxy.ts` (Next.js 16's name for middleware) protects `/admin/*`: must be logged in AND email in `ADMIN_EMAILS`. Every server action re-checks via `requireAdmin()`.
|
||||
|
||||
## Supabase clients (`src/lib/supabase/`)
|
||||
- `browser.ts` — anon key, used for Realtime subscribe + admin auth session.
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ human a short "how to test this manually" checklist. Don't start the next phase
|
||||
**Done when:** tests green, 100% branch coverage on the scoring module.
|
||||
|
||||
## Phase 3 — Admin auth + setup screens
|
||||
- `/login` magic link; middleware guards `/admin/*` with `ADMIN_EMAILS`.
|
||||
- `/login` magic link; `proxy.ts` guards `/admin/*` with `ADMIN_EMAILS`.
|
||||
- Events list + create/duplicate/delete.
|
||||
- Event setup: teams CRUD (colour picker, reorder), games builder with criteria + presets, notes.
|
||||
**Done when:** I can build a "Worship Game Night" with 4 teams and a Karaoke game with 5 criteria (1–5) and a Guess the Lyric game with 1 number criterion.
|
||||
|
||||
Reference in New Issue
Block a user