Phase 7+8: Pretix + Sessionize interfaces

- Migration 20260825000000_interfaces.sql: external_id on contacts/
  registrations/sessions (+ partial unique indexes), slots_id_seq, sync_runs
  audit table, and service-role-only sync_pretix_attendees /
  sync_sessionize_sessions RPCs (idempotent upserts).
- sync-trigger Edge Function: admin-JWT or CRON_SECRET auth, pulls from
  Pretix/Sessionize base URLs, normalizes, calls the service-role RPCs.
- interfaces/mock-api: dependency-free Node server (:54330) + fixtures so the
  full pipeline is testable without real tokens.
- APPE Admin 'Interfaces' view: per-source + 'Sync all' triggers, result
  counts, recent sync runs, and QR CSV export; /functions proxy added.
- Docs: new docs/backend/interfaces.md; updated README, roadmap, next-steps,
  schema, rls, rpcs, architecture, admin-app, and docs index.

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 03:34:30 +02:00
1 parent 7605c9bbf4
commit 74c41c8c1d
26 files changed
+1529 -80

No files matched your search

+11 -3
View File
@@ -34,16 +34,20 @@ flowchart LR
K --> R["PostgREST"]
K --> RT["Realtime"]
K --> S["Storage"]
K --> EF["Edge Functions<br/>sync-trigger"]
R --> P[("Postgres 17<br/>schema · RLS · points RPCs")]
RT --> P
G --> P
EF -->|"service-role RPCs"| R
end
MA["mock-api (:54330)<br/>Pretix + Sessionize fixtures"]
end
A -->|"same-origin /auth /rest /realtime /storage"| N
AD -->|"same-origin /auth /rest /realtime /storage"| NA
A -->|"same-origin /auth /rest /realtime /storage /functions"| N
AD -->|"same-origin /auth /rest /realtime /storage /functions"| NA
N -->|"proxy (supabase_kong_Convivo:8000)"| K
NA -->|"proxy (supabase_kong_Convivo:8000)"| K
EF -->|"GET /pretix/attendees · /sessionize/sessions"| MA
```
**Key idea:** there is **no custom backend**. Supabase provides auth, data,
@@ -58,6 +62,7 @@ talks to Supabase through **same-origin paths**, so there is no CORS to manage.
| App | **React 18 + Vite 5 + TypeScript** (PWA) | Fast, mobile-first, installable; same-origin proxy avoids CORS |
| QR | `html5-qrcode` (scan) + `qrcode.react` (render) | Camera scan with manual-entry fallback |
| Client | `@supabase/supabase-js` | Auth + REST + Realtime in one client |
| Interfaces | **`sync-trigger` Edge Function** (Deno) + **mock API** (Node) | Pulls real Pretix/Sessionize data and imports it via service-role RPCs; the mock API serves fixtures locally |
| Packaging | **Docker** (multi-stage build → nginx) | The app is a sidecar that joins the Supabase network |
## 4. The two halves
@@ -70,6 +75,9 @@ Everything server-side lives in Postgres. See [backend/README.md](./backend/READ
keep the leaderboard consistent. → [backend/rpcs.md](./backend/rpcs.md)
- **Security** — Row Level Security on every table; the app only ever uses the
**anon key + the user's session JWT**. → [backend/rls.md](./backend/rls.md)
- **Interfaces** — service-role-only sync RPCs (`sync_pretix_attendees`,
`sync_sessionize_sessions`) called by the `sync-trigger` Edge Function, which
pulls from Pretix/Sessionize (or the local mock API). → [backend/interfaces.md](./backend/interfaces.md)
- **Data** — seed with 1 event, 6 slots, 18 sessions, 14 contacts, 13
registrations, 3 sponsors. → [backend/seed.md](./backend/seed.md)
@@ -85,7 +93,7 @@ A separate desktop-first React app for organizers, guarded to the **`is_admin`**
flag. See [frontend/admin-app.md](./frontend/admin-app.md):
- **Views** — Dashboard (active event + aggregates), Contacts, Registrations,
Sponsors, Schedule (slots/sessions/speakers/material/AI-evaluate), Activity,
Events.
Events, and **Interfaces** (trigger Pretix/Sessionize syncs + export the QR CSV).
- **Auth guard** — same QR + email login, but non-admin sessions are rejected.
- **Key RPCs** — `reset_qr_token` (regenerate a lanyard token + sync the Auth
password), `adjust_points`, `upsert_contact`, `create_registration`,