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.
This commit is contained in:
Lago committed 2026-08-23 03:34:30 +02:00
1 parent 22f5f1d317
commit 16f304d145
26 files changed
+1529 -80

No files matched your search

+22 -1
View File
@@ -20,6 +20,7 @@ It runs on **port 3001** (Vite dev) or as the `convivo-admin` Docker container
| **Schedule** | Slots (with type) + sessions (with speakers 1:N, material upload, `average_feedback`, `ai_generated_feedback` + an **Evaluate** stub button). |
| **Activity** | Tables of check-ins, connections, and feedback (per active event). |
| **Events** | Create event, set active (only one), edit dates/location. |
| **Interfaces** | Trigger **Pretix** and **Sessionize** syncs (per-source or "Sync all"), show the result counts, list recent sync runs, and **export the QR CSV** (name/email/type/qr_token for the active event). |
## Auth guard
@@ -59,7 +60,8 @@ apps/admin/src/
├─ Sponsors.tsx # sponsor CRUD
├─ Schedule.tsx # slots + sessions + speakers + material + AI-evaluate
├─ Activity.tsx # check-ins / connections / feedback tables
└─ Events.tsx # event management
├─ Events.tsx # event management
└─ Sync.tsx # Interfaces: Pretix/Sessionize sync + QR CSV export
```
## Data access
@@ -100,6 +102,25 @@ The Schedule view uploads a session's material to the `materials` bucket and set
button calls `evaluate_session_feedback` (the AI stub) to set
`ai_generated_feedback`.
### Interfaces (Pretix + Sessionize sync)
The **Interfaces** view is the admin's control panel for the data interfaces
(Phases 7–8). It does **not** call the sync RPCs directly — those are
`service_role`-only. Instead it POSTs to the **`sync-trigger` Edge Function**
(`/functions/v1/sync-trigger`) with the admin's session JWT; the function verifies
the caller is an admin (via the `is_admin()` RPC), fetches from the configured
Pretix/Sessionize base URLs (the local **mock API** by default), and calls the
service-role RPCs `sync_pretix_attendees` / `sync_sessionize_sessions`.
- **Sync now / Sync all** — trigger one source or both; the response shows
`created` / `updated` / `skipped` counts (and any per-item errors).
- **Recent sync runs** — the last 8 rows of `sync_runs` (admin-only read).
- **Export QR CSV** — builds a CSV of the active event's registrations
(name, email, type, qr_token) and triggers a browser download, so organizers can
print lanyards without touching the database.
Full details: [../backend/interfaces.md](../backend/interfaces.md).
## Styling
The admin app reuses the attendee app's **design tokens** (colors, Poppins font,