feat: add magic-link admin login and speaker materials portal

This commit is contained in:
Lago committed 2026-10-07 18:27:56 +02:00
1 parent 3adc0fd58f
commit 8d8d3ae4b8
28 files changed
+1623 -232

No files matched your search

+33 -1
View File
@@ -55,7 +55,7 @@ These map 1:1 to the Postgres RPCs documented in
| `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) |
| `removeSessionMaterial(sessionId)` | `set_session_material` | Clear `material_path`, then delete the detached storage object |
| `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)
@@ -82,6 +82,38 @@ client-side to avoid leaking other people's data:
- **`sessionMaterialUrl(path)`** — builds the public URL for a session material
in the `materials` bucket.
## Speaker Portal
[speakerPortal.ts](../../apps/convivo/src/lib/speakerPortal.ts) recognizes only
`/speaker/secret` and `/speaker` (optional trailing slash). It exposes a shared
`speakerPortalSession` promise, consuming implicit token pairs with `setSession`
or PKCE codes with `exchangeCodeForSession` exactly once per page load, including
React StrictMode. Automatic URL session detection remains disabled. Callback
parameters are scrubbed before auth calls; errors use generic recoverable text.
`SpeakerPortal` requests `signInWithOtp` with `shouldCreateUser: false` and
`emailRedirectTo: window.location.origin + '/speaker/secret'`. Supabase Auth's
redirect allowlist must include this URL on each deployment origin. This does
not create contacts, registrations or Auth users.
`getSpeakerPortalSessions()` calls `get_my_speaker_sessions`, returning typed
`SpeakerSession` rows with talk/material, event and slot information. Authorization
is [backend-owned](../backend/rls.md#speaker-portal-authorization); the client
does not filter by active event, clock, points or physical check-in.
Material helpers are shared with Agenda. Upload reads the previous path, creates
a unique `sessions/<session UUID>/<random UUID>-<sanitized filename>` object,
then calls `set_session_material`. A rejected attachment removes the new object.
After successful replacement, the previous object is removed. Removal detaches
the path first, then deletes the old object. Cleanup errors distinguish a saved
or detached material from a failed attachment; the portal refreshes the list
after each attempted operation. These Storage and RPC calls are not one atomic
transaction, so simultaneous clients remain last-writer-wins and can leave an
unattached object; they never mutate attendance or points.
See [RPC contract](../backend/rpcs.md#speaker-portal-rpcs),
[screen states](./screens.md#speaker-portal) and [tests](../backend/tests.md#speaker-portal).
## Types (`lib/types.ts`)
TypeScript interfaces mirroring the DB tables and RPC return shapes