Staff exclusions + contact-password auth sync
- contacts.password now auto-syncs to auth.users.encrypted_password via trg_contact_password_sync, so setting a password on the contact row in the Supabase UI makes it work with signInWithPassword immediately (fixes staff like Bruno not being able to log in with a UI-set password). One-time reconciliation in the migration. - Staff excluded from the leaderboard: _sync_leaderboard skips/removes staff rows, get_leaderboard() filters type='staff', seed no longer inserts staff. Affects the attendee Leaderboard and the admin Dashboard 'Top points'. - Home/Agenda/Profile identical for all roles: Home quick-action always 'Scan & connect' (no 'Check-in' relabel), footer role badge removed, tab label always 'Scan' (staff keep check-in via the Scan screen mode toggle). - Profile: removed the duplicate Staff pill (type pill already shows Staff). - Agenda session sheet: 'Download material' moved to the bottom of the button stack with spacing. - Docs updated (schema, rpcs, seed, screens, architecture, next-steps).
This commit is contained in:
1 parent
8b1130f078
commit
698bf13551
12 files changed
+203
-45
No files matched your search
@@ -43,7 +43,10 @@ The single place points change. In one transaction it:
|
||||
### `_sync_leaderboard(p_event_id, p_contact_email)`
|
||||
Upserts the `leaderboard` row for that (event, contact) from `registrations` +
|
||||
`contacts` (`on conflict (event_id, contact_email) do update ...`). This is what
|
||||
makes the leaderboard a consistent, Realtime-friendly mirror.
|
||||
makes the leaderboard a consistent, Realtime-friendly mirror. **Staff are
|
||||
excluded:** if the contact's registration `type` is `staff` (or there is no
|
||||
registration), the function **deletes** any existing leaderboard row instead of
|
||||
inserting — so staff never appear on the board even if they hold points.
|
||||
|
||||
### `_recalc_event_aggregates(p_event_id)`
|
||||
Recomputes the `events` aggregate columns (`num_sessions`, `num_speakers`,
|
||||
@@ -54,7 +57,7 @@ triggers and the feedback RPC.
|
||||
|
||||
| Function | Returns | Used for |
|
||||
|---|---|---|
|
||||
| `get_leaderboard()` | `event_id, contact_email, full_name, points` (active event, ordered by points) | Leaderboard initial load + realtime re-fetch |
|
||||
| `get_leaderboard()` | `event_id, contact_email, full_name, points` (active event, **staff excluded**, ordered by points) | Leaderboard initial load + realtime re-fetch |
|
||||
| `lanyard_lookup(p_qr_token)` | `email, full_name, linkedin_url` (null unless `show_linkedin`), `show_email`, `registration_type` | Resolve a scanned QR (pre-login + connect) |
|
||||
| `get_public_contacts()` | `email, full_name, linkedin_url`, `show_email`, `registration_type` (active-event registrants) | Connections name/type lookups |
|
||||
| `get_agenda()` | flat rows: slot fields + session fields + `speakers` (string_agg) | Agenda + Home |
|
||||
|
||||
@@ -56,7 +56,7 @@ password).
|
||||
| `show_email` | `boolean` | default `false` — visibility toggle |
|
||||
| `show_linkedin` | `boolean` | default `false` — visibility toggle |
|
||||
| `is_admin` | `boolean` | default `false` — **staff = admin (merged)**; grants check-in + APPE Admin access |
|
||||
| `password` | `text` | nullable — **admin-only**: the APPE Admin login password (event-independent). To work it must match the bcrypt hash in `auth.users.encrypted_password`. Set directly in Supabase (no self-service UI) |
|
||||
| `password` | `text` | nullable — the **login password** (event-independent) for admin/staff. Setting it (e.g. in the Supabase Table Editor) **auto-syncs** the bcrypt hash into `auth.users.encrypted_password` via the `trg_contact_password_sync` trigger, so it works with `signInWithPassword` immediately |
|
||||
| `external_id` | `text` | nullable — the Pretix order code (set by the sync) |
|
||||
| `created_at` | `timestamptz` | |
|
||||
|
||||
@@ -247,6 +247,10 @@ truth — it is kept in sync transactionally by the RPCs (see
|
||||
this table to update the leaderboard live. See
|
||||
[../frontend/screens.md#leaderboard](../frontend/screens.md#leaderboard).
|
||||
|
||||
> **Staff are excluded.** `_sync_leaderboard` skips (and removes) staff rows, so
|
||||
> staff never appear on the board even if they hold points. `get_leaderboard()`
|
||||
> also filters `type = 'staff'` as defense in depth.
|
||||
|
||||
## `points_log` — audit trail
|
||||
|
||||
Powers the per-category points breakdown on the Profile screen (per event).
|
||||
|
||||
@@ -15,7 +15,7 @@ Source of truth: [`supabase/seed.sql`](../../supabase/seed.sql). The seed runs o
|
||||
| `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` |
|
||||
| `leaderboard` | 10 | mirrored from `registrations`, **staff excluded** (13 registrants − 3 staff) |
|
||||
| `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 |
|
||||
|
||||
@@ -43,10 +43,12 @@ 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** 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.
|
||||
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.
|
||||
|
||||
| Person | Type | Login | Email | Start pts |
|
||||
|---|---|---|---|---|
|
||||
|
||||
Reference in new issue
Block a user