Check-in gate + fixes, RPC test suite, docs

- Convivo: not-checked-in gate for non-staff (see-a-staff screen with QR
  code + logout); lifts automatically once staff checks them in
- Convivo: fix check-in 'pick a session first' race (synchronous default
  session fallback)
- Add RPC test suite (npm run test:rpc): points idempotency, role guards,
  service-session guard, speaker auto-promote, leaderboard staff exclusion
- Fix db:types script (create packages/shared/src); gitignore generated types
- Docs: README/roadmap drift fixes, tests.md, backend README link
This commit is contained in:
Lago committed 2026-09-08 21:05:34 +02:00
1 parent 25ae8b6ee4
commit e4c8815e52
11 files changed
+559 -38

No files matched your search

+15 -9
View File
@@ -1,4 +1,4 @@
import { useEffect, useState } from 'react';
import { useEffect, useMemo, useState } from 'react';
import { useAuth } from '../context/AuthContext';
import { useEvent } from '../lib/useEvent';
import { checkinAttendee, createConnectionRequest, lanyardLookup, welcomeCheckin } from '../lib/api';
@@ -20,13 +20,16 @@ export function Scan() {
const [busy, setBusy] = useState(false);
const { toast } = useToast();
// The first checkable (non-service) session, computed synchronously so a fast
// scan never races the async default-selection effect below.
const defaultSessionId = useMemo(
() => slots.flatMap((s) => s.sessions).find((s) => s.slot_type !== 'service_session')?.id ?? '',
[slots],
);
useEffect(() => {
if (slots.length > 0 && !sessionId) {
// Default to the first checkable (non-service) session.
const first = slots.flatMap((s) => s.sessions).find((s) => s.slot_type !== 'service_session');
if (first) setSessionId(first.id);
}
}, [slots, sessionId]);
if (defaultSessionId && !sessionId) setSessionId(defaultSessionId);
}, [defaultSessionId, sessionId]);
if (loading || !contact) {
return (
@@ -49,11 +52,14 @@ export function Scan() {
const res = await welcomeCheckin(token);
setWelcome(res);
} else {
if (!sessionId) {
// Fall back to the first checkable session so a fast scan (before the
// async default-selection effect runs) never fails with "pick a session".
const targetSession = sessionId || defaultSessionId;
if (!targetSession) {
toast('Pick a session first', 'err');
return;
}
const res = await checkinAttendee(sessionId, token);
const res = await checkinAttendee(targetSession, token);
setCheckin(res);
}
} else {