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:
1 parent
7605c9bbf4
commit
74c41c8c1d
26 files changed
+1529
-80
No files matched your search
@@ -0,0 +1,8 @@
|
||||
# Convivo — mock Pretix/Sessionize API (Phase 7 + 8).
|
||||
# Dependency-free Node server; no build step needed.
|
||||
FROM node:20-alpine
|
||||
WORKDIR /app
|
||||
COPY package.json server.js ./
|
||||
COPY fixtures ./fixtures
|
||||
EXPOSE 54330
|
||||
CMD ["node", "server.js"]
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"results": [
|
||||
{
|
||||
"order_code": "PX-NEW-001",
|
||||
"attendee_name": "New Attendee One",
|
||||
"attendee_email": "[email protected]",
|
||||
"ticket_type": "Regular"
|
||||
},
|
||||
{
|
||||
"order_code": "PX-NEW-002",
|
||||
"attendee_name": "New Speaker Two",
|
||||
"attendee_email": "[email protected]",
|
||||
"ticket_type": "Speaker"
|
||||
},
|
||||
{
|
||||
"order_code": "PX-ANA-003",
|
||||
"attendee_name": "Ana Silva",
|
||||
"attendee_email": "[email protected]",
|
||||
"ticket_type": "Regular"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"sessions": [
|
||||
{
|
||||
"id": "ses-900",
|
||||
"title": "Lightning Talks (Synced)",
|
||||
"description": "A batch of short talks, synced from Sessionize.",
|
||||
"room": "Main Hall",
|
||||
"capacity": 200,
|
||||
"start_time": "2026-10-23T16:00:00Z",
|
||||
"end_time": "2026-10-23T16:45:00Z",
|
||||
"speakers": [
|
||||
{ "id": "spk-1", "name": "New Speaker Two", "email": "[email protected]" },
|
||||
{ "id": "spk-2", "name": "Dr. Elena Vasquez", "email": "[email protected]" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "ses-901",
|
||||
"title": "Panel: The Future of APPE",
|
||||
"description": "A panel discussion, synced from Sessionize.",
|
||||
"room": "Room B",
|
||||
"capacity": 120,
|
||||
"start_time": "2026-10-23T17:00:00Z",
|
||||
"end_time": "2026-10-23T17:45:00Z",
|
||||
"speakers": [
|
||||
{ "id": "spk-3", "name": "Bruno Costa", "email": "[email protected]" }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "convivo-mock-api",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"description": "Mock Pretix + Sessionize API server for testing the Convivo sync interfaces (Phase 7 + 8).",
|
||||
"scripts": {
|
||||
"start": "node server.js"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
// Convivo — Mock Pretix + Sessionize API server (Phase 7 + 8).
|
||||
//
|
||||
// A tiny, dependency-free Node HTTP server that serves the SAME response shapes
|
||||
// as the real Pretix and Sessionize APIs, so the `sync-trigger` Edge Function
|
||||
// can be tested end-to-end WITHOUT real credentials. Point the Edge Function at
|
||||
// this server (PRETIX_BASE_URL / SESSIONIZE_BASE_URL) to run a full sync.
|
||||
//
|
||||
// Endpoints:
|
||||
// GET /health → { ok: true }
|
||||
// GET /pretix/attendees → Pretix order-positions shape (fixtures/pretix.json)
|
||||
// GET /sessionize/sessions → Sessionize sessions shape (fixtures/sessionize.json)
|
||||
//
|
||||
// Run locally: node server.js (listens on :54330)
|
||||
// In Docker: the `mock-api` service in docker-compose.yml.
|
||||
|
||||
import http from 'node:http';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { dirname, join } from 'node:path';
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const PORT = Number(process.env.PORT || 54330);
|
||||
|
||||
const ROUTES = {
|
||||
'/pretix/attendees': join(__dirname, 'fixtures', 'pretix.json'),
|
||||
'/sessionize/sessions': join(__dirname, 'fixtures', 'sessionize.json'),
|
||||
};
|
||||
|
||||
const server = http.createServer(async (req, res) => {
|
||||
const url = new URL(req.url, `http://${req.headers.host}`);
|
||||
const path = url.pathname.replace(/\/+$/, '') || '/';
|
||||
|
||||
const send = (status, body, type = 'application/json') => {
|
||||
res.writeHead(status, { 'Content-Type': type, 'Access-Control-Allow-Origin': '*' });
|
||||
res.end(body);
|
||||
};
|
||||
|
||||
if (req.method === 'OPTIONS') {
|
||||
res.writeHead(204, {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Headers': 'Authorization, Content-Type',
|
||||
'Access-Control-Allow-Methods': 'GET, OPTIONS',
|
||||
});
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
|
||||
if (path === '/health') {
|
||||
send(200, JSON.stringify({ ok: true, service: 'convivo-mock-api' }));
|
||||
return;
|
||||
}
|
||||
|
||||
const file = ROUTES[path];
|
||||
if (!file) {
|
||||
send(404, JSON.stringify({ error: 'not found', path }));
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const raw = await readFile(file, 'utf8');
|
||||
send(200, raw);
|
||||
} catch (err) {
|
||||
send(500, JSON.stringify({ error: String(err) }));
|
||||
}
|
||||
});
|
||||
|
||||
server.listen(PORT, () => {
|
||||
console.log(`[mock-api] listening on :${PORT}`);
|
||||
console.log(`[mock-api] GET /pretix/attendees`);
|
||||
console.log(`[mock-api] GET /sessionize/sessions`);
|
||||
});
|
||||
Reference in new issue
Block a user