Add Pretix ticketing integration (every-minute sidecar sync)

- docs/backend/pretix.md: Pretix REST API reference (auth, orders/items
  endpoints, pagination, rate limiting, worked example)
- migration 20260909000000_pretix_sync.sql: events.pretix_organizer +
  pretix_event_slug; _map_ticket_type, _ensure_auth_user (QR token =
  password), sync_pretix_attendees (service-role-only, idempotent)
- sidecar: pretixFetch/fetchPretixOrders/fetchPretixItems/transformPretix,
  runPretixSync + every-minute runPretixLoop, POST /run-pretix, /status
  extended with pretix state
- admin: Pretix panel + recent runs in Interfaces, per-event Pretix config
  + Sync button in Events, api/types for Pretix
- docker-compose: PRETIX_API_KEY / PRETIX_BASE / PRETIX_SYNC_INTERVAL_MS

Verified on VM: 25 paid orders -> 25 attendees, auto-sync every minute,
login via QR token works, idempotent (no duplicate registrations).
This commit is contained in:
Lago committed 2026-09-09 11:40:56 +02:00
1 parent 692df23149
commit c7d095aff7
8 files changed
+1009 -10

No files matched your search

+11
View File
@@ -8,6 +8,7 @@ import type {
Feedback,
LeaderboardRow,
PointsLogRow,
PretixSyncResult,
Registration,
ResetQrResult,
Session,
@@ -152,6 +153,8 @@ export async function upsertEvent(
end_date: string;
location?: string | null;
sessionize_endpoint?: string | null;
pretix_organizer?: string | null;
pretix_event_slug?: string | null;
use_realtime_clock?: boolean;
},
): Promise<void> {
@@ -189,6 +192,10 @@ export const getSidecarStatus = () => sidecarFetch<SidecarStatus>('/status');
export const runSessionizeSync = (eventId: string) =>
sidecarFetch<SyncResult>('/run', { method: 'POST', body: JSON.stringify({ event_id: eventId }) });
/** Trigger a (blocking) Pretix sync for an event. Resolves with the result. */
export const runPretixSync = (eventId: string) =>
sidecarFetch<PretixSyncResult>('/run-pretix', { method: 'POST', body: JSON.stringify({ event_id: eventId }) });
/**
* Upload the Sessionize "Sessions and speakers (advanced)" .xlsx for an event.
* The sidecar parses it and imports speakers/sessions/agenda + speaker
@@ -216,6 +223,10 @@ export const getSyncRuns = (eventId: string) =>
rows.filter((r) => r.event_id === eventId),
);
/** Recent Pretix sync_runs rows for an event (newest first). */
export const getPretixRuns = (eventId: string) =>
getSyncRuns(eventId).then((rows) => rows.filter((r) => r.source === 'pretix'));
/** Set an event active (deactivates all others via trigger). */
export async function activateEvent(id: string): Promise<void> {
const { error } = await supabase.from('events').update({ is_active: true }).eq('id', id);