auth-yes/tasks/new/2026-0825.03.gem.feat.event-cockpit.live-metrics-and-master-killswitch-0047.md

33 lines
1.6 KiB
Markdown

# TASK METADATA
- **Target Files:**
- `server/main.ts`
- `ui/components/SessionsPage.tsx`
- `ui/mod.ts`
- `server/main.test.ts`
- **Core Objective:** Add real-time event cockpit deck to the Sessions page with active seat counters, PIN display, time extension, and 1-tap master kill switch (`/api/events/:id/end`).
- **Dependencies:** `tasks/new/2026-0825.02.gem.feat.event-passes.multi-claim-workshops-and-kiosks-0046.md`
- **Additional Important Notes:** Sub-millisecond mass revocation of all event guest sessions via Valkey RESP3 push tracking.
---
### 1. Architectural Considerations & Risks
- **Mass Revocation Performance:**
- When the organizer clicks "End Workshop & Revoke All", the endpoint must delete all associated guest session IDs from both PostgreSQL and Valkey, emitting invalidation events to all connected nodes immediately.
- **Observability:**
- Show real-time seat claim progress bar (`38 / 50 claimed`) and event expiration timer.
---
### 2. Proposed Implementation
1. **Backend Endpoints (`server/main.ts`):**
- `POST /api/events/:id/end`: Closes the event, deletes all guest sessions under the event, and purges Valkey cache.
- `POST /api/events/:id/extend`: Adds hours to `expires_at` for the event and all active guest sessions.
2. **UI & Data Query (`ui/mod.ts`, `ui/components/SessionsPage.tsx`):**
- Query `event_passes` in `/dashboard/sessions` and render the **Event Cockpit Deck**.
- Display progress bar, quick copy buttons for PIN and Short URL, `[+1h Extend]` and `[🔴 End Workshop & Revoke All]`.
3. **Automated Tests (`server/main.test.ts`):**
- Test event extension and master kill-switch mass revocation.