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

Co-authored-by: Stephan Charles <[email protected]>
Co-authored-by: Amelia Hernandez <[email protected]>
Co-authored-by: Markus Franz <[email protected]>
Co-authored-by: Sabrina Hota <[email protected]>
Co-authored-by: Nilüfer Doğan <[email protected]>
This commit is contained in:
committed 2026-08-23 21:33:44 +02:00
1 parent adcbb507e9
commit ffb270c140
16 files changed
+730 -142

No files matched your search

+10
View File
@@ -111,6 +111,15 @@ Staff checks an attendee into a session.
> `return query` inside an `if` block would *not* terminate the function and would
> double-award.
### `welcome_checkin(p_attendee_qr)` → `(attendee_email, attendee_name, already)`
Staff **welcome** check-in: marks an attendee present at the **event** (distinct
from `checkin_attendee`, which checks someone into a specific session).
- **Role check:** `is_staff_or_admin()` or it raises `staff or admin only`.
- Resolves the attendee by `qr_token` for the active event.
- Sets `registrations.checked_in = true` (no points — that's the session
check-in's job).
- `already` is `true` if the attendee was already checked in to the event.
### `submit_feedback(p_session_id, p_rating, p_comment)` → `(feedback_id, points, earned)`
Post-session feedback.
- **Requires the caller to be checked in** to that session (else raises).
@@ -166,6 +175,7 @@ immediately.
### `set_registration_type(p_contact_email, p_type)` → `registrations`
**Admin-only.** Changes a contact's registration type for the active event.
`p_type` is `text` and is cast to the `registration_type` enum on write.
### `evaluate_session_feedback(p_session_id)` → `sessions`
**Admin-only.** The **AI-feedback stub**: sets `ai_generated_feedback` to a
+9 -1
View File
@@ -94,7 +94,7 @@ Points are scoped **per event** here (one row per contact per event).
| `id` | `uuid` PK | |
| `event_id` | `uuid` FK → `events` | `on delete cascade` |
| `contact_email` | `text` FK → `contacts` | `on delete cascade` |
| `type` | `text` | `attendee` \| `speaker` \| `staff` \| `sponsor` (default `attendee`) |
| `type` | `registration_type` (enum) | `attendee` \| `speaker` \| `staff` \| `sponsor` (default `attendee`) |
| `checked_in` | `boolean` | default `false` |
| `points` | `integer` | `>= 0`, default 0 |
| `qr_token` | `text` | nullable — the lanyard token; **doubles as the Auth password** (generated per event) |
@@ -105,6 +105,14 @@ Points are scoped **per event** here (one row per contact per event).
per event. Partial unique indexes: `registrations_external_id_uniq (external_id) WHERE external_id IS NOT NULL`
and `registrations_qr_token_uniq (qr_token) WHERE qr_token IS NOT NULL` (fast lanyard lookups).
**`type` is a Postgres ENUM** (`public.registration_type`), not free text — the
four ticket types are enforced at the database level.
**Speaker auto-promote:** the `session_speakers_speaker_promote` trigger (after
insert on `session_speakers`) promotes a contact's active-event registration from
`attendee` → `speaker` when they're added as a speaker. It is one-way (removing a
speaker never demotes) and never overrides an explicit `staff`/`sponsor` ticket.
## `sponsors` — a sponsor for an event
Unpaid sponsors are hidden from non-admins (RLS).
+36 -21
View File
@@ -42,31 +42,43 @@ Source of truth: [`supabase/seed.sql`](../../supabase/seed.sql). The seed runs o
## Demo accounts
**Attendees & staff** log in with **QR code** (typed or scanned) + **email** —
the QR token is the Auth password. The **APPE Admin** (and any staff member you
give one) can also log in with **email + password** (event-independent, so it
works for any event). The password lives in `contacts.password`; a trigger
(`trg_contact_password_sync`) **auto-syncs** it as the bcrypt hash in
`auth.users.encrypted_password`, so just set `contacts.password` in Supabase and
it works with `signInWithPassword` immediately.
**Attendees** log in with **QR code** (typed or scanned) + **email** — the QR
token is the Auth password. **Staff** log in with **QR code + their staff
password** (the Convivo app shows a password field when a staff QR is detected;
the email comes from the resolved contact). The **APPE Admin** (and any staff
member you give one) can also log in with **email + password** in the admin app
(event-independent, so it works for any event). The password lives in
`contacts.password`; a trigger (`trg_contact_password_sync`) **auto-syncs** it as
the bcrypt hash in `auth.users.encrypted_password`, so just set
`contacts.password` in Supabase and it works with `signInWithPassword`
immediately.
| Person | Type | Login | Email | Start pts |
|---|---|---|---|---|
| **Ana Silva** | attendee | QR `CVV-ANA-4821` | ana.silva@nubank.com | 40 |
| **Bruno Costa** | staff (admin) | QR `CVV-BRU-1177` | bruno.costa@acme.com | 140 |
| **Rita Lopes** | staff (admin) | QR `CVV-RIT-9034` | rita.lopes@globant.com | 95 |
| **Ana Silva** | speaker | QR `CVV-ANA-4821` | ana.silva@nubank.com | 40 |
| **Bruno Costa** | staff (admin) | QR `CVV-BRU-1177` + **password** `appe-admin-2026` | bruno.costa@acme.com | 140 |
| **Rita Lopes** | staff (admin) | QR `CVV-RIT-9034` + **password** `appe-admin-2026` | rita.lopes@globant.com | 95 |
| **APPE Admin** | staff (admin) | **password** `appe-admin-2026` | admin@appe.at | 0 |
| Tomás Ribeiro | attendee | `CVV-TOM-5566` | tomas.ribeiro@dataprev.com | 88 |
| Sofia Almeida | attendee | `CVV-SOF-2299` | sofia.almeida@loop.com | 76 |
| Marco Chen | attendee | `CVV-MRC-7712` | marco.chen@deepmind.com | 70 |
| Julia Santos | attendee | `CVV-JUL-3345` | julia.santos@ifood.com | 64 |
| Pedro Nunes | attendee | `CVV-PED-8801` | pedro.nunes@microsoft.com | 58 |
| Carla Mendes | attendee | `CVV-CAR-6623` | carla.mendes@quintoessencial.com | 52 |
| Diego Ferreira | attendee | `CVV-DIE-4458` | diego.ferreira@stone.com | 35 |
| Marina Costa | attendee | `CVV-MNA-2210` | marina.costa@olx.com | 28 |
| Lucas Oliveira | attendee | `CVV-LUC-9987` | lucas.oliveira@usp.br | 15 |
| Tomás Ribeiro | speaker | `CVV-TOM-5566` | tomas.ribeiro@dataprev.com | 88 |
| Sofia Almeida | speaker | `CVV-SOF-2299` | sofia.almeida@loop.com | 76 |
| Marco Chen | speaker | `CVV-MRC-7712` | marco.chen@deepmind.com | 70 |
| Julia Santos | speaker | `CVV-JUL-3345` | julia.santos@ifood.com | 64 |
| Pedro Nunes | speaker | `CVV-PED-8801` | pedro.nunes@microsoft.com | 58 |
| Carla Mendes | speaker | `CVV-CAR-6623` | carla.mendes@quintoessencial.com | 52 |
| Diego Ferreira | speaker | `CVV-DIE-4458` | diego.ferreira@stone.com | 35 |
| Marina Costa | speaker | `CVV-MNA-2210` | marina.costa@olx.com | 28 |
| Lucas Oliveira | speaker | `CVV-LUC-9987` | lucas.oliveira@usp.br | 15 |
| Dr. Elena Vasquez | (external speaker) | — | elena.vasquez@keynote.com | — |
> **Speaker auto-promote:** every seeded attendee who speaks in a session is
> typed `speaker` (the `session_speakers_speaker_promote` trigger promotes
> `attendee` → `speaker` on insert, so the seed states the final type). Only
> Bruno, Rita, and the APPE Admin are `staff` (the trigger never overrides an
> explicit staff/sponsor ticket).
>
> **Staff passwords:** Bruno and Rita have `contacts.password = 'appe-admin-2026'`
> so the Convivo **staff QR login** (QR + staff password) works out of the box.
> **Dr. Elena Vasquez** is an external keynote speaker: she has a `contacts` row
> (and speaks in `session_speakers`) but **no registration, no QR token, and no
> auth user**, so she can't log in — she only appears as a speaker on the agenda.
@@ -101,8 +113,11 @@ Ana (`[email protected]`) is seeded with a coherent 40-point history:
1. Log in as **Ana** (attendee) → Home, Agenda, Leaderboard all populated.
2. Scan **Marco** (`CVV-MRC-7712`) → send a connection request.
3. Log in as **Bruno** (staff) → the Scan tab becomes **Check-in** → pick a
session → scan **Carla** (`CVV-CAR-6623`) → she gets +10.
3. Log in as **Bruno** (staff) → QR `CVV-BRU-1177` + staff password
`appe-admin-2026` → the Scan tab becomes **Check-in** → pick a session → scan
**Carla** (`CVV-CAR-6623`) → she gets +10. Flip the **check-in type toggle**
to **Welcome check-in** and scan **Tomás** (`CVV-TOM-5566`) → he's marked
present at the event (no points).
4. Watch the **Leaderboard** update live (Realtime).
5. Log in as **APPE Admin** (`[email protected]` / password `appe-admin-2026`) in the
admin app → Dashboard, Contacts, Registrations, Sponsors, Schedule, Activity,