feat: add sidecar service for Sessionize sync
- Introduced a new Node HTTP service (sidecar) to sync event agendas from Sessionize into Convivo. - Implemented two import paths: API sync and Excel import for session and speaker data. - Added necessary database migrations for sessionize integration, including new columns and audit tables. - Created functions for handling speaker and session imports, ensuring proper error handling and logging. - Established row-level security and grants for new functions to restrict access to service-role only.
This commit is contained in:
1 parent
8054d0ace2
commit
f7aea663d8
31 files changed
+2729
-390
No files matched your search
+30
-8
@@ -28,6 +28,9 @@ flowchart LR
|
||||
subgraph AdminC["convivo-admin container (:3001)"]
|
||||
NA["nginx<br/>serves SPA + proxies Supabase paths"]
|
||||
end
|
||||
subgraph SideC["convivo-sidecar container (:3002)"]
|
||||
SC["node<br/>Sessionize sync (on demand)"]
|
||||
end
|
||||
subgraph Core["Supabase core (Supabase CLI)"]
|
||||
K["Kong API gateway<br/>:54321"]
|
||||
K --> G["GoTrue (Auth)"]
|
||||
@@ -42,10 +45,16 @@ flowchart LR
|
||||
|
||||
A -->|"same-origin /auth /rest /realtime /storage /functions"| N
|
||||
AD -->|"same-origin /auth /rest /realtime /storage /functions"| NA
|
||||
AD -->|"same-origin /sidecar/*"| SC
|
||||
N -->|"proxy (supabase_kong_Convivo:8000)"| K
|
||||
NA -->|"proxy (supabase_kong_Convivo:8000)"| K
|
||||
SC -->|"service-role key"| K
|
||||
```
|
||||
|
||||
The **sidecar** (`:3002`) is the one server-side component that holds the
|
||||
service-role key. It is driven by the admin's **Interfaces** menu and runs on
|
||||
demand only — see [backend/sidecar.md](./backend/sidecar.md).
|
||||
|
||||
**Key idea:** there is **no custom backend**. Supabase provides auth, data,
|
||||
business logic (as Postgres RPCs), and realtime. The app is a thin client that
|
||||
talks to Supabase through **same-origin paths**, so there is no CORS to manage.
|
||||
@@ -70,8 +79,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)
|
||||
- **Data** — seed with 1 event, 6 slots, 18 sessions, 14 contacts, 13
|
||||
registrations, 3 sponsors. → [backend/seed.md](./backend/seed.md)
|
||||
- **Data** — seed with 1 real event (Power Platform Bootcamp AT): 10 slots, 22
|
||||
sessions, 54 contacts (50 attendees + 4 staff). Speakers are added via the
|
||||
Excel import, not the seed. → [backend/seed.md](./backend/seed.md)
|
||||
|
||||
### Frontend — the attendee PWA
|
||||
A single-page React app with a tab shell and a few full-screen takeovers. See
|
||||
@@ -136,7 +146,9 @@ the work atomically, and the `leaderboard` table change fans out over Realtime.
|
||||
**24 hours** (`jwt_expiry = 86400`). Every request sends the **anon key**
|
||||
(public) + the **session JWT** (identity).
|
||||
- The **service-role key is never in the app** — it bypasses RLS and stays
|
||||
server-side. See [backend/rls.md](./backend/rls.md) for what each role can do.
|
||||
server-side. The **sidecar** is its first consumer (the Sessionize sync).
|
||||
See [backend/rls.md](./backend/rls.md) for what each role can do and
|
||||
[backend/sidecar.md](./backend/sidecar.md) for the sidecar.
|
||||
|
||||
## 7. Environment & ports
|
||||
|
||||
@@ -144,6 +156,7 @@ the work atomically, and the `leaderboard` table change fans out over Realtime.
|
||||
|---|---|---|
|
||||
| **Convivo app** | **3000** | Vite dev server (dev) or nginx (Docker) |
|
||||
| **Convivo admin** | **3001** | Vite dev server (dev) or nginx (Docker) |
|
||||
| **Sync sidecar** | **3002** | Node service (Docker) or `npm run sidecar:dev` (dev) |
|
||||
| Supabase API (Kong) | 54321 | The single gateway the apps proxy to |
|
||||
| Supabase Studio | 54323 | UI — login `postgres` / `postgres` |
|
||||
| Postgres | 54322 | Direct DB access (`postgres` / `postgres`) |
|
||||
@@ -155,8 +168,9 @@ npm run db:start # start the Supabase core (Docker)
|
||||
npm run db:reset # (re)apply migrations + seed
|
||||
npm run app:dev # attendee dev server on :3000
|
||||
npm run admin:dev # admin dev server on :3001
|
||||
npm run sidecar:dev # Sessionize sync sidecar on :3002
|
||||
# — or —
|
||||
docker compose up --build # both apps as Docker sidecars (:3000 + :3001)
|
||||
docker compose up --build # apps + sidecar as Docker sidecars (:3000 + :3001 + :3002)
|
||||
```
|
||||
|
||||
## 8. The demo clock
|
||||
@@ -176,8 +190,11 @@ Convivo/
|
||||
│ └─ src/ # screens, components, lib, context
|
||||
├─ apps/admin/ # Admin console (React + Vite + TS, desktop-first)
|
||||
│ ├─ Dockerfile # Multi-stage: build → nginx
|
||||
│ ├─ nginx.conf.template # SPA + same-origin proxy to the Supabase core
|
||||
│ ├─ nginx.conf.template # SPA + same-origin proxy to the Supabase core + /sidecar
|
||||
│ └─ src/ # views, components, lib, context
|
||||
├─ apps/sidecar/ # Sessionize sync sidecar (Node, on demand)
|
||||
│ ├─ Dockerfile # node:20-alpine + xlsx (parses the Excel export)
|
||||
│ └─ src/server.js # /health, /status, /run, /import-excel (blocking)
|
||||
├─ supabase/
|
||||
│ ├─ config.toml # Local stack config (ports, auth, RLS defaults)
|
||||
│ ├─ migrations/
|
||||
@@ -186,9 +203,14 @@ Convivo/
|
||||
│ │ ├─ 20260824000000_redesign.sql # multi-event model, RPCs, RLS, materials
|
||||
│ │ ├─ 20260825000000_interfaces.sql # external_id (sync objects later dropped)
|
||||
│ │ ├─ 20260826000000_registration_qr_token.sql # QR token on registration
|
||||
│ │ └─ 20260830000000_remove_interfaces.sql # ← drops the sync RPCs + sync_runs
|
||||
│ └─ seed.sql # 1 event, 6 slots, 18 sessions, 14 contacts, demo state
|
||||
├─ docker-compose.yml # Runs both app sidecars on the Supabase network
|
||||
│ │ ├─ 20260827000000_admin_password_profile.sql # staff password + self-service profile
|
||||
│ │ ├─ 20260828000000_staff_exclusions_password_sync.sql # staff leaderboard exclusion + password sync
|
||||
│ │ ├─ 20260829000000_registration_type_optionset_speaker_promote_welcome_checkin.sql
|
||||
│ │ ├─ 20260830000000_remove_interfaces.sql # ← drops the sync RPCs + sync_runs
|
||||
│ │ ├─ 20260831000000_sessionize_sidecar.sql # sessionize_endpoint + sync_runs + sync RPC
|
||||
│ │ └─ 20260832000000_slots_enum_excel_import.sql # slot_type enum + slots.id default + Excel RPC
|
||||
│ └─ seed.sql # 1 real event, 10 slots, 22 sessions, 54 contacts (50 attendees + 4 staff)
|
||||
├─ docker-compose.yml # Runs the app sidecars + sync sidecar on the Supabase network
|
||||
├─ docs/ # ← this documentation
|
||||
└─ mockup/index.html # Original interactive mockup (design reference)
|
||||
```
|
||||
@@ -12,6 +12,7 @@ Postgres. This folder documents that core.
|
||||
| [rls.md](./rls.md) | Row Level Security policies + which key the app uses |
|
||||
| [seed.md](./seed.md) | Seed data + the demo accounts |
|
||||
| [docker.md](./docker.md) | Docker: the app image + root compose (how the core + app run together) |
|
||||
| [sidecar.md](./sidecar.md) | The Sessionize sync sidecar (on-demand, service-role) |
|
||||
|
||||
## The big picture
|
||||
|
||||
|
||||
+22
-7
@@ -4,10 +4,13 @@ Docker is the backbone. Two pieces:
|
||||
|
||||
1. **The Supabase core** — a set of containers managed by the **Supabase CLI**
|
||||
(not by a compose file in this repo). See [supabase-core.md](./supabase-core.md).
|
||||
2. **The app sidecars** — two containers, the attendee app
|
||||
([`apps/convivo/Dockerfile`](../../apps/convivo/Dockerfile), `:3000`) and the
|
||||
2. **The app sidecars** — the attendee app
|
||||
([`apps/convivo/Dockerfile`](../../apps/convivo/Dockerfile), `:3000`), the
|
||||
admin console ([`apps/admin/Dockerfile`](../../apps/admin/Dockerfile), `:3001`),
|
||||
and the **Sessionize sync sidecar**
|
||||
([`apps/sidecar/Dockerfile`](../../apps/sidecar/Dockerfile), `:3002`),
|
||||
orchestrated by the root [`docker-compose.yml`](../../docker-compose.yml).
|
||||
The sidecar is documented in [sidecar.md](./sidecar.md).
|
||||
|
||||
Each app container **joins the network the CLI created** for the core and proxies
|
||||
the Supabase same-origin paths to the Kong container. Both use the identical
|
||||
@@ -24,10 +27,13 @@ flowchart LR
|
||||
K["supabase_kong_Convivo<br/>:8000 (internal)"]
|
||||
APP["convivo-app<br/>nginx :3000"]
|
||||
ADM["convivo-admin<br/>nginx :3001"]
|
||||
SC["convivo-sidecar<br/>node :3002"]
|
||||
end
|
||||
CLI -.creates.-> Net
|
||||
APP -->|"proxy /auth /rest /realtime /storage"| K
|
||||
ADM -->|"proxy /auth /rest /realtime /storage"| K
|
||||
ADM -->|"proxy /sidecar/*"| SC
|
||||
SC -->|"service-role key"| K
|
||||
APP -->|"host port 3000"| U["Browser"]
|
||||
ADM -->|"host port 3001"| U
|
||||
```
|
||||
@@ -67,9 +73,10 @@ same-origin paths to the core:
|
||||
|
||||
## Root `docker-compose.yml`
|
||||
|
||||
Runs **only the apps** (the core is CLI-managed). There are two services —
|
||||
`convivo-app` (`:3000`) and `convivo-admin` (`:3001`) — with identical settings
|
||||
except the build context and port:
|
||||
Runs **only the apps** (the core is CLI-managed). There are three services —
|
||||
`convivo-app` (`:3000`), `convivo-admin` (`:3001`), and `convivo-sidecar`
|
||||
(`:3002`). The two nginx apps have identical settings except the build context
|
||||
and port:
|
||||
|
||||
| Setting | `convivo-app` | `convivo-admin` | Why |
|
||||
|---|---|---|---|
|
||||
@@ -79,6 +86,12 @@ except the build context and port:
|
||||
| `networks.supabase` | **external**, name `supabase_network_Convivo` | same | Joins the CLI-created network |
|
||||
| `healthcheck` | `wget http://127.0.0.1:3000/` | `wget http://127.0.0.1:3001/` | Container reports healthy |
|
||||
|
||||
The **`convivo-sidecar`** service is different: it builds
|
||||
[`apps/sidecar`](../../apps/sidecar) (a plain Node service, no nginx), exposes
|
||||
`:3002`, and carries the sidecar env vars (`SUPABASE_URL`,
|
||||
`SUPABASE_SERVICE_ROLE_KEY`, `SESSIONIZE_API_KEY`). It is the first server-side
|
||||
holder of the service-role key. See [sidecar.md](./sidecar.md).
|
||||
|
||||
> If you change `project_id` in `supabase/config.toml`, update the external
|
||||
> network name (`supabase_network_<project_id>`) and the default proxy target
|
||||
> (`supabase_kong_<project_id>:8000`) to match.
|
||||
@@ -92,7 +105,7 @@ npm run db:start
|
||||
# 2. (Optional) reset to clean seed data
|
||||
npm run db:reset
|
||||
|
||||
# 3. Build + run both app sidecars (:3000 + :3001)
|
||||
# 3. Build + run the app sidecars (:3000 + :3001) and the sync sidecar (:3002)
|
||||
docker compose up --build
|
||||
```
|
||||
|
||||
@@ -101,12 +114,14 @@ Open **http://localhost:3000** (attendee) and **http://localhost:3001** (admin).
|
||||
### Alternative: dev server (no app container)
|
||||
|
||||
For faster iteration you can skip the app containers and use the Vite dev
|
||||
servers, which proxy the same paths to `127.0.0.1:54321` (host port):
|
||||
servers, which proxy the same paths to `127.0.0.1:54321` (host port). The admin
|
||||
dev server also proxies `/sidecar` to `127.0.0.1:3002`, so start the sidecar too:
|
||||
|
||||
```bash
|
||||
npm run db:start
|
||||
npm run app:dev # attendee Vite on :3000
|
||||
npm run admin:dev # admin Vite on :3001
|
||||
npm run sidecar:dev # sync sidecar on :3002
|
||||
```
|
||||
|
||||
## Verified behavior
|
||||
|
||||
@@ -202,6 +202,54 @@ profile from the Convivo app: the LinkedIn URL and the two visibility toggles
|
||||
touch `is_admin`, `password`, `external_id`, etc.
|
||||
- Returns the updated contact row.
|
||||
|
||||
### `sync_sessionize_event(p_event_id, p_payload)` → `jsonb`
|
||||
**Service-role only** (the Sessionize sync sidecar — see [sidecar.md](./sidecar.md)).
|
||||
Imports an event's Sessionize data in order: (1) speakers → contacts (matched by
|
||||
email), (2) sessions (upserted by `external_id`), (3) the agenda (slots
|
||||
find-or-created by date/start/end + `session_speakers` links). `p_payload` is
|
||||
`{ speakers: [{email, full_name, external_id?}], sessions: [{external_id, title,
|
||||
description?, room?, date, start_time, end_time, speakers: [email,...]}] }`.
|
||||
- Guarded to the `service_role` caller (JWT role claim); granted to `service_role`
|
||||
only — the apps cannot call it.
|
||||
- **Idempotent:** re-running updates in place (contacts by email, sessions by
|
||||
`external_id`, slots by date/start/end). Speaker links are **diffed** (insert the
|
||||
new set, then delete only removed) so the `session_needs_speaker` trigger never
|
||||
blocks a removal.
|
||||
- Linking a speaker fires `session_speakers_speaker_promote`, which promotes an
|
||||
existing registration to `speaker`. **No registrations are created** — the ticket
|
||||
sync does that (checking `session_speakers` by email).
|
||||
- Per-item failures are collected into `errors[]` (the run does not abort). Returns
|
||||
a JSONB summary (`speakers_created/updated`, `sessions_created/updated`,
|
||||
`slots_created`, `speakers_linked`, `errors`) and stamps `events.last_synced_at`.
|
||||
- Writes a `sync_runs` audit row (see [schema.md](./schema.md)).
|
||||
|
||||
### `sync_sessionize_excel(p_event_id, p_payload)` → `jsonb`
|
||||
**Service-role only** (the Sessionize sync sidecar's **Excel import** path — see
|
||||
[sidecar.md](./sidecar.md)). Imports the Sessionize **"Sessions and speakers
|
||||
(advanced)"** `.xlsx` export (parsed by the sidecar, which carries the speaker
|
||||
**emails** the public API lacks). Same shape as `sync_sessionize_event` plus
|
||||
`is_service_session` per session and `linkedin_url` per speaker, and it runs one
|
||||
extra step:
|
||||
|
||||
1. **Speakers → contacts** (matched by email; also sets `linkedin_url`).
|
||||
2. **Sessions + agenda** — slots are typed from `is_service_session`
|
||||
(`service_session` for breaks/lunch/closing, else `session`), sessions
|
||||
upserted by `external_id`, speaker links diffed.
|
||||
3. **Speaker registrations** — for every speaker, creates a `speaker`
|
||||
registration or updates an existing `attendee` one to `speaker`
|
||||
(`on conflict (event_id, contact_email)`). **Never overrides `staff` /
|
||||
`sponsor`** tickets. This is the "add the missing registrations for the
|
||||
speakers" step the API sync deliberately leaves to the ticket sync.
|
||||
|
||||
- Guarded to the `service_role` caller; granted to `service_role` only.
|
||||
- **Idempotent:** re-running updates in place (contacts by email, sessions by
|
||||
`external_id`, slots by date/start/end, registrations by event+contact).
|
||||
- Per-item failures are collected into `errors[]`. Returns a JSONB summary
|
||||
(`speakers_created/updated`, `sessions_created/updated`, `slots_created`,
|
||||
`speakers_linked`, `registrations_created/updated`, `errors`) and stamps
|
||||
`events.last_synced_at`.
|
||||
- Writes a `sync_runs` audit row with `source = 'sessionize_excel'`.
|
||||
|
||||
## Role helper functions
|
||||
|
||||
| Function | Returns | Meaning |
|
||||
|
||||
+32
-4
@@ -77,6 +77,8 @@ queries everything for the active event and handles "no active event" gracefully
|
||||
| `num_speakers` | `integer` | maintained aggregate |
|
||||
| `num_registrations` | `integer` | maintained aggregate |
|
||||
| `num_checked_in_registrations` | `integer` | maintained aggregate |
|
||||
| `sessionize_endpoint` | `text` | nullable — the Sessionize API URL for this event (see [sidecar.md](./sidecar.md)) |
|
||||
| `last_synced_at` | `timestamptz` | nullable — when the Sessionize sync last ran |
|
||||
| `created_at` | `timestamptz` | |
|
||||
|
||||
**Constraint:** `unique index events_one_active on (is_active) where is_active`
|
||||
@@ -132,13 +134,20 @@ Unpaid sponsors are hidden from non-admins (RLS).
|
||||
|
||||
| Column | Type | Notes |
|
||||
|---|---|---|
|
||||
| `id` | `integer` PK | 1–6 |
|
||||
| `id` | `integer` PK | `nextval('slots_id_seq')` default — the UI/sidecar can create a slot **without** supplying an id (the seed inserts explicit ids and re-syncs the sequence) |
|
||||
| `event_id` | `uuid` FK → `events` | `on delete cascade` |
|
||||
| `type` | `text` | `session` \| `lunch_break` \| `coffee_break` \| `keynote` \| `close_up` (default `session`) |
|
||||
| `name` | `text` | e.g. "Slot 1" |
|
||||
| `slot_date` | `date` | `2026-10-23` |
|
||||
| `type` | `slot_type` (enum) | **`session` \| `service_session`** (default `session`) — a true optionset, not freetext. `service_session` = breaks / lunch / closing (Sessionize's `isServiceSession`) |
|
||||
| `name` | `text` | e.g. "Slot 09:00–09:45" / "Service Session" |
|
||||
| `slot_date` | `date` | |
|
||||
| `start_time` / `end_time` | `time` | |
|
||||
|
||||
> **`type` is a Postgres ENUM** (`public.slot_type`, added by
|
||||
> [`20260832000000_slots_enum_excel_import.sql`](../../supabase/migrations/20260832000000_slots_enum_excel_import.sql)).
|
||||
> The old freetext values (`keynote` / `lunch_break` / `coffee_break` /
|
||||
> `close_up`) were all folded into `service_session` — they are all non-talk
|
||||
> agenda items. The admin Schedule view shows the two values as **Session** /
|
||||
> **Service Session**.
|
||||
|
||||
## `sessions` — one per (slot, room)
|
||||
|
||||
| Column | Type | Notes |
|
||||
@@ -272,6 +281,25 @@ Powers the per-category points breakdown on the Profile screen (per event).
|
||||
|
||||
Index: `points_log_event_id_idx (event_id)`.
|
||||
|
||||
## `sync_runs` — Sessionize sync audit trail
|
||||
|
||||
Event-scoped record of every sidecar sync run (the data behind the admin
|
||||
Interfaces view's "recent runs").
|
||||
|
||||
| Column | Type | Notes |
|
||||
|---|---|---|
|
||||
| `id` | `uuid` PK | `gen_random_uuid()` |
|
||||
| `event_id` | `uuid` FK → `events` | `on delete cascade` |
|
||||
| `source` | `text` | `sessionize` (API sync) \| `sessionize_excel` (Excel import) |
|
||||
| `started_at` / `finished_at` | `timestamptz` | `finished_at` nullable |
|
||||
| `created` / `updated` / `skipped` | `integer` | counts from the run |
|
||||
| `error` | `text` | nullable — error text if the run failed |
|
||||
| `triggered_by` | `text` | default `service_role` |
|
||||
|
||||
**RLS:** enabled; `SELECT` for `authenticated` restricted to admins
|
||||
(`sync_runs_select_admin`). Written only by the `sync_sessionize_event` /
|
||||
`sync_sessionize_excel` RPCs.
|
||||
|
||||
## Other indexes
|
||||
|
||||
- `slots_event_id_idx (event_id)`, `registrations_event_id_idx (event_id)`,
|
||||
|
||||
+72
-98
@@ -1,23 +1,37 @@
|
||||
# Seed Data & Demo Accounts
|
||||
|
||||
Source of truth: [`supabase/seed.sql`](../../supabase/seed.sql). The seed runs on
|
||||
`npm run db:reset` and is **idempotent** (`on conflict ... do nothing`).
|
||||
`npm run db:reset` and is **idempotent** (`on conflict ... do nothing` /
|
||||
`do update`).
|
||||
|
||||
The seed uses **real data** from a past event — the **Global Power Platform
|
||||
Bootcamp (Austria)** — instead of random demo data:
|
||||
|
||||
- The **agenda** (slots + sessions) comes from the event's Sessionize public API
|
||||
(`…/api/v2/4domszaq/view/All`): 22 sessions on 2026-02-20 (18 talks + 4 service
|
||||
sessions: coffee break, lunch, a partner session, and the closing).
|
||||
- The **speakers** are **not** seeded — they are imported from the Sessionize
|
||||
**"Sessions and speakers (advanced)"** `.xlsx` via the admin **Interfaces →
|
||||
Import Excel** control (see [sidecar.md](./sidecar.md)). That import creates the
|
||||
speaker contacts, links them to sessions, and creates their `speaker`
|
||||
registrations (matched by email).
|
||||
|
||||
## What it creates
|
||||
|
||||
| Data | Count | Notes |
|
||||
|---|---|---|
|
||||
| `auth.users` + `auth.identities` | 13 | 12 attendees + 1 admin; **QR token = bcrypt password** (attendees/staff) — the admin uses a real **password** instead |
|
||||
| `contacts` | 14 | 13 registrants + 1 external keynote speaker (no token — tokens live on registrations) |
|
||||
| `events` | 1 | **APPE 2026**, 2026-10-23, São Paulo, Brazil, **active** |
|
||||
| `registrations` | 13 | one per contact (Elena has none); points + **QR token** scoped here |
|
||||
| `sponsors` | 3 | Nubank (headline, paid), Acme Corp (gold, paid), Globant (community, unpaid) |
|
||||
| `slots` | 6 | 23 Oct, 09:00–15:45 (see table below) |
|
||||
| `sessions` | 18 | 3 per slot (Main Stage / Room A / Room B) |
|
||||
| `session_speakers` | 22 | M:N session → contact |
|
||||
| `leaderboard` | 10 | mirrored from `registrations`, **staff excluded** (13 registrants − 3 staff) |
|
||||
| `points_log` | 16 | Ana's coherent breakdown + one `admin` entry per other user |
|
||||
| Ana's demo state | — | 6 preferences, 2 check-ins, 4 connections, 1 feedback |
|
||||
| `auth.users` + `auth.identities` | 54 | 50 attendees + 4 staff; **QR token = bcrypt password** (attendees), **`appe-admin-2026`** (staff) |
|
||||
| `contacts` | 54 | 50 attendees + 4 staff (`is_admin = true`, `password = 'appe-admin-2026'`) |
|
||||
| `events` | 1 | **Global Power Platform Bootcamp \| Austrian Power Platform Enthusiasts Edition**, 2026-02-20, Vienna, Austria, **active**, `sessionize_endpoint` set to `https://sessionize.com/api/v2/4domszaq/view/All` |
|
||||
| `registrations` | 54 | 50 `attendee` + 4 `staff`; each with a `CVV-XXX-NNNN` QR token |
|
||||
| `slots` | 10 | 2026-02-20, 09:15–17:00 (7 `session` + 3 `service_session`) |
|
||||
| `sessions` | 22 | real titles/descriptions/rooms from the Sessionize API |
|
||||
| `session_speakers` | 0 | **added by the Excel import** (not seeded) |
|
||||
| `sponsors` | 0 | none for this event |
|
||||
|
||||
> **Speaker contacts are intentionally absent.** After `db:reset`, run the Excel
|
||||
> import (Interfaces → Import Excel → choose the `.xlsx` → Import) to add the 21
|
||||
> speakers: their contacts, session links, and `speaker` registrations.
|
||||
|
||||
> **GoTrue gotcha:** manually-inserted `auth.users` must have
|
||||
> `confirmation_token`, `recovery_token`, `email_change_token_new`, and
|
||||
@@ -25,101 +39,61 @@ Source of truth: [`supabase/seed.sql`](../../supabase/seed.sql). The seed runs o
|
||||
> grant can't scan a NULL `confirmation_token`. `phone` is left NULL (unique
|
||||
> constraint).
|
||||
|
||||
> **Staff = admin (merged).** Bruno, Rita, and the APPE Admin have
|
||||
> `is_admin = true` on their `contacts` row. Their registration `type` is
|
||||
> `staff` (the ticket type shown on the lanyard).
|
||||
> **Staff = admin (merged).** The four staff have `is_admin = true` on their
|
||||
> `contacts` row (so they can open the APPE Admin console **and** generate the
|
||||
> Sessionize export) and their registration `type` is `staff`.
|
||||
|
||||
## Slots
|
||||
## Slots (2026-02-20)
|
||||
|
||||
| id | Type | Time |
|
||||
|---|---|---|
|
||||
| 1 | keynote | 09:00–09:45 |
|
||||
| 2 | session | 10:00–10:45 |
|
||||
| 3 | session | 11:30–12:15 |
|
||||
| 4 | lunch_break | 13:15–14:00 |
|
||||
| 5 | session | 14:00–14:45 |
|
||||
| 6 | close_up | 15:00–15:45 |
|
||||
| Type | Time |
|
||||
|---|---|
|
||||
| session | 09:15–10:00 (keynote) |
|
||||
| service_session | 10:00–10:30 (coffee break) |
|
||||
| session | 10:30–11:15 |
|
||||
| session | 11:15–12:00 |
|
||||
| service_session | 12:00–13:00 (lunch) |
|
||||
| session | 13:00–13:45 |
|
||||
| session | 13:45–14:30 |
|
||||
| session | 14:30–15:15 |
|
||||
| session | 15:15–16:00 |
|
||||
| service_session | 16:00–17:00 (partner session + closing) |
|
||||
|
||||
> `type` is the `slot_type` **enum** (`session` / `service_session`) — see
|
||||
> [schema.md](./schema.md#slots--schedule-blocks).
|
||||
|
||||
## Demo accounts
|
||||
|
||||
**Attendees** log in with **QR code** (typed or scanned) + **email** — the QR
|
||||
token is the Auth password. **Staff** log in with **QR code + their staff
|
||||
password** (the Convivo app shows a password field when a staff QR is detected;
|
||||
the email comes from the resolved contact). The **APPE Admin** (and any staff
|
||||
member you give one) can also log in with **email + password** in the admin app
|
||||
(event-independent, so it works for any event). The password lives in
|
||||
`contacts.password`; a trigger (`trg_contact_password_sync`) **auto-syncs** it as
|
||||
the bcrypt hash in `auth.users.encrypted_password`, so just set
|
||||
`contacts.password` in Supabase and it works with `signInWithPassword`
|
||||
immediately.
|
||||
password** in the Convivo app, or **email + password** in the admin app. All four
|
||||
staff share the password **`appe-admin-2026`** (stored in `contacts.password`,
|
||||
auto-synced to `auth.users.encrypted_password` by the `trg_contact_password_sync`
|
||||
trigger).
|
||||
|
||||
| Person | Type | Login | Email | Start pts |
|
||||
|---|---|---|---|---|
|
||||
| **Ana Silva** | speaker | QR `CVV-ANA-4821` | ana.silva@nubank.com | 40 |
|
||||
| **Bruno Costa** | staff (admin) | QR `CVV-BRU-1177` + **password** `appe-admin-2026` | bruno.costa@acme.com | 140 |
|
||||
| **Rita Lopes** | staff (admin) | QR `CVV-RIT-9034` + **password** `appe-admin-2026` | rita.lopes@globant.com | 95 |
|
||||
| **APPE Admin** | staff (admin) | **password** `appe-admin-2026` | admin@appe.at | 0 |
|
||||
| Tomás Ribeiro | speaker | `CVV-TOM-5566` | tomas.ribeiro@dataprev.com | 88 |
|
||||
| Sofia Almeida | speaker | `CVV-SOF-2299` | sofia.almeida@loop.com | 76 |
|
||||
| Marco Chen | speaker | `CVV-MRC-7712` | marco.chen@deepmind.com | 70 |
|
||||
| Julia Santos | speaker | `CVV-JUL-3345` | julia.santos@ifood.com | 64 |
|
||||
| Pedro Nunes | speaker | `CVV-PED-8801` | pedro.nunes@microsoft.com | 58 |
|
||||
| Carla Mendes | speaker | `CVV-CAR-6623` | carla.mendes@quintoessencial.com | 52 |
|
||||
| Diego Ferreira | speaker | `CVV-DIE-4458` | diego.ferreira@stone.com | 35 |
|
||||
| Marina Costa | speaker | `CVV-MNA-2210` | marina.costa@olx.com | 28 |
|
||||
| Lucas Oliveira | speaker | `CVV-LUC-9987` | lucas.oliveira@usp.br | 15 |
|
||||
| Dr. Elena Vasquez | (external speaker) | — | elena.vasquez@keynote.com | — |
|
||||
| Person | Type | Email | Login |
|
||||
|---|---|---|---|
|
||||
| **Amelia Hernandez** | staff (admin) | amelia@appe.at | `appe-admin-2026` |
|
||||
| **Sabrina Hota** | staff (admin) | sabrina@appe.at | `appe-admin-2026` |
|
||||
| **Jose Lago** | staff (admin) | jose@appe.at | `appe-admin-2026` |
|
||||
| **Markus Franz** | staff (admin) | markus@appe.at | `appe-admin-2026` |
|
||||
| 50 attendees | attendee | (made-up, e.g. lena.huber@gmail.com) | QR `CVV-ATT-1000`…`CVV-ATT-1049` |
|
||||
|
||||
> **Speaker auto-promote:** every seeded attendee who speaks in a session is
|
||||
> typed `speaker` (the `session_speakers_speaker_promote` trigger promotes
|
||||
> `attendee` → `speaker` on insert, so the seed states the final type). Only
|
||||
> Bruno, Rita, and the APPE Admin are `staff` (the trigger never overrides an
|
||||
> explicit staff/sponsor ticket).
|
||||
>
|
||||
> **Staff passwords:** Bruno and Rita have `contacts.password = 'appe-admin-2026'`
|
||||
> so the Convivo **staff QR login** (QR + staff password) works out of the box.
|
||||
|
||||
> **Dr. Elena Vasquez** is an external keynote speaker: she has a `contacts` row
|
||||
> (and speaks in `session_speakers`) but **no registration, no QR token, and no
|
||||
> auth user**, so she can't log in — she only appears as a speaker on the agenda.
|
||||
|
||||
## Ana's demo state (so the app looks alive on first login)
|
||||
|
||||
Ana (`[email protected]`) is seeded with a coherent 40-point history:
|
||||
|
||||
- **Points breakdown** (`points_log`): 2× check-in (+10 each), 2× connection
|
||||
(+5 each), 1× feedback (+10) = **40**.
|
||||
- **Preferences** — one pick per slot (matches the mockup):
|
||||
- Slot 1 → *Designing for Trust in AI Products*
|
||||
- Slot 2 → *AI in Practice: Lessons from Production*
|
||||
- Slot 3 → *Data Storytelling*
|
||||
- Slot 4 → *Prototyping with AI*
|
||||
- Slot 5 → *Community-Led Growth*
|
||||
- Slot 6 → *Closing Panel: What's Next*
|
||||
- **Check-ins** — checked into Slot 1 and Slot 2 (by staff Bruno).
|
||||
- **Connections**:
|
||||
- accepted with **Bruno** and **Rita**
|
||||
- incoming (pending) from **Sofia**
|
||||
- outgoing (pending) to **Julia**
|
||||
- **Feedback** — rated Slot 1's *Designing for Trust in AI Products* 5★ with a
|
||||
comment.
|
||||
- **Speaker** — Ana is a speaker of Slot 6's *Open Space: Your Ideas* (so the
|
||||
Agenda shows a "🎤 you" tag and the material-upload notice).
|
||||
|
||||
> Everyone else gets a single `admin` `points_log` entry for their starting points
|
||||
> (so the Profile breakdown shows "Other"), and no other activity.
|
||||
> **Speaker auto-promote:** the Excel import creates the speakers' registrations
|
||||
> as `speaker` directly (and the `session_speakers_speaker_promote` trigger
|
||||
> promotes any `attendee` that gets linked). The seed itself contains **no
|
||||
> speakers** — only the 50 attendees and 4 staff.
|
||||
|
||||
## Suggested demo flow
|
||||
|
||||
1. Log in as **Ana** (attendee) → Home, Agenda, Leaderboard all populated.
|
||||
2. Scan **Marco** (`CVV-MRC-7712`) → send a connection request.
|
||||
3. Log in as **Bruno** (staff) → QR `CVV-BRU-1177` + staff password
|
||||
`appe-admin-2026` → the Scan tab becomes **Check-in** → pick a session → scan
|
||||
**Carla** (`CVV-CAR-6623`) → she gets +10. Flip the **check-in type toggle**
|
||||
to **Welcome check-in** and scan **Tomás** (`CVV-TOM-5566`) → he's marked
|
||||
present at the event (no points).
|
||||
4. Watch the **Leaderboard** update live (Realtime).
|
||||
5. Log in as **APPE Admin** (`[email protected]` / password `appe-admin-2026`) in the
|
||||
admin app → Dashboard, Contacts, Registrations, Sponsors, Schedule, Activity,
|
||||
Events. (Staff Bruno/Rita can also open the admin app with their email + QR
|
||||
token, since that is their Auth password.)
|
||||
1. Log in as **Amelia** (staff/admin) in the admin app (`[email protected]` /
|
||||
`appe-admin-2026`) → Dashboard shows the real event (54 registrations, 22
|
||||
sessions).
|
||||
2. **Interfaces → Import Excel** → choose the "Sessions and speakers
|
||||
(advanced)" `.xlsx` → **Import** → the result modal shows the speakers
|
||||
created, sessions updated, speaker links, and speaker registrations created.
|
||||
3. **Schedule** → slots now show **Session** / **Service Session** types and the
|
||||
sessions list their speakers.
|
||||
4. **Events** → the event's **Sessionize endpoint** is set; the **Sync** button
|
||||
runs the (keyless) API sync.
|
||||
5. Log in as an **attendee** in the Convivo app (QR `CVV-ATT-1000` +
|
||||
`[email protected]`) → Home/Agenda show the real agenda.
|
||||
@@ -0,0 +1,128 @@
|
||||
# Sidecar — Sessionize sync
|
||||
|
||||
The **sidecar** is a small Node HTTP service that syncs an event's agenda from
|
||||
[Sessionize](https://sessionize.com) into Convivo. It is the only server-side
|
||||
component that holds the **service-role key**, and it is driven entirely by the
|
||||
APPE Admin **Interfaces** menu — it runs **on demand only** (no scheduling).
|
||||
|
||||
- Code: [`apps/sidecar/`](../../apps/sidecar/) (single file:
|
||||
[`src/server.js`](../../apps/sidecar/src/server.js))
|
||||
- Image: [`apps/sidecar/Dockerfile`](../../apps/sidecar/Dockerfile)
|
||||
(`node:20-alpine`; one runtime dependency, **`xlsx`**, to parse the Sessionize
|
||||
Excel export — everything else is built-in `http` + `fetch`)
|
||||
- Compose service: `convivo-sidecar` in the root
|
||||
[`docker-compose.yml`](../../docker-compose.yml) (`:3002`)
|
||||
- DB side: the `sync_sessionize_event` RPC + `sync_runs` audit table — see
|
||||
[rpcs.md](./rpcs.md) and [schema.md](./schema.md)
|
||||
|
||||
## What it does
|
||||
|
||||
There are **two import paths**, both on demand:
|
||||
|
||||
**A. API sync** (`POST /run`) — fetches the event's `sessionize_endpoint` and
|
||||
imports, in order: (1) speakers as contacts (matched by **email**), (2) sessions
|
||||
(upserted by `external_id`), (3) the agenda/schedule (slots find-or-created by
|
||||
date/start/end + `session_speakers` links). The public `/view/` payload has no
|
||||
speaker emails, so this path imports sessions + agenda but **skips speakers**
|
||||
(unless an authenticated `/api/` endpoint + key is configured).
|
||||
|
||||
**B. Excel import** (`POST /import-excel`) — the admin uploads the Sessionize
|
||||
**"Sessions and speakers (advanced)"** `.xlsx` export (generated on the fly by
|
||||
any organizer with admin access to the event). The sidecar parses it (two sheets:
|
||||
*Accepted sessions* + *Accepted speakers*) and calls the
|
||||
`sync_sessionize_excel` RPC, which imports, in order: (1) speakers as contacts
|
||||
(matched by **email** — the Excel carries emails, so this is reliable), (2)
|
||||
sessions + agenda (slots typed `session` / `service_session` from
|
||||
`isServiceSession` + `session_speakers` links), and (3) **a `speaker`
|
||||
registration for every speaker** (create, or update `attendee`→`speaker`; never
|
||||
overrides `staff`/`sponsor`). This is the path that creates the missing speaker
|
||||
contacts + registrations.
|
||||
|
||||
Linking a speaker to a session fires the `session_speakers_speaker_promote`
|
||||
trigger, which promotes an existing registration to `speaker`.
|
||||
|
||||
## How it reaches things
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
ADM["convivo-admin<br/>nginx :3001"] -->|"/sidecar/*"| SC["convivo-sidecar<br/>node :3002"]
|
||||
SC -->|"service-role key"| K["supabase_kong_Convivo<br/>:8000 (PostgREST)"]
|
||||
SC -->|"GET (key optional)"| SZ["Sessionize /view/ or /api/"]
|
||||
K --> PG["Postgres 17"]
|
||||
```
|
||||
|
||||
- **Supabase:** PostgREST at `supabase_kong_Convivo:8000` (Kong's internal port
|
||||
on the shared network — see [supabase-core.md#ports](./supabase-core.md#ports)),
|
||||
authenticated with the **service-role key**.
|
||||
- **Sessionize:** the event's stored `sessionize_endpoint`, fetched **as-is**.
|
||||
The public `/view/` endpoint needs no key. If `SESSIONIZE_API_KEY` is set it
|
||||
is sent as the `X-Sessionize-API-Key` header (harmless for `/view/`, required
|
||||
for an `/api/` endpoint).
|
||||
|
||||
> **Key is optional.** The public `/view/` endpoint (the one stored on the
|
||||
> event) returns sessions, speakers, and rooms **without** speaker email
|
||||
> addresses. Email is the matching key, so a keyless sync imports sessions +
|
||||
> agenda but **skips speakers** (reported in `skipped_speakers`). To import
|
||||
> speakers by email, set `SESSIONIZE_API_KEY` and point the event at the
|
||||
> authenticated `/api/` endpoint, which returns `email` on each speaker.
|
||||
|
||||
## HTTP API
|
||||
|
||||
| Method | Path | Body | Returns |
|
||||
|---|---|---|---|
|
||||
| `GET` | `/health` | — | `{ ok: true }` (compose healthcheck) |
|
||||
| `GET` | `/status` | — | `{ ok, running, lastRun }` |
|
||||
| `POST` | `/run` | `{ event_id }` | **blocking** — the API-sync result (summary + errors) |
|
||||
| `POST` | `/import-excel` | `multipart/form-data` (`event_id` + `file` = the `.xlsx`) | **blocking** — the Excel-import result (summary + errors) |
|
||||
|
||||
`/run` is **blocking**: it reads the event's endpoint, fetches Sessionize,
|
||||
transforms, calls the RPC, and returns the summary. The admin's "Sync" button and
|
||||
the Interfaces "Run sync" both call it and show the result inline.
|
||||
|
||||
`/import-excel` is **blocking** too: it reads the uploaded `.xlsx` (parsed with
|
||||
`xlsx`), transforms the two sheets into the `sync_sessionize_excel` payload, and
|
||||
calls that RPC. The admin's Interfaces **"Import Excel"** control posts the file
|
||||
here and shows the result inline.
|
||||
|
||||
## Env vars
|
||||
|
||||
| Var | Default | Notes |
|
||||
|---|---|---|
|
||||
| `SUPABASE_URL` | `http://supabase_kong_Convivo:8000` | Where PostgREST lives |
|
||||
| `SUPABASE_SERVICE_ROLE_KEY` | standard local service-role JWT | **First server-side holder** of this key (bypasses RLS). Override for a real deployment. |
|
||||
| `SESSIONIZE_API_KEY` | *(empty)* | **Optional.** Only needed if the endpoint is an authenticated `/api/` URL. Sent as `X-Sessionize-API-Key` when set. |
|
||||
| `PORT` | `3002` | |
|
||||
|
||||
> **Secrets convention:** the anon key ships in the apps (public by design); the
|
||||
> service-role key is **never in the app** and stays server-side. The sidecar is
|
||||
> the first consumer of that rule — it holds the key in a container env var,
|
||||
> defaulting to the standard local key (overridable), mirroring how the anon key
|
||||
> is defaulted inline in compose. See [rls.md](./rls.md).
|
||||
|
||||
## Running
|
||||
|
||||
```bash
|
||||
# With the rest of the stack (recommended)
|
||||
docker compose up --build # brings up convivo-sidecar on :3002
|
||||
|
||||
# Or just the sidecar, against a running core
|
||||
npm run sidecar:dev # node apps/sidecar/src/server.js (SUPABASE_URL -> 127.0.0.1:54321)
|
||||
```
|
||||
|
||||
The admin app reaches the sidecar through the same-origin `/sidecar/` proxy
|
||||
(nginx in Docker, Vite in dev) — see [docker.md](./docker.md).
|
||||
|
||||
## Verified behavior
|
||||
|
||||
- `GET /health` → `{ ok: true }` (direct `:3002` and via `:3001/sidecar/health`).
|
||||
- `POST /run` against a public `/view/` endpoint (no key) → fetches, transforms,
|
||||
calls the RPC, and writes sessions/slots (speakers skipped — no emails in the
|
||||
public payload — reported in `skipped_speakers`).
|
||||
- `POST /run` with `SESSIONIZE_API_KEY` set + an `/api/` endpoint → speakers
|
||||
imported by email.
|
||||
- `POST /run` with a reachable Sessionize endpoint → fetches, transforms, calls
|
||||
the RPC, and writes contacts/sessions/slots/links (idempotent on re-run).
|
||||
- `POST /import-excel` with the real "Sessions and speakers (advanced)" export →
|
||||
creates the speaker contacts, links them to sessions, and creates/updates their
|
||||
`speaker` registrations (idempotent on re-run). Verified: 21 speakers created,
|
||||
25 speaker links, 21 speaker registrations, 0 errors.
|
||||
@@ -85,7 +85,7 @@ npx supabase status
|
||||
| Key | Value | Where it's used |
|
||||
|---|---|---|
|
||||
| **Anon key** | standard local anon JWT (see `apps/convivo/.env.example`) | **Ships in the app** (public by design) |
|
||||
| **Service-role key** | standard local service-role JWT | **Never in the app** — server-side only (used for admin ops / verification) |
|
||||
| **Service-role key** | standard local service-role JWT | **Never in the app** — server-side only. The **sidecar** is its first consumer (see [sidecar.md](./sidecar.md)). |
|
||||
|
||||
The app's security model (anon key + session JWT + RLS) is documented in
|
||||
[rls.md](./rls.md).
|
||||
@@ -17,9 +17,10 @@ It runs on **port 3001** (Vite dev) or as the `convivo-admin` Docker container
|
||||
| **Contacts** | Table of all contacts (email, name, LinkedIn, visibility toggles, `is_admin`). Edit, toggle `is_admin`, set visibility, adjust points. (No QR token here — it lives on the registration.) |
|
||||
| **Registrations** | Per active event: list (contact, type, **QR token**, checked_in, points). Change type (enforces the sponsor rule — a failed sponsor change opens an **in-place sponsor lookup** popup), mark checked-in, **view the QR token** (final — no reset). |
|
||||
| **Sponsors** | List (paid only visible to attendees; admin sees all). Add/edit (type, name, email, phone, paid, amount, **contact search-and-pick**). |
|
||||
| **Schedule** | Slots (with type) + sessions (with speakers 1:N via a **multi-select search dropdown**, material upload with a **submitted / not submitted** state, `average_feedback`, `ai_generated_feedback` + an **Evaluate** stub button). |
|
||||
| **Schedule** | Slots (with a **type optionset** — `Session` / `Service Session`) + sessions (with speakers 1:N via a **multi-select search dropdown**, material upload with a **submitted / not submitted** state, `average_feedback`, `ai_generated_feedback` + an **Evaluate** stub button). |
|
||||
| **Activity** | Tables of check-ins, connections, and feedback (per active event). |
|
||||
| **Events** | Create event, toggle active/inactive (a switch; only one can be active at a time — activating one deactivates the rest), edit dates/location. |
|
||||
| **Events** | Create event, toggle active/inactive (a switch; only one can be active at a time — activating one deactivates the rest), edit dates/location + the **Sessionize endpoint**. Each row has a **Sync** button that runs a (blocking) Sessionize sync and shows a result modal. |
|
||||
| **Interfaces** | Manages the Sessionize sync **sidecar**: status (online / running / last run), a **Run sync** control (event picker + blocking run + result modal), an **Import Excel** control (upload the Sessionize "Sessions and speakers (advanced)" `.xlsx` + a "How to get this file" tooltip), and a **Recent runs** table from `sync_runs`. See [../backend/sidecar.md](../backend/sidecar.md). |
|
||||
|
||||
## Auth guard
|
||||
|
||||
@@ -33,9 +34,9 @@ Login is **email + password** (`signInWithPassword({ email, password })`), but
|
||||
|
||||
The password is **event-independent** — it is the contact's Auth password
|
||||
(`contacts.password` must match the bcrypt hash in `auth.users.encrypted_password`),
|
||||
so the same admin can log in for any event. The demo admin is
|
||||
`admin@appe.at` / password `appe-admin-2026`. Staff (Bruno/Rita) can also open the
|
||||
admin app using their email + QR token, since that is their Auth password.
|
||||
so the same admin can log in for any event. The seeded staff are
|
||||
`amelia@appe.at`, `[email protected]`, `[email protected]`, and `[email protected]`, all
|
||||
with password `appe-admin-2026` (see [../backend/seed.md](../backend/seed.md)).
|
||||
|
||||
## Source layout
|
||||
|
||||
@@ -62,7 +63,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 (+ sessionize_endpoint + per-row Sync)
|
||||
└─ Interfaces.tsx # sidecar status / run / recent runs
|
||||
```
|
||||
|
||||
## Data access
|
||||
|
||||
+86
-4
@@ -22,15 +22,26 @@ current phase.
|
||||
> **Existing-sponsor link + Interfaces removal** (the in-place sponsor lookup can
|
||||
> now link an existing sponsor, not just create one; the Pretix/Sessionize
|
||||
> "Interfaces" feature — admin view, `sync-trigger` Edge Function, mock API, and
|
||||
> the `sync_runs` table + sync RPCs — is removed).
|
||||
> Remaining work is cross-cutting (real event clock, deployment, testing).
|
||||
> the `sync_runs` table + sync RPCs — is removed), and
|
||||
> **Sessionize sync sidecar** (the Sessionize interface is re-introduced as a
|
||||
> Docker sidecar driven by a new admin Interfaces menu — on demand only, with a
|
||||
> `sessionize_endpoint` field on events and a per-row Sync button), and
|
||||
> **Sessionize Excel import + slots optionset + real seed** (the sidecar also
|
||||
> imports the Sessionize "Sessions and speakers (advanced)" `.xlsx` — creating
|
||||
> speaker contacts, session links, and `speaker` registrations by email; `slots.type`
|
||||
> is now a `session`/`service_session` enum; the seed uses the real Global Power
|
||||
> Platform Bootcamp (Austria) agenda + 50 attendees + 4 staff, with the event's
|
||||
> endpoint set and speakers added via the Excel import).
|
||||
> Remaining work is cross-cutting (real event clock, deployment, testing, and the
|
||||
> ticket/Pretix sync that will consume the speaker links by email).
|
||||
|
||||
## Done
|
||||
|
||||
### Phase 0 — Dockerized Supabase core ✅
|
||||
- Full schema (13 tables), RLS on every table, transactional points RPCs.
|
||||
- Seed: 1 event, 6 slots, 18 sessions, 14 contacts, 13 registrations, 3 sponsors
|
||||
(QR token = auth password).
|
||||
- Seed: 1 real event (Power Platform Bootcamp AT), 10 slots, 22 sessions, 54
|
||||
contacts (50 attendees + 4 staff), 54 registrations (QR token = auth password).
|
||||
Speakers are added via the Excel import, not the seed.
|
||||
- Runs via the Supabase CLI (`supabase start` / `supabase db reset`).
|
||||
- Details: [backend/README.md](./backend/README.md).
|
||||
|
||||
@@ -155,6 +166,77 @@ rebuilt the views on the new model:
|
||||
- `https://www.appe.at/assets/appe_full.png` as favicon + PWA icon (192/512)
|
||||
for **both** apps. Updated `index.html` + `manifest.webmanifest` + `public/`.
|
||||
|
||||
## Sessionize sync sidecar — ✅ complete
|
||||
|
||||
A new round (migrations `20260831000000_sessionize_sidecar.sql` +
|
||||
`20260832000000_slots_enum_excel_import.sql`, a new `apps/sidecar/` service +
|
||||
admin UI), verified end-to-end. The Sessionize interface is **re-introduced with
|
||||
a different architecture**: a Docker sidecar instead of the removed Edge Function
|
||||
+ mock API. It runs **on demand only** (no scheduling). There are **two import
|
||||
paths**: the **API sync** (`/run`) and the **Excel import** (`/import-excel`).
|
||||
|
||||
**Event field + per-row Sync.**
|
||||
- `events.sessionize_endpoint` (the Sessionize API URL) is editable in the Events
|
||||
create/edit modal; `events.last_synced_at` stamps the last run.
|
||||
- Each event row has a **Sync** button (disabled-hint when no endpoint is set);
|
||||
it runs a **blocking** sync and shows a result modal (counts + errors).
|
||||
|
||||
**The sidecar (`apps/sidecar/`, `:3002`).**
|
||||
- Node 20; one runtime dep (**`xlsx`**, to parse the Excel export). `GET
|
||||
/health`, `GET /status`, `POST /run` (blocking), `POST /import-excel`
|
||||
(blocking, `multipart/form-data`).
|
||||
- **API sync** (`/run`): reads the event's endpoint and fetches it **as-is** (the
|
||||
public `/view/` endpoint needs no key). If `SESSIONIZE_API_KEY` is set it is
|
||||
sent as `X-Sessionize-API-Key` (needed only for an `/api/` endpoint, which is
|
||||
what returns speaker emails). Transforms, then calls the RPC.
|
||||
- **Excel import** (`/import-excel`): the admin uploads the Sessionize **"Sessions
|
||||
and speakers (advanced)"** `.xlsx` (generated on the fly by any organizer with
|
||||
admin access to the event). The sidecar parses the two sheets (*Accepted
|
||||
sessions* + *Accepted speakers*) and calls `sync_sessionize_excel`.
|
||||
- It is the **first server-side holder of the service-role key** (compose env,
|
||||
defaulting to the standard local key). See [backend/sidecar.md](./backend/sidecar.md).
|
||||
- Wired into the admin via a same-origin `/sidecar/` proxy (nginx in Docker, Vite
|
||||
in dev) — CORS-free, matching the existing Supabase proxy pattern.
|
||||
|
||||
**The RPCs.**
|
||||
- `sync_sessionize_event(event_id, payload)` — **API sync**. `security definer`,
|
||||
**service-role only** (JWT role claim; granted to `service_role` only). Imports,
|
||||
in order: (1) speakers → contacts (matched by **email**), (2) sessions (upserted
|
||||
by `external_id`), (3) the agenda (slots find-or-created by date/start/end +
|
||||
`session_speakers` links, **diffed** so the `session_needs_speaker` trigger
|
||||
never blocks a removal). **No registrations are created** — the public `/view/`
|
||||
payload has no speaker emails, so speakers are skipped (reported).
|
||||
- `sync_sessionize_excel(event_id, payload)` — **Excel import**. Same shape plus
|
||||
`is_service_session` per session and `linkedin_url` per speaker, and one extra
|
||||
step: (3) **a `speaker` registration for every speaker** (create, or update
|
||||
`attendee`→`speaker`; never overrides `staff`/`sponsor`). The Excel carries
|
||||
emails, so the contact-level match is reliable — this is the path that creates
|
||||
the missing speaker contacts + registrations.
|
||||
- Both are idempotent (re-run updates in place); per-item errors collected into
|
||||
`errors[]`. Both write an event-scoped `sync_runs` audit row (admin-readable via
|
||||
RLS; `source` = `sessionize` / `sessionize_excel`).
|
||||
|
||||
**Slots type optionset.**
|
||||
- `slots.type` is now a Postgres **enum** (`slot_type`): exactly `session` /
|
||||
`service_session` (not freetext). `service_session` = breaks / lunch / closing
|
||||
(Sessionize's `isServiceSession`). The admin Schedule view shows **Session** /
|
||||
**Service Session** and can create/edit slots (the `slots.id` sequence default
|
||||
was added so the UI need not supply an id).
|
||||
|
||||
**Admin Interfaces menu.**
|
||||
- New `🔌 Interfaces` view: sidecar status (online/running/last run), a **Run
|
||||
sync** control (event picker + blocking run + result modal), an **Import
|
||||
Excel** control (upload the `.xlsx` + a "How to get this file" tooltip), and a
|
||||
**Recent runs** table from `sync_runs`.
|
||||
|
||||
**Seed (real data).**
|
||||
- The seed now uses the **Global Power Platform Bootcamp (Austria)**: the real
|
||||
agenda (22 sessions, 10 slots) from the Sessionize API, **50 made-up
|
||||
attendees**, and **4 staff** (Amelia Hernandez, Sabrina Hota, Jose Lago, Markus
|
||||
Franz — all `@appe.at`, `is_admin`, password `appe-admin-2026`). The event's
|
||||
`sessionize_endpoint` is set. **Speakers are not seeded** — run the Excel
|
||||
import to add them. See [backend/seed.md](./backend/seed.md).
|
||||
|
||||
## Existing-sponsor link + Interfaces removal — ✅ complete
|
||||
|
||||
A polish round (migration `20260830000000_remove_interfaces.sql` + app changes),
|
||||
|
||||
Reference in new issue
Block a user