Post-event reporting + talk networking incentives
- Talk networking: per-event talk_networking_bonus awarded when two people who shared a checked-in talk accept a connection (accept_connection re-created, shared_talk flag, get_talk_cohort RPC, points_log category check widened); Convivo Networking sub-tab inside the Connect screen (Home quick action deep-links in; Connect button reflects existing connection state and is disabled for sent/connected/declined); admin Events view bonus input (0-10). - Reports: sidecar POST /export (CSV / multi-sheet XLSX / PDF report via new pdfkit dep); APPE Admin Reports view (any event: on-screen summary, session feedback summary, top-5, CSV/Excel/PDF downloads); Activity session-feedback per-session aggregate header. - Also carried: @appe.at admin trigger + default password, bulk contact delete, session level/area + event-level feedback, agenda level/area filters, admin password self-service, schedule level/area fields. - 18/18 RPC tests; both apps build; exports verified end-to-end. 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
f74db9dc26
commit
0b6d1f2b6f
35 files changed
+3973
-54
No files matched your search
+16
-1
@@ -27,6 +27,7 @@ Source of truth:
|
||||
|---|---|---|
|
||||
| Checked into a session (by staff) | **+10** | the attendee |
|
||||
| Connection accepted | **+5 each** | both people |
|
||||
| Connection accepted **with a shared talk** | **+`talk_networking_bonus` each** (per event, default 2, `0` = off) | both people (category `talk_networking`) |
|
||||
| Feedback — rating only | **+5** | the attendee |
|
||||
| Feedback — rating + comment | **+10** | the attendee |
|
||||
| Admin adjustment | any | the target (audited as `admin`) |
|
||||
@@ -62,6 +63,7 @@ triggers and the feedback RPC.
|
||||
| `get_public_contacts()` | `email, full_name, linkedin_url`, `show_email`, `registration_type` (active-event registrants) | Connections name/type lookups |
|
||||
| `get_agenda()` | flat rows: slot fields + session fields + `speakers` (string_agg) | Agenda + Home |
|
||||
| `get_active_event()` | the active `events` row (or none) | event name/dates/location |
|
||||
| `get_talk_cohort(p_session_id)` | `email, full_name, registration_type, qr_token` of the **other** attendees checked into that session (staff excluded, self excluded) | the Networking screen's "also attended" list |
|
||||
|
||||
All are `security definer` and expose **only public columns** (email is included
|
||||
because `contacts` is keyed by email and is the identity; `qr_token` is never
|
||||
@@ -84,12 +86,25 @@ Creates a **pending** connection to the contact whose QR was scanned.
|
||||
- **Idempotent:** if the pair already has a connection (either direction) for the
|
||||
active event, returns the existing one instead of creating a duplicate.
|
||||
|
||||
### `accept_connection(p_connection_id)` → `connections`
|
||||
### `accept_connection(p_connection_id)` → `(event_id, from_email, to_email, status, created_at, resolved_at, shared_talk)`
|
||||
Accepts an **incoming** request.
|
||||
- Locks the row (`for update`), verifies the caller is the recipient
|
||||
(`to_email = current_email()`) and the status is still `pending`.
|
||||
- Sets `status = 'accepted'`, `resolved_at = now()`.
|
||||
- **Awards +5 to both** `from_email` and `to_email` (category `connection`).
|
||||
- **Talk networking bonus:** computes whether the two parties share a
|
||||
checked-in session (talk) — i.e. there is a session both were checked into
|
||||
(`checkins` intersection). If they do **and** the event's
|
||||
`talk_networking_bonus > 0`, it awards that bonus to **each** party
|
||||
(category `talk_networking`). Returns `shared_talk = true` in that case so
|
||||
the app can show a "met at {talk}" note.
|
||||
- **Idempotency:** the function is one-shot (row locked, status must be
|
||||
`pending`), so the bonus can never double-award.
|
||||
- **Documented limitation:** check-ins that happen **after** acceptance do
|
||||
not retro-award the bonus — it reflects shared attendance at acceptance
|
||||
time.
|
||||
- The bonus flows through `_award_points`, so the leaderboard sync + staff
|
||||
exclusion are inherited automatically.
|
||||
|
||||
### `reject_connection(p_connection_id)` → `connections`
|
||||
Same guards as accept, but sets `status = 'rejected'`. No points.
|
||||
|
||||
@@ -79,6 +79,7 @@ queries everything for the active event and handles "no active event" gracefully
|
||||
| `num_checked_in_registrations` | `integer` | maintained aggregate |
|
||||
| `sessionize_endpoint` | `text` | nullable — the Sessionize API URL for this event (see [sidecar.md](./sidecar.md)) |
|
||||
| `use_realtime_clock` | `boolean` | default `false` — when `true`, the attendee app drives slot status (Live/Next/Done) from the real system clock; when `false` it uses the simulated mid-event clock (see [../frontend/app-structure.md](../frontend/app-structure.md)) |
|
||||
| `talk_networking_bonus` | `integer` | default `2` — bonus points awarded to **each** party when two people who were checked into the same session (talk) accept a connection. `0` disables the feature (the +5 connection award still applies). Awarded with the `talk_networking` points category (see [rpcs.md](./rpcs.md#accept_connectionp_connection_id-uuid)) |
|
||||
| `last_synced_at` | `timestamptz` | nullable — when the Sessionize sync last ran |
|
||||
| `created_at` | `timestamptz` | |
|
||||
|
||||
@@ -277,7 +278,7 @@ Powers the per-category points breakdown on the Profile screen (per event).
|
||||
| `event_id` | `uuid` FK → `events` | `on delete cascade` |
|
||||
| `contact_email` | `text` FK → `contacts` | |
|
||||
| `delta` | `integer` | points added (can be negative for admin adjustments) |
|
||||
| `category` | `text` | `checkin` \| `connection` \| `feedback` \| `admin` |
|
||||
| `category` | `text` | `checkin` \| `connection` \| `feedback` \| `admin` \| `talk_networking` (CHECK constraint, widened by the talk-networking migration) |
|
||||
| `created_at` | `timestamptz` | |
|
||||
|
||||
Index: `points_log_event_id_idx (event_id)`.
|
||||
|
||||
@@ -70,6 +70,15 @@ 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).
|
||||
|
||||
> **Default admin password:** any `@appe.at` contact is an admin and logs in
|
||||
> with **`appe-admin-2026`** out of the box. The `trg_contacts_appe_at_admin`
|
||||
> trigger sets `contacts.password = 'appe-admin-2026'` (when null) on
|
||||
> insert/update, and the auth-user-creation helpers hash it into
|
||||
> `auth.users.encrypted_password` so a freshly-created `@appe.at` admin can log
|
||||
> in immediately. A custom password set on the contact row is always respected
|
||||
> (never overwritten). See migration
|
||||
> [`20260910000000_admin_default_password.sql`](../../supabase/migrations/20260910000000_admin_default_password.sql).
|
||||
|
||||
| Person | Type | Email | Login |
|
||||
|---|---|---|---|
|
||||
| **Amelia Hernandez** | staff (admin) | amelia@appe.at | `appe-admin-2026` |
|
||||
|
||||
+23
-2
@@ -8,8 +8,9 @@ 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`)
|
||||
(`node:20-alpine`; runtime dependencies **`xlsx`** (parse the Sessionize Excel
|
||||
export) and **`pdfkit`** (render the PDF report) — 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
|
||||
@@ -82,6 +83,7 @@ flowchart LR
|
||||
| `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) |
|
||||
| `POST` | `/export` | `{ event_id, format: 'csv' \| 'xlsx' \| 'pdf', tables? }` | **blocking** — `{ filename, mime, content_base64 }` (the event report) |
|
||||
|
||||
`/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
|
||||
@@ -92,6 +94,21 @@ the Interfaces "Run sync" both call it and show the result inline.
|
||||
calls that RPC. The admin's Interfaces **"Import Excel"** control posts the file
|
||||
here and shows the result inline.
|
||||
|
||||
`/export` is **blocking** as well: it fetches the event's full dataset
|
||||
(registrations, check-ins, connections, session feedback, event feedback,
|
||||
leaderboard, points log — service role, joined for readability) and renders it as
|
||||
one of three formats:
|
||||
|
||||
- **`csv`** — a single combined CSV (a `table` column distinguishes the rows).
|
||||
- **`xlsx`** — one workbook, one sheet per table (the `tables` array selects
|
||||
which sheets to include; defaults to all).
|
||||
- **`pdf`** — a structured post-event report (header, summary, per-session
|
||||
feedback, top-10 points, event-level feedback comments) rendered with `pdfkit`.
|
||||
|
||||
It returns `{ filename, mime, content_base64 }`; the admin's **Reports** view
|
||||
decodes the base64 and triggers a browser download. Empty tables produce a valid
|
||||
file with headers only (never an error); an unknown event is a 404.
|
||||
|
||||
## Env vars
|
||||
|
||||
| Var | Default | Notes |
|
||||
@@ -134,3 +151,7 @@ The admin app reaches the sidecar through the same-origin `/sidecar/` proxy
|
||||
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.
|
||||
- `POST /export` for each format against the seeded event → returns a parseable
|
||||
file: CSV with a `table` column, XLSX with one sheet per table, and a valid
|
||||
PDF report (verified: CSV ~10 KB, XLSX 7 sheets, PDF `%PDF-1.3`). Unknown
|
||||
event → 404.
|
||||
Reference in new issue
Block a user