Check-in gate + fixes, RPC test suite, docs

- Convivo: not-checked-in gate for non-staff (see-a-staff screen with QR
  code + logout); lifts automatically once staff checks them in
- Convivo: fix check-in 'pick a session first' race (synchronous default
  session fallback)
- Add RPC test suite (npm run test:rpc): points idempotency, role guards,
  service-session guard, speaker auto-promote, leaderboard staff exclusion
- Fix db:types script (create packages/shared/src); gitignore generated types
- Docs: README/roadmap drift fixes, tests.md, backend README link
This commit is contained in:
Lago committed 2026-09-08 21:05:34 +02:00
1 parent 25ae8b6ee4
commit e4c8815e52
11 files changed
+559 -38

No files matched your search

+21 -21
View File
@@ -15,8 +15,9 @@
> - **Phase 5** — Convivo App: 24h login, 5s polling, QR type badge, red dot, speaker material.
> - **Phase 6** — Branding: APPE favicon + icons for both apps.
>
> **Next:** cross-cutting work (real event clock, deployment, automated testing).
> See [`roadmap.md`](./roadmap.md).
> **Next:** cross-cutting work (deployment, automated testing, push
> notifications). The real event clock is implemented as a per-event
> `use_realtime_clock` toggle (see §4.7). See [`roadmap.md`](./roadmap.md).
---
@@ -30,22 +31,15 @@ Conferences are full of people who want to meet each other but don't know how to
## 2. Event format
| | |
|---|---|
| **Date** | Wednesday, 23 October |
| **Hours** | 09:00 – 17:00 |
| **Structure** | 6 slots × 45 minutes, **3 parallel sessions per slot** |
| **Breaks** | 09:45–10:00 · coffee 10:45–11:30 · lunch 12:15–13:15 · 14:45–15:00 · closing 15:45–17:00 |
The schedule is **data-driven** (stored in Postgres), so times and sessions can
be changed without an app update. The seed uses the real **Global Power
Platform Bootcamp (Austria)** agenda — 2026-02-20, Vienna — with 10 slots
(7 `session` + 3 `service_session`) and 22 sessions.
| Slot | Time | Slot | Time |
|---|---|---|---|
| 1 | 09:00–09:45 | 4 | 13:15–14:00 |
| 2 | 10:00–10:45 | 5 | 14:00–14:45 |
| 3 | 11:30–12:15 | 6 | 15:00–15:45 |
The schedule is **data-driven** (stored in Postgres), so times and sessions can be changed without an app update.
> **Demo clock:** the app uses a simulated "now" of `2026-10-23 10:20` so Slot 1 is *done* and Slot 2 is *live* — matching the mockup. See `apps/convivo/src/lib/time.ts`.
> **Demo clock:** by default the app uses a simulated "now" of
> `2026-02-20 10:20` so a slot is *live* — matching the mockup. A per-event
> `use_realtime_clock` flag (toggled in the admin Events view) switches the
> app to the real system clock. See `apps/convivo/src/lib/time.ts`.
## 3. Roles
@@ -69,7 +63,7 @@ Check-in tab.
**How it works:** the QR token is stored as the Supabase Auth **password** and the email as the **identifier**. Login is a standard `signInWithPassword({ email, password: qrToken })` — no custom JWT, no separate backend, and **no email is ever sent** (`enable_confirmations = false`).
### 4.2 Agenda & preferences
- The agenda shows all 6 slots and their 3 parallel sessions (title, room, speaker, description).
- The agenda shows every slot and its parallel sessions (title, room, speaker, description).
- Attendees mark **one preferred session per slot** (they can change their pick until the slot starts).
- Home shows "Now / Next" based on the current time and the user's picks.
@@ -93,6 +87,11 @@ Check-in tab.
- Your own row is highlighted.
- **Live:** the leaderboard table is a Realtime source, so it updates in every open app the moment points change.
### 4.7 Real-time clock toggle
- A per-event `use_realtime_clock` flag (default `false`), toggled in the admin Events view.
- When `false`, the app drives slot status (Live/Next/Done) from a **simulated mid-event clock** so the demo always looks live. When `true`, it uses the **real system clock**.
- The Home header shows a "🎬 Demo clock" badge only in simulated mode.
## 5. Points system
| Action | Points |
@@ -153,8 +152,8 @@ The model is **multi-event**: people (`contacts`) register for `events` via
| `events` | id, name, start_date, end_date, location, is_active, + aggregates | Partial unique index → at most one active event |
| `registrations` | id, event_id, contact_email, type (attendee/speaker/staff/sponsor), checked_in, points, external_id | Unique (event_id, contact_email); points live here |
| `sponsors` | id, event_id, type, name, email, phone, paid, amount_eur, contact_email | `paid` gates visibility to non-admins |
| `slots` | id, event_id, type (session/lunch_break/coffee_break/keynote/close_up), name, slot_date, start_time, end_time | 6 rows for 23 Oct |
| `sessions` | id, event_id, slot_id, title, description, room, capacity, average_feedback, ai_generated_feedback, material_path, external_id | 18 rows (3 per session slot); `external_id` reserved for an external system |
| `slots` | id, event_id, type (`session`/`service_session` enum), name, slot_date, start_time, end_time | 10 rows in the seed (7 session + 3 service) |
| `sessions` | id, event_id, slot_id, title, description, room, capacity, average_feedback, ai_generated_feedback, material_path, external_id | 22 rows in the seed; `external_id` reserved for an external system |
| `session_speakers` | session_id, contact_email | Join; a session must have ≥1 speaker |
| `preferences` | event_id, contact_email, session_id, slot_id | Unique per (event, contact, slot) — one pick per slot |
| `connections` | event_id, from_email, to_email, status, created_at, resolved_at | Unique per unordered pair (via `least`/`greatest` index) |
@@ -195,9 +194,10 @@ Convivo/
│ └─ src/ # screens, components, lib, context
├─ supabase/
│ ├─ config.toml # Local stack config (ports, auth, RLS defaults)
│ ├─ migrations/ # 20260824000000_redesign.sql + follow-up migrations
│ ├─ migrations/ # 13 migrations (init → real-time clock toggle)
│ └─ seed.sql # 1 real event (Power Platform Bootcamp AT), 10 slots, 22 sessions, 54 contacts
├─ apps/admin/ # APPE Admin console (React + Vite + TS)
├─ apps/sidecar/ # Sessionize sync sidecar (Node, one dep: xlsx)
├─ docker-compose.yml # Runs the app sidecars on the Supabase network
└─ mockup/index.html # Original interactive mockup (design reference)
```