Registration optionset + speaker auto-promote + welcome check-in

- registrations.type is now a Postgres ENUM (registration_type)
- session_speakers trigger auto-promotes attendee -> speaker (never overrides staff/sponsor)
- new welcome_checkin RPC: staff marks an attendee present at the event
- admin Registrations: QR token is final (no reset); failed sponsor change opens in-place sponsor lookup
- Convivo Home: Now/Next cards always render; red pending-material pill + popup for speakers
- Convivo Agenda: speakers can delete their material to re-upload
- Convivo Scan: staff Session/Welcome check-in toggle (uiverse switch)
- seed: staff (Bruno/Rita) get a password so staff QR login works after reset
This commit is contained in:
Lago committed 2026-08-23 21:33:44 +02:00
1 parent 1bffae9777
commit 1cbbd1b529
16 files changed
+730 -142

No files matched your search

+19 -12
View File
@@ -15,7 +15,7 @@ It runs on **port 3001** (Vite dev) or as the `convivo-admin` Docker container
|---|---|
| **Dashboard** | Active event card (name, dates, location, aggregates: avg feedback, #sessions, #speakers, #registrations, #checked-in) + top points + recent activity. |
| **Contacts** | Table of all contacts (email, name, LinkedIn, visibility toggles, `is_admin`). Edit, toggle `is_admin`, set visibility, adjust points. (No QR token here — it lives on the registration.) |
| **Registrations** | Per active event: list (contact, type, **QR token**, checked_in, points). Change type (enforces the sponsor rule), mark checked-in, **view + reset the QR token** (per registration). |
| **Registrations** | Per active event: list (contact, type, **QR token**, checked_in, points). Change type (enforces the sponsor rule — a failed sponsor change opens an **in-place sponsor lookup** popup), mark checked-in, **view the QR token** (final — no reset). |
| **Sponsors** | List (paid only visible to attendees; admin sees all). Add/edit (type, name, email, phone, paid, amount, **contact search-and-pick**). |
| **Schedule** | Slots (with type) + sessions (with speakers 1:N via a **multi-select search dropdown**, material upload with a **submitted / not submitted** state, `average_feedback`, `ai_generated_feedback` + an **Evaluate** stub button). |
| **Activity** | Tables of check-ins, connections, and feedback (per active event). |
@@ -59,7 +59,7 @@ apps/admin/src/
└─ views/
├─ Dashboard.tsx # active event + aggregates + top points + activity
├─ Contacts.tsx # table + edit / is_admin / visibility / points
├─ Registrations.tsx# per-event list + type / QR token (+reset) / checked-in
├─ Registrations.tsx# per-event list + type / QR token (view) / checked-in + sponsor lookup
├─ Sponsors.tsx # sponsor CRUD
├─ Schedule.tsx # slots + sessions + speakers + material + AI-evaluate
├─ Activity.tsx # check-ins / connections / feedback tables
@@ -79,22 +79,29 @@ key. Everything it can do is allowed by RLS:
- **Writes** — direct `insert` / `update` / `delete` on `contacts`, `events`,
`registrations`, `sponsors`, `slots`, `sessions`, and `session_speakers`
(admin-only policies).
- **RPCs** — `reset_registration_qr_token` (regenerate a registration's lanyard
token), `adjust_points` (manual, audited as `admin`), `upsert_contact`,
- **RPCs** — `adjust_points` (manual, audited as `admin`), `upsert_contact`,
`create_registration`, `set_registration_type`, `evaluate_session_feedback`
(AI stub), and `set_session_material` (attach uploaded material). See
(AI stub), and `set_session_material` (attach uploaded material). The
`reset_registration_qr_token` RPC still exists (used by the sync path) but the
admin UI no longer exposes a token reset. See
[../backend/rpcs.md](../backend/rpcs.md).
### Resetting a QR token
### Viewing a QR token
The QR token lives on the **registration** (per event), not the contact. The
**Registrations** view shows each registration's token and a **QR** button that
opens a modal with the scannable code + a **Reset token** action. Reset calls
`reset_registration_qr_token(contact_email)`, which generates a new
`CVV-XXX-NNNN` token, writes it to `registrations.qr_token`, **re-hashes it as the
Auth password** (so the old token stops working), and deletes the contact's
existing sessions (forcing a re-login). The UI shows the new token as a scannable
QR code.
opens a modal with the scannable code. The token is **final** — it is generated by
Pretix and can't be reset from the UI (the `reset_registration_qr_token` RPC still
exists for the sync path, but the admin UI no longer exposes a reset action).
### Sponsor lookup (in-place)
Setting a registration's type to **Sponsor** requires a sponsor lookup. If none
exists for that contact, the change fails with `a sponsor registration requires a
sponsor lookup` and the UI opens an **in-place sponsor popup** (instead of just
erroring). The popup lets the admin create the sponsor (type, name, email, phone,
amount, paid) linked to that contact, then sets the registration type to
`sponsor` in one step.
### Adjusting points
+3 -1
View File
@@ -50,10 +50,12 @@ These map 1:1 to the Postgres RPCs documented in
| `createConnectionRequest(targetQr)` | `create_connection_request` | Send a connection request |
| `acceptConnection(id)` | `accept_connection` | Accept (+5 to both) |
| `rejectConnection(id)` | `reject_connection` | Decline |
| `checkinAttendee(sessionId, attendeeQr)` | `checkin_attendee` | Staff check-in (+10) |
| `checkinAttendee(sessionId, attendeeQr)` | `checkin_attendee` | Staff session check-in (+10) |
| `welcomeCheckin(attendeeQr)` | `welcome_checkin` | Staff welcome check-in (marks present at event, no points) |
| `submitFeedback(sessionId, rating, comment)` | `submit_feedback` | Rate a session (+5/+10) |
| `getLeaderboard()` | `get_leaderboard` | Active-event leaderboard |
| `uploadSessionMaterial(sessionId, file)` | `set_session_material` | Upload to `materials` bucket + set `material_path` |
| `removeSessionMaterial(sessionId)` | `set_session_material` | Delete storage object + clear `material_path` (speakers) |
| `updateMyProfile({linkedin_url, show_email, show_linkedin})` | `update_my_profile` | Self-service: set LinkedIn + visibility toggles on the caller's own contact |
### Direct table reads (RLS-scoped)
+28 -13
View File
@@ -45,12 +45,15 @@ A 3-step flow: **splash → scan → confirm**.
## Home
The landing screen. Shows:
- **Greeting + points pill** — "Good morning, Ana 👋" and `⚡ {points}` (tapping
the pill opens the Leaderboard). The event name (`event.name`) is shown under
the greeting.
- **Now card** — the session the user picked for the current slot, with a
"✓ Checked in" or "Show your QR to staff to check in" pill.
- **Next card** — the pick for the next slot.
- **Greeting + pills** — "Good morning, Ana 👋" and, to the right, a **red
material pill** `📎 {n}` (only for speakers who have one or more of their
sessions without material — tapping it opens a popup listing the pending
sessions) and the **points pill** `⚡ {points}` (tapping opens the Leaderboard).
The event name (`event.name`) is shown under the greeting.
- **Now card** — **always shown** for the current slot. If the user has a pick,
the session title + a "✓ Checked in" / "Show your QR to staff to check in"
pill; otherwise a "No pick yet" placeholder (identical layout for every role).
- **Next card** — **always shown** for the next slot (pick or "No pick yet").
- **My picks today** — shows only **2 rows** (the current slot's pick + the next
slot's pick). "tap to change" is a **hyperlink** to the Agenda.
- **Quick actions** — Scan & connect, Agenda, Connections, Leaderboard.
@@ -58,11 +61,14 @@ The landing screen. Shows:
Check back soon!").
> **Identical for every role.** The Home screen (and the tab bar) is the same for
> attendees and staff — no role badge, no "Check-in" relabel. Staff keep their
> check-in capability inside the **Scan** screen (Attendee/Staff mode toggle).
> attendees and staff — no role badge, no "Check-in" relabel. The Now/Next cards
> always render (with a "No pick yet" placeholder when there's no pick), so the
> layout is identical whether or not the user has picks. Staff keep their check-in
> capability inside the **Scan** screen (Attendee/Staff mode toggle).
Data: `useEvent()` (event + agenda + clock) + `getMyPreferences()` +
`getMyCheckins(email)`. Slot status comes from `slotStatus(slot, now)`
`getMyCheckins(email)` + `getMySpeakerSessions(email)` (for the pending-material
pill). Slot status comes from `slotStatus(slot, now)`
([app-structure.md#the-event-clock](./app-structure.md#the-event-clock)).
## Agenda
@@ -84,6 +90,9 @@ user speaks shows a **"🎤 you"** tag; a session with material shows a **📎**
notice is gone and a **📎 Download material** button appears (visible to **all**
attendees), pinned to the **bottom** of the sheet's button stack (below
"Pick this session").
- **Remove material** — a speaker of the session can also **🗑 Remove material**
(to re-upload). This deletes the storage object and clears `material_path` via
`set_session_material` (null) — `removeSessionMaterial`.
- Picking is "one per slot" — picking a new session in a slot replaces the old
pick (enforced by the `set_preference` RPC).
@@ -101,10 +110,16 @@ is role-aware — staff (`contact.is_admin`) default to **Staff** mode, attendee
"Connect with {name}?" sheet (with the peer's registration-type badge + LinkedIn
link if visible) → `createConnectionRequest(qr)`. Guards: can't connect with
yourself. Result toast reflects the connection status (sent / already connected).
- **Staff mode (check-in):** pick a session (dropdown grouped by slot), then scan
an attendee's lanyard → `checkinAttendee(sessionId, qr)`. Shows a result sheet:
"✓ {name} — Checked in — +10 pts · now {total}" or "⚠️ Already checked in — no
extra points" (the `already` flag from the RPC).
- **Staff mode (check-in):** a **check-in type toggle** (uiverse switch) switches
between two sub-modes:
- **Session check-in** (default) — pick a session (dropdown grouped by slot),
then scan an attendee's lanyard → `checkinAttendee(sessionId, qr)`. Shows a
result sheet: "✓ {name} — Checked in — +10 pts · now {total}" or "⚠️ Already
checked in — no extra points" (the `already` flag from the RPC).
- **Welcome check-in** — no session dropdown; scanning an attendee's lanyard →
`welcomeCheckin(qr)` marks them present at the **event**
(`registrations.checked_in = true`, no points). Result sheet: "👋 {name} —
Welcome to the event! — ✓ Checked in" (or "Already checked in to the event").
Data: `useEvent()` (for the session list) + the RPCs above.