Redesign Phases 3-6: multi-event model, APPE Admin, Convivo App behaviors, APPE branding

- Phase 3: new migration 20260824000000_redesign.sql (contacts/events/registrations/sponsors, slot types, session speakers + feedback/material), seed rewrite
- Phase 4: APPE Admin rebrand + Contacts/Registrations/Sponsors/Schedule/Activity/Events views
- Phase 5: Convivo App (24h login, 5s polling, QR type badge, red dot, speaker material)
- Phase 6: APPE favicon + PWA icons for both apps
- Docs: schema/rpcs/rls/seed/screens/api-client/admin-app/architecture/next-steps/README/roadmap updated
This commit is contained in:
Lago committed 2026-08-23 02:53:16 +02:00
1 parent 5adb5785aa
commit 22f5f1d317
64 files changed
+4593 -1371

No files matched your search

+33 -18
View File
@@ -25,7 +25,8 @@ export const supabase = createClient(url, anonKey, {
user's identity comes from the session JWT, and RLS enforces access. See
[../backend/rls.md](../backend/rls.md).
- **Session persistence** — the session is stored in `localStorage` and
auto-refreshed, so a reload keeps you logged in.
auto-refreshed, so a reload keeps you logged in. The JWT expiry is **24h**
(`jwt_expiry = 86400`), so a login lasts a full day.
## The typed wrapper (`lib/api.ts`)
@@ -40,9 +41,10 @@ These map 1:1 to the Postgres RPCs documented in
| Client function | RPC | Purpose |
|---|---|---|
| `lanyardLookup(qrToken)` | `lanyard_lookup` | Resolve a scanned QR to a public profile |
| `getPublicProfiles()` | `get_public_profiles` | All public profiles (leaderboard, name lookups) |
| `lanyardLookup(qrToken)` | `lanyard_lookup` | Resolve a scanned QR to a public contact + registration type |
| `getPublicContacts()` | `get_public_contacts` | Active-event contact directory (names + types) |
| `getAgenda()` | `get_agenda` | Slots + sessions (flat rows) |
| `getActiveEvent()` | `get_active_event` | The active event row |
| `setPreference(sessionId)` | `set_preference` | Pick a session for its slot |
| `clearPreference(slotId)` | `clear_preference` | Remove a pick |
| `createConnectionRequest(targetQr)` | `create_connection_request` | Send a connection request |
@@ -50,32 +52,41 @@ These map 1:1 to the Postgres RPCs documented in
| `rejectConnection(id)` | `reject_connection` | Decline |
| `checkinAttendee(sessionId, attendeeQr)` | `checkin_attendee` | Staff check-in (+10) |
| `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` |
### Direct table reads (RLS-scoped)
These read the caller's own rows (RLS returns only what the user may see):
These read the caller's own rows (RLS returns only what the user may see). For an
admin contact, RLS returns **all** rows, so the "my" reads filter by email
client-side to avoid leaking other people's data:
| Client function | Table | Returns |
|---|---|---|
| `getMyContact(email)` | `contacts` | the caller's contact |
| `getMyRegistration(email)` | `registrations` | the caller's registration (active event) |
| `getMyPreferences()` | `preferences` | the caller's picks |
| `getMyConnections()` | `connections` | connections the caller is in |
| `getMyCheckins()` | `checkins` | the caller's checked-in session ids |
| `getMyFeedback()` | `feedback` | the caller's feedback |
| `getLeaderboard()` | `leaderboard` | all rows (public to authenticated) |
| `getMyPointsLog()` | `points_log` | the caller's points history |
| `getMyCheckins(email)` | `checkins` | the caller's checked-in session ids |
| `getMyFeedback(email)` | `feedback` | the caller's feedback |
| `getMyPointsLog(email)` | `points_log` | the caller's points history |
| `getMySpeakerSessions(email)` | `session_speakers` | session ids the caller speaks |
### Helpers
- **`groupAgenda(rows)`** — turns the flat `get_agenda()` rows into
`{ slot, sessions[] }[]` ordered by slot id. Used by `useEvent()`.
- **`sessionMaterialUrl(path)`** — builds the public URL for a session material
in the `materials` bucket.
## Types (`lib/types.ts`)
TypeScript interfaces mirroring the DB tables and RPC return shapes
(`Profile`, `PublicProfile`, `Slot`, `Session`, `AgendaRow`, `Preference`,
`Connection`, `Checkin`, `Feedback`, `LeaderboardRow`, `PointsLogRow`,
`CheckinResult`, `FeedbackResult`). `PublicProfile` is the safe projection
(no email / qr_token) returned by the public read functions.
(`Contact`, `Registration`, `Event`, `Slot`, `Session`, `AgendaRow`,
`Preference`, `Connection`, `Checkin`, `Feedback`, `LeaderboardRow`,
`PointsLogRow`, `PublicContact`, `CheckinResult`, `FeedbackResult`).
`PublicContact` is the safe projection (email + name + visibility-respected
linkedin + registration type) returned by the public read functions.
## Error handling
@@ -83,11 +94,15 @@ TypeScript interfaces mirroring the DB tables and RPC return shapes
- Screens catch errors and surface them via toasts
(`useToast().toast(message, 'err')`). RPCs raise human-readable messages
(e.g. "staff or admin only", "you must be checked in to this session to give
feedback") — see [../backend/rpcs.md#error-handling](../backend/rpcs.md#error-handling).
feedback", "not a speaker of this session") — see
[../backend/rpcs.md#error-handling](../backend/rpcs.md#error-handling).
## Realtime
## Realtime + polling
The only realtime subscription is on the `leaderboard` table (see
[screens.md#leaderboard](./screens.md#leaderboard)). The `leaderboard` table is
the Realtime source and is kept in sync transactionally by the RPCs — see
[../backend/schema.md#leaderboard--realtime-mirror](../backend/schema.md#leaderboard--realtime-mirror).
- **Realtime** — the only realtime subscription is on the `leaderboard` table
(see [screens.md#leaderboard](./screens.md#leaderboard)). The `leaderboard`
table is the Realtime source and is kept in sync transactionally by the RPCs —
see [../backend/schema.md#leaderboard--realtime-mirror](../backend/schema.md#leaderboard--realtime-mirror).
- **Polling** — Connections and the Shell's pending-connection red dot use
`usePolling` (5s, visibility-aware) — see
[app-structure.md#the-polling-hook-libusepollingts](./app-structure.md#the-polling-hook-libusepollingts).