Files
Convivo/docs/backend/seed.md
T
0221b1a8c0 Admin password login + attendee profile self-service
- contacts.password: admin-only APPE Admin login password (event-independent);
  must match the bcrypt hash in auth.users.encrypted_password (set in Supabase).
- APPE Admin login is now email + password (was QR token).
- update_my_profile RPC (security definer, scoped to current_email()): attendees
  set their LinkedIn URL + show_email / show_linkedin toggles from the Profile.
- Convivo Profile gains a 'Profile settings' card (LinkedIn + 2 toggles + Save).
- Visibility enforced server-side in the public projection (linkedin nulled when
  show_linkedin off, email omitted when show_email off).
- Seed: admin password appe-admin-2026; staff keep QR tokens as auth passwords.
- Docs updated (schema, rpcs, seed, admin-app, screens, api-client,
  architecture, next-steps, README, docker-compose).

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]>
2026-08-23 14:11:26 +02:00

109 lines
5.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Seed Data & Demo Accounts
Source of truth: [`supabase/seed.sql`](../../supabase/seed.sql). The seed runs on
`npm run db:reset` and is **idempotent** (`on conflict ... do nothing`).
## What it creates
| Data | Count | Notes |
|---|---|---|
| `auth.users` + `auth.identities` | 13 | 12 attendees + 1 admin; **QR token = bcrypt password** (attendees/staff) — the admin uses a real **password** instead |
| `contacts` | 14 | 13 registrants + 1 external keynote speaker (no token — tokens live on registrations) |
| `events` | 1 | **APPE 2026**, 2026-10-23, São Paulo, Brazil, **active** |
| `registrations` | 13 | one per contact (Elena has none); points + **QR token** scoped here |
| `sponsors` | 3 | Nubank (headline, paid), Acme Corp (gold, paid), Globant (community, unpaid) |
| `slots` | 6 | 23 Oct, 09:00–15:45 (see table below) |
| `sessions` | 18 | 3 per slot (Main Stage / Room A / Room B) |
| `session_speakers` | 22 | M:N session → contact |
| `leaderboard` | 13 | mirrored from `registrations` |
| `points_log` | 16 | Ana's coherent breakdown + one `admin` entry per other user |
| Ana's demo state | — | 6 preferences, 2 check-ins, 4 connections, 1 feedback |
> **GoTrue gotcha:** manually-inserted `auth.users` must have
> `confirmation_token`, `recovery_token`, `email_change_token_new`, and
> `email_change` set to `''` (empty string), **not NULL** — GoTrue's password
> grant can't scan a NULL `confirmation_token`. `phone` is left NULL (unique
> constraint).
> **Staff = admin (merged).** Bruno, Rita, and the APPE Admin have
> `is_admin = true` on their `contacts` row. Their registration `type` is
> `staff` (the ticket type shown on the lanyard).
## Slots
| id | Type | Time |
|---|---|---|
| 1 | keynote | 09:00–09:45 |
| 2 | session | 10:00–10:45 |
| 3 | session | 11:30–12:15 |
| 4 | lunch_break | 13:15–14:00 |
| 5 | session | 14:00–14:45 |
| 6 | close_up | 15:00–15:45 |
## Demo accounts
**Attendees & staff** log in with **QR code** (typed or scanned) + **email** —
the QR token is the Auth password. The **APPE Admin** is different: it logs in
with **email + password** (event-independent, so it works for any event). The
admin's password is stored in `contacts.password` **and** as the bcrypt hash in
`auth.users.encrypted_password` (they must match). Set it directly in Supabase.
| 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 |
| **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 |
| Dr. Elena Vasquez | (external speaker) | — | elena.vasquez@keynote.com | — |
> **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.
## Ana's demo state (so the app looks alive on first login)
Ana (`[email protected]`) is seeded with a coherent 40-point history:
- **Points breakdown** (`points_log`): 2× check-in (+10 each), 2× connection
(+5 each), 1× feedback (+10) = **40**.
- **Preferences** — one pick per slot (matches the mockup):
- Slot 1 → *Designing for Trust in AI Products*
- Slot 2 → *AI in Practice: Lessons from Production*
- Slot 3 → *Data Storytelling*
- Slot 4 → *Prototyping with AI*
- Slot 5 → *Community-Led Growth*
- Slot 6 → *Closing Panel: What's Next*
- **Check-ins** — checked into Slot 1 and Slot 2 (by staff Bruno).
- **Connections**:
- accepted with **Bruno** and **Rita**
- incoming (pending) from **Sofia**
- outgoing (pending) to **Julia**
- **Feedback** — rated Slot 1's *Designing for Trust in AI Products* 5★ with a
comment.
- **Speaker** — Ana is a speaker of Slot 6's *Open Space: Your Ideas* (so the
Agenda shows a "🎤 you" tag and the material-upload notice).
> Everyone else gets a single `admin` `points_log` entry for their starting points
> (so the Profile breakdown shows "Other"), and no other activity.
## Suggested demo flow
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.
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,
Events. (Staff Bruno/Rita can also open the admin app with their email + QR
token, since that is their Auth password.)