feat: finalize ticket merging and speaker-aware imports
This commit is contained in:
1 parent
648daa0794
commit
4e71e9b797
35 files changed
+1771
-347
No files matched your search
@@ -13,6 +13,7 @@ packages/shared/src/database.types.ts
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
SMTP.md
|
||||
|
||||
# Supabase CLI local state (generated on `supabase start`)
|
||||
supabase/.temp/
|
||||
|
||||
@@ -91,14 +91,16 @@ export function Toggle({
|
||||
checked,
|
||||
onChange,
|
||||
label,
|
||||
disabled = false,
|
||||
}: {
|
||||
checked: boolean;
|
||||
onChange: (v: boolean) => void;
|
||||
label?: string;
|
||||
disabled?: boolean;
|
||||
}) {
|
||||
return (
|
||||
<label className="toggle" title={label}>
|
||||
<input type="checkbox" checked={checked} onChange={(e) => onChange(e.target.checked)} />
|
||||
<input type="checkbox" checked={checked} disabled={disabled} onChange={(e) => onChange(e.target.checked)} />
|
||||
<span className="track">
|
||||
<span className="knob" />
|
||||
</span>
|
||||
|
||||
@@ -153,10 +153,14 @@ export async function setRegistrationType(contactEmail: string, type: Registrati
|
||||
}
|
||||
|
||||
export async function setCheckedIn(registrationId: string, checkedIn: boolean): Promise<void> {
|
||||
const { error } = await supabase.from('registrations').update({ checked_in: checkedIn }).eq('id', registrationId);
|
||||
const { data, error } = await supabase.from('registrations').update({ checked_in: checkedIn }).eq('id', registrationId).select('id').single();
|
||||
if (error) throw new ApiError(error.message);
|
||||
if (!data) throw new ApiError('Registration no longer exists');
|
||||
}
|
||||
|
||||
export const mergeTickets = (sourceId: string, targetId: string) =>
|
||||
rpc<import('./types').TicketMergeResult>('merge_tickets', { p_source_id: sourceId, p_target_id: targetId });
|
||||
|
||||
// ---- Sponsors ----------------------------------------------------------------
|
||||
|
||||
export async function upsertSponsor(
|
||||
|
||||
@@ -172,6 +172,8 @@ export interface SidecarStatus {
|
||||
}
|
||||
|
||||
export interface Registration {
|
||||
import_source?: 'sessionize' | null;
|
||||
external_id?: string | null;
|
||||
id: string;
|
||||
event_id: string;
|
||||
contact_email: string;
|
||||
@@ -182,6 +184,14 @@ export interface Registration {
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface TicketMergeResult {
|
||||
source_id: string;
|
||||
target_id: string;
|
||||
target_email: string;
|
||||
type: RegistrationType;
|
||||
sessions_transferred: number;
|
||||
}
|
||||
|
||||
export interface Sponsor {
|
||||
id: string;
|
||||
event_id: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import {
|
||||
createRegistration,
|
||||
deleteContacts,
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
getRegistrations,
|
||||
getSponsors,
|
||||
setCheckedIn,
|
||||
mergeTickets,
|
||||
setRegistrationType,
|
||||
upsertSponsor,
|
||||
} from '../lib/api';
|
||||
@@ -33,8 +34,18 @@ export function Registrations() {
|
||||
const [sponsorFor, setSponsorFor] = useState<Registration | null>(null);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [deletingAll, setDeletingAll] = useState(false);
|
||||
const [mergeFor, setMergeFor] = useState<Registration | null>(null);
|
||||
const selectedEventId = useRef(selectedId);
|
||||
selectedEventId.current = selectedId;
|
||||
|
||||
const event = events.find((e) => e.id === selectedId) ?? null;
|
||||
const eventRegistrations = registrations.filter((registration) => registration.event_id === selectedId);
|
||||
const ticketed = eventRegistrations.filter((registration) => registration.qr_token?.trim());
|
||||
|
||||
async function reloadRegistrations(eventId: string) {
|
||||
const rows = await getRegistrations(eventId);
|
||||
if (selectedEventId.current === eventId) setRegistrations(rows);
|
||||
}
|
||||
|
||||
async function load() {
|
||||
try {
|
||||
@@ -106,8 +117,9 @@ export function Registrations() {
|
||||
const filtered = useMemo(() => {
|
||||
if (!registrations) return [];
|
||||
const q = query.trim().toLowerCase();
|
||||
if (!q) return registrations;
|
||||
if (!q) return registrations.filter((r) => r.event_id === selectedId);
|
||||
return registrations.filter((r) => {
|
||||
if (r.event_id !== selectedId) return false;
|
||||
const c = byEmail.get(r.contact_email);
|
||||
return (
|
||||
(c?.full_name ?? '').toLowerCase().includes(q) ||
|
||||
@@ -115,13 +127,13 @@ export function Registrations() {
|
||||
r.type.toLowerCase().includes(q)
|
||||
);
|
||||
});
|
||||
}, [registrations, query, byEmail]);
|
||||
}, [registrations, query, byEmail, selectedId]);
|
||||
|
||||
async function changeType(r: Registration, type: RegistrationType) {
|
||||
setBusy(true);
|
||||
try {
|
||||
await setRegistrationType(r.contact_email, type);
|
||||
await load();
|
||||
await reloadRegistrations(r.event_id);
|
||||
push('success', `${byEmail.get(r.contact_email)?.full_name ?? r.contact_email} → ${type}`);
|
||||
} catch (e) {
|
||||
const msg = e instanceof Error ? e.message : 'Update failed';
|
||||
@@ -139,10 +151,11 @@ export function Registrations() {
|
||||
|
||||
async function toggleCheckedIn(r: Registration, v: boolean) {
|
||||
setBusy(true);
|
||||
setRegistrations((rows) => rows.map((row) => row.id === r.id ? { ...row, checked_in: v } : row));
|
||||
try {
|
||||
await setCheckedIn(r.id, v);
|
||||
await load();
|
||||
} catch (e) {
|
||||
setRegistrations((rows) => rows.map((row) => row.id === r.id ? { ...row, checked_in: r.checked_in } : row));
|
||||
push('error', e instanceof Error ? e.message : 'Update failed');
|
||||
} finally {
|
||||
setBusy(false);
|
||||
@@ -181,7 +194,7 @@ export function Registrations() {
|
||||
<div className="sub">
|
||||
<strong>{event.name}</strong>
|
||||
{event.is_active && <span className="pill green" style={{ marginLeft: 8 }}>active</span>} ·{' '}
|
||||
{registrations.length} registrations · {registrations.filter((r) => r.checked_in).length} checked in.
|
||||
{ticketed.length} tickets · {ticketed.filter((r) => r.checked_in).length} checked in · {eventRegistrations.length - ticketed.length} without tickets.
|
||||
</div>
|
||||
</div>
|
||||
<div className="row" style={{ gap: 10 }}>
|
||||
@@ -189,6 +202,7 @@ export function Registrations() {
|
||||
className="input"
|
||||
style={{ maxWidth: 280 }}
|
||||
value={selectedId}
|
||||
disabled={busy || mergeFor !== null}
|
||||
onChange={(e) => setSelectedId(e.target.value)}
|
||||
>
|
||||
{events.map((e) => (
|
||||
@@ -260,13 +274,18 @@ export function Registrations() {
|
||||
<td>
|
||||
<div className="row" style={{ gap: 8 }}>
|
||||
<span className="mono small">{r.qr_token ?? '—'}</span>
|
||||
<button className="btn small" onClick={() => setQrFor(r)}>
|
||||
{r.qr_token?.trim() && <button className="btn small" onClick={() => setQrFor(r)}>
|
||||
QR
|
||||
</button>}
|
||||
{!r.qr_token?.trim() && r.import_source === 'sessionize' && (
|
||||
<button className="btn small" disabled={busy} onClick={() => setMergeFor(r)}>
|
||||
Merge tickets
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<Toggle checked={r.checked_in} onChange={(v) => toggleCheckedIn(r, v)} />
|
||||
<Toggle checked={r.checked_in} disabled={busy} onChange={(v) => toggleCheckedIn(r, v)} />
|
||||
</td>
|
||||
<td style={{ textAlign: 'right' }}>
|
||||
<span className="pts">{r.points}</span>
|
||||
@@ -286,12 +305,28 @@ export function Registrations() {
|
||||
onClose={() => setAdding(false)}
|
||||
onSaved={async (msg) => {
|
||||
setAdding(false);
|
||||
await load();
|
||||
await reloadRegistrations(event.id);
|
||||
push('success', msg);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
{mergeFor && (
|
||||
<MergeTicketsModal
|
||||
source={mergeFor}
|
||||
contacts={byEmail}
|
||||
tickets={ticketed.filter((ticket) => ticket.id !== mergeFor.id && ticket.external_id?.trim())}
|
||||
onClose={() => setMergeFor(null)}
|
||||
onMerged={async (result) => {
|
||||
setRegistrations((rows) => rows.filter((row) => row.id !== result.source_id).map((row) => row.id === result.target_id ? { ...row, type: result.type } : row));
|
||||
try { await reloadRegistrations(mergeFor.event_id); }
|
||||
catch { push('error', 'Merge saved; reload registrations to see the updated ticket.'); }
|
||||
setMergeFor(null);
|
||||
push('success', `Merged into ${result.target_email}; ${result.sessions_transferred} session assignment(s) transferred.`);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
{qrFor && (
|
||||
<Modal
|
||||
open
|
||||
@@ -330,6 +365,61 @@ export function Registrations() {
|
||||
);
|
||||
}
|
||||
|
||||
function MergeTicketsModal({ source, contacts, tickets, onClose, onMerged }: {
|
||||
source: Registration;
|
||||
contacts: Map<string, Contact>;
|
||||
tickets: Registration[];
|
||||
onClose: () => void;
|
||||
onMerged: (result: import('../lib/types').TicketMergeResult) => Promise<void>;
|
||||
}) {
|
||||
const [search, setSearch] = useState('');
|
||||
const [selected, setSelected] = useState('');
|
||||
const [saving, setSaving] = useState(false);
|
||||
const [failure, setFailure] = useState('');
|
||||
const sourceName = contacts.get(source.contact_email)?.full_name ?? source.contact_email;
|
||||
const words = (name: string) => name.toLocaleLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '').split(/[^a-z0-9]+/).filter(Boolean);
|
||||
const sourceWords = words(sourceName);
|
||||
const score = (ticket: Registration) => words(contacts.get(ticket.contact_email)?.full_name ?? '').filter((word) => sourceWords.includes(word)).length;
|
||||
const options = tickets.filter((ticket) => `${contacts.get(ticket.contact_email)?.full_name ?? ''} ${ticket.contact_email}`.toLowerCase().includes(search.trim().toLowerCase()))
|
||||
.sort((first, second) => score(second) - score(first) || first.contact_email.localeCompare(second.contact_email));
|
||||
const target = tickets.find((ticket) => ticket.id === selected);
|
||||
async function save() {
|
||||
if (!target || saving) return;
|
||||
setSaving(true);
|
||||
setFailure('');
|
||||
try { await onMerged(await mergeTickets(source.id, target.id)); }
|
||||
catch (error) {
|
||||
setFailure(error instanceof Error ? error.message : 'Merge failed');
|
||||
setSaving(false);
|
||||
}
|
||||
}
|
||||
return (
|
||||
<Modal open title="Merge tickets" onClose={() => { if (!saving) onClose(); }} footer={
|
||||
<>
|
||||
<button className="btn" disabled={saving} onClick={onClose}>Cancel</button>
|
||||
<button className="btn primary" disabled={!target || saving} onClick={save}>{saving ? 'Merging...' : 'Confirm merge'}</button>
|
||||
</>
|
||||
}>
|
||||
<p><strong>{sourceName}</strong><br /><span className="muted">{source.contact_email}</span></p>
|
||||
<label className="field">
|
||||
<span>Destination ticket</span>
|
||||
<input className="input" value={search} disabled={saving} placeholder="Search name or email" onChange={(change) => setSearch(change.target.value)} />
|
||||
</label>
|
||||
<div style={{ maxHeight: 280, overflowY: 'auto', marginTop: 12 }} role="radiogroup" aria-label="Destination ticket">
|
||||
{options.map((ticket) => (
|
||||
<label key={ticket.id} className="row" style={{ padding: '10px 0', gap: 10 }}>
|
||||
<input type="radio" name="merge-ticket" disabled={saving} checked={selected === ticket.id} onChange={() => setSelected(ticket.id)} />
|
||||
<span><strong>{contacts.get(ticket.contact_email)?.full_name ?? ticket.contact_email}</strong><br />{ticket.contact_email}{score(ticket) > 0 && <span className="pill green" style={{ marginLeft: 8 }}>Name match</span>}</span>
|
||||
</label>
|
||||
))}
|
||||
{options.length === 0 && <p className="muted">No matching purchased tickets.</p>}
|
||||
</div>
|
||||
{target && <p>The ticket for <strong>{target.contact_email}</strong> keeps its QR, check-in and points. Session assignments and the {source.type} role transfer before the imported registration is deleted. Other events are unchanged.</p>}
|
||||
{failure && <p role="alert" className="error">{failure}</p>}
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
function AddRegistrationModal({
|
||||
contacts,
|
||||
existing,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="referrer" content="no-referrer" />
|
||||
<link rel="icon" type="image/png" href="/favicon.png" />
|
||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
||||
|
||||
@@ -35,6 +35,13 @@ server {
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
location = /auth/callback {
|
||||
access_log off;
|
||||
add_header Cache-Control "no-store";
|
||||
add_header Referrer-Policy "no-referrer";
|
||||
try_files /index.html =404;
|
||||
}
|
||||
|
||||
# ---- Supabase same-origin proxy -------------------------------------
|
||||
# No trailing slash on proxy_pass => the original URI is passed through
|
||||
# unchanged (e.g. /auth/v1/token -> http://<target>/auth/v1/token).
|
||||
|
||||
@@ -85,7 +85,7 @@ export function QrImage({ value, size = 180 }: { value: string; size?: number })
|
||||
* decoded text. The camera only works on a secure context (https or localhost);
|
||||
* the manual field always works.
|
||||
*/
|
||||
export function Scanner({ onResult, label = 'Scan a lanyard QR' }: { onResult: (text: string) => void; label?: string }) {
|
||||
export function Scanner({ onResult, label = 'Scan a lanyard QR', entryLabel = 'QR code', placeholder = '…or type the code (e.g. CVV-XXX-NNNN)', submitLabel = 'Go', disabled = false, submitDisabled = false, onEntryChange }: { onResult: (text: string) => void; label?: string; entryLabel?: string; placeholder?: string; submitLabel?: string; disabled?: boolean; submitDisabled?: boolean; onEntryChange?: (text: string) => void }) {
|
||||
const [manual, setManual] = useState('');
|
||||
const [camError, setCamError] = useState<string | null>(null);
|
||||
const scannerRef = useRef<Html5Qrcode | null>(null);
|
||||
@@ -162,13 +162,17 @@ export function Scanner({ onResult, label = 'Scan a lanyard QR' }: { onResult: (
|
||||
<div className="row" style={{ gap: 8 }}>
|
||||
<input
|
||||
className="input mono"
|
||||
type="text"
|
||||
data-testid="scanner-manual-code"
|
||||
placeholder="…or type the code (e.g. CVV-XXX-NNNN)"
|
||||
aria-label={entryLabel}
|
||||
placeholder={placeholder}
|
||||
disabled={disabled}
|
||||
value={manual}
|
||||
onChange={(e) => setManual(e.target.value)}
|
||||
onChange={(e) => { setManual(e.target.value); onEntryChange?.(e.target.value); }}
|
||||
onKeyDown={(e) => { if (e.key === 'Enter' && manual.trim() && !disabled && !submitDisabled) onResult(manual.trim()); }}
|
||||
/>
|
||||
<button className="btn primary small" data-testid="scanner-manual-go" disabled={!manual.trim()} onClick={() => onResult(manual.trim())}>
|
||||
Go
|
||||
<button className="btn primary small" data-testid="scanner-manual-go" disabled={disabled || submitDisabled || !manual.trim()} onClick={() => onResult(manual.trim())}>
|
||||
{submitLabel}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { createContext, useCallback, useContext, useEffect, useMemo, useState, type ReactNode } from 'react';
|
||||
import type { Session as SbSession, User } from '@supabase/supabase-js';
|
||||
import { supabase } from '../lib/supabase';
|
||||
import { getMyContact, getMyRegistration } from '../lib/api';
|
||||
import { adminCallbackPending, consumeAdminCallback, hasAdminCallback, invalidAdminLink, loadEntryProfile, type EntryProfile } from '../lib/adminEntry';
|
||||
import type { Contact, Registration } from '../lib/types';
|
||||
|
||||
interface AuthContextValue {
|
||||
@@ -10,6 +10,7 @@ interface AuthContextValue {
|
||||
contact: Contact | null;
|
||||
registration: Registration | null;
|
||||
loading: boolean;
|
||||
authError: string | null;
|
||||
refresh: () => Promise<void>;
|
||||
signOut: () => Promise<void>;
|
||||
}
|
||||
@@ -21,42 +22,66 @@ export function AuthProvider({ children }: { children: ReactNode }) {
|
||||
const [contact, setContact] = useState<Contact | null>(null);
|
||||
const [registration, setRegistration] = useState<Registration | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [authError, setAuthError] = useState<string | null>(null);
|
||||
|
||||
const load = useCallback(async (email: string) => {
|
||||
try {
|
||||
const [c, r] = await Promise.all([getMyContact(email), getMyRegistration(email)]);
|
||||
setContact(c);
|
||||
setRegistration(r);
|
||||
} catch (e) {
|
||||
console.error('Failed to load contact', e);
|
||||
}
|
||||
const applyProfile = useCallback((profile: EntryProfile) => {
|
||||
setSession(profile.session);
|
||||
setContact(profile.contact);
|
||||
setRegistration(profile.registration);
|
||||
setAuthError(profile.error);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
let active = true;
|
||||
supabase.auth.getSession().then(({ data }) => {
|
||||
if (!active) return;
|
||||
setSession(data.session);
|
||||
if (data.session?.user?.email) void load(data.session.user.email);
|
||||
setLoading(false);
|
||||
});
|
||||
const { data: sub } = supabase.auth.onAuthStateChange((_event, newSession) => {
|
||||
setSession(newSession);
|
||||
if (newSession?.user?.email) void load(newSession.user.email);
|
||||
else {
|
||||
setContact(null);
|
||||
setRegistration(null);
|
||||
let revision = 0;
|
||||
const emptyProfile: EntryProfile = { session: null, contact: null, registration: null, error: null };
|
||||
|
||||
async function restore(next: SbSession | null, currentRevision: number) {
|
||||
try {
|
||||
const profile = next ? await loadEntryProfile(next) : emptyProfile;
|
||||
if (active && revision === currentRevision) applyProfile(profile);
|
||||
} catch {
|
||||
if (!active || revision !== currentRevision) return;
|
||||
applyProfile({ ...emptyProfile, error: invalidAdminLink });
|
||||
await supabase.auth.signOut({ scope: 'local' });
|
||||
} finally {
|
||||
if (active && revision === currentRevision) setLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function init() {
|
||||
if (hasAdminCallback) {
|
||||
const profile = await consumeAdminCallback();
|
||||
if (active) { applyProfile(profile); setLoading(false); }
|
||||
return;
|
||||
}
|
||||
const currentRevision = revision;
|
||||
const { data } = await supabase.auth.getSession();
|
||||
if (active && revision === currentRevision) await restore(data.session, currentRevision);
|
||||
}
|
||||
void init().catch(() => { if (active) { setAuthError(invalidAdminLink); setLoading(false); } });
|
||||
const { data: sub } = supabase.auth.onAuthStateChange((event, newSession) => {
|
||||
if (!active || adminCallbackPending || event === 'INITIAL_SESSION') return;
|
||||
const currentRevision = ++revision;
|
||||
if (!newSession) {
|
||||
applyProfile(emptyProfile);
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
setLoading(true);
|
||||
window.setTimeout(() => {
|
||||
if (active && revision === currentRevision) void restore(newSession, currentRevision);
|
||||
}, 0);
|
||||
});
|
||||
return () => {
|
||||
active = false;
|
||||
sub.subscription.unsubscribe();
|
||||
};
|
||||
}, [load]);
|
||||
}, [applyProfile]);
|
||||
|
||||
const refresh = useCallback(async () => {
|
||||
if (session?.user?.email) await load(session.user.email);
|
||||
}, [session, load]);
|
||||
if (session) applyProfile(await loadEntryProfile(session));
|
||||
}, [session, applyProfile]);
|
||||
|
||||
const signOut = useCallback(async () => {
|
||||
await supabase.auth.signOut();
|
||||
@@ -65,8 +90,8 @@ export function AuthProvider({ children }: { children: ReactNode }) {
|
||||
}, []);
|
||||
|
||||
const value = useMemo<AuthContextValue>(
|
||||
() => ({ session, user: session?.user ?? null, contact, registration, loading, refresh, signOut }),
|
||||
[session, contact, registration, loading, refresh, signOut],
|
||||
() => ({ session, user: session?.user ?? null, contact, registration, loading, authError, refresh, signOut }),
|
||||
[session, contact, registration, loading, authError, refresh, signOut],
|
||||
);
|
||||
|
||||
return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
import type { Session } from '@supabase/supabase-js';
|
||||
import { supabase } from './supabase';
|
||||
import { getMyContact, getMyRegistration } from './api';
|
||||
import type { Contact, Registration } from './types';
|
||||
|
||||
export const invalidAdminLink = 'This sign-in link is invalid or expired. Please request a new link.';
|
||||
export const adminLinkNotice = 'If this email belongs to an eligible admin account, a sign-in link has been sent.';
|
||||
export const adminLinkFailure = 'Unable to send a sign-in link right now. Please try again later.';
|
||||
|
||||
export function isEmailEntry(value: string): boolean {
|
||||
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value.trim());
|
||||
}
|
||||
|
||||
export async function requestAdminLink(email: string): Promise<void> {
|
||||
const normalizedEmail = email.trim().toLowerCase();
|
||||
const { data: eligible, error: eligibilityError } = await supabase.rpc('can_request_admin_magic_link', { p_email: normalizedEmail });
|
||||
if (eligibilityError) throw new Error(adminLinkFailure);
|
||||
if (eligible !== true) return;
|
||||
const { error } = await supabase.auth.signInWithOtp({
|
||||
email: normalizedEmail,
|
||||
options: { shouldCreateUser: false, emailRedirectTo: `${window.location.origin}/auth/callback` },
|
||||
});
|
||||
if (error && error.status !== 400 && error.status !== 422) throw new Error(adminLinkFailure);
|
||||
}
|
||||
|
||||
const entryUrl = new URL(window.location.href);
|
||||
const entryHash = new URLSearchParams(entryUrl.hash.slice(1));
|
||||
export const hasAdminCallback = entryUrl.pathname === '/auth/callback' ||
|
||||
(entryUrl.pathname === '/' && ['access_token', 'refresh_token', 'error', 'error_code'].some((key) => entryHash.has(key))) ||
|
||||
(entryUrl.pathname === '/' && ['code', 'error', 'error_code'].some((key) => entryUrl.searchParams.has(key)));
|
||||
if (hasAdminCallback) window.history.replaceState(null, '', '/');
|
||||
export let adminCallbackPending = hasAdminCallback;
|
||||
|
||||
export interface EntryProfile {
|
||||
session: Session | null;
|
||||
contact: Contact | null;
|
||||
registration: Registration | null;
|
||||
error: string | null;
|
||||
}
|
||||
|
||||
export async function loadEntryProfile(session: Session, adminOnly = false): Promise<EntryProfile> {
|
||||
const { data: verified, error: userError } = await supabase.auth.getUser(session.access_token);
|
||||
if (userError || !verified.user?.email || verified.user.id !== session.user.id) throw new Error(invalidAdminLink);
|
||||
const { data: isAdmin, error: adminError } = await supabase.rpc('is_admin');
|
||||
if (adminError) throw new Error(invalidAdminLink);
|
||||
if (adminOnly && isAdmin !== true) throw new Error('This account is not an admin.');
|
||||
const [contact, registration] = await Promise.all([
|
||||
getMyContact(verified.user.email), getMyRegistration(verified.user.email),
|
||||
]);
|
||||
if (!contact) throw new Error(invalidAdminLink);
|
||||
return { session: { ...session, user: verified.user }, contact: { ...contact, is_admin: isAdmin === true }, registration, error: null };
|
||||
}
|
||||
|
||||
let callbackResult: Promise<EntryProfile> | null = null;
|
||||
|
||||
export function consumeAdminCallback(): Promise<EntryProfile> {
|
||||
if (!callbackResult) callbackResult = (async () => {
|
||||
try {
|
||||
if (['error', 'error_code'].some((key) => entryHash.has(key) || entryUrl.searchParams.has(key))) throw new Error(invalidAdminLink);
|
||||
const accessToken = entryHash.get('access_token');
|
||||
const refreshToken = entryHash.get('refresh_token');
|
||||
const code = entryUrl.searchParams.get('code');
|
||||
const result = accessToken && refreshToken
|
||||
? await supabase.auth.setSession({ access_token: accessToken, refresh_token: refreshToken })
|
||||
: code && !accessToken && !refreshToken ? await supabase.auth.exchangeCodeForSession(code) : null;
|
||||
if (!result || result.error || !result.data.session) throw new Error(invalidAdminLink);
|
||||
return await loadEntryProfile(result.data.session, true);
|
||||
} catch (failure) {
|
||||
await supabase.auth.signOut({ scope: 'local' }).catch(() => {});
|
||||
return { session: null, contact: null, registration: null, error: failure instanceof Error && failure.message === 'This account is not an admin.' ? failure.message : invalidAdminLink };
|
||||
} finally {
|
||||
adminCallbackPending = false;
|
||||
}
|
||||
})();
|
||||
return callbackResult;
|
||||
}
|
||||
@@ -106,7 +106,9 @@ export async function getMyContact(email: string): Promise<Contact | null> {
|
||||
|
||||
/** The signed-in contact's registration for the active event. */
|
||||
export async function getMyRegistration(email: string): Promise<Registration | null> {
|
||||
const { data, error } = await supabase.from('registrations').select('*').eq('contact_email', email).maybeSingle();
|
||||
const event = await getActiveEvent();
|
||||
if (!event) return null;
|
||||
const { data, error } = await supabase.from('registrations').select('*').eq('contact_email', email).eq('event_id', event.id).maybeSingle();
|
||||
if (error) throw new ApiError(error.message);
|
||||
return (data as Registration) ?? null;
|
||||
}
|
||||
|
||||
@@ -1,29 +1,64 @@
|
||||
import { useState } from 'react';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { supabase } from '../lib/supabase';
|
||||
import { lanyardLookup } from '../lib/api';
|
||||
import { capWords } from '../lib/time';
|
||||
import type { PublicContact } from '../lib/types';
|
||||
import { Avatar, Scanner } from '../components/ui';
|
||||
import { useToast } from '../context/ToastContext';
|
||||
import { useAuth } from '../context/AuthContext';
|
||||
import { adminLinkFailure, adminLinkNotice, isEmailEntry, requestAdminLink } from '../lib/adminEntry';
|
||||
|
||||
type Step = 'splash' | 'scan' | 'confirm';
|
||||
|
||||
export function Login() {
|
||||
const [step, setStep] = useState<Step>('splash');
|
||||
const { authError } = useAuth();
|
||||
const [step, setStep] = useState<Step>(authError ? 'scan' : 'splash');
|
||||
const [qrToken, setQrToken] = useState('');
|
||||
const [found, setFound] = useState<PublicContact | null>(null);
|
||||
const [email, setEmail] = useState('');
|
||||
const [staffPassword, setStaffPassword] = useState('');
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [error, setError] = useState<string | null>(authError);
|
||||
const [entry, setEntry] = useState('');
|
||||
const [sent, setSent] = useState(false);
|
||||
const [cooldown, setCooldown] = useState(0);
|
||||
const requestPending = useRef(false);
|
||||
const { toast } = useToast();
|
||||
|
||||
useEffect(() => {
|
||||
if (!cooldown) return;
|
||||
const timer = window.setTimeout(() => setCooldown((remaining) => remaining - 1), 1000);
|
||||
return () => window.clearTimeout(timer);
|
||||
}, [cooldown]);
|
||||
|
||||
// Staff log in with QR + their admin password; everyone else with QR + email.
|
||||
const isStaff = found?.registration_type === 'staff';
|
||||
|
||||
async function handleScan(text: string) {
|
||||
const token = text.trim();
|
||||
if (!token) return;
|
||||
if (!token || requestPending.current) return;
|
||||
if (isEmailEntry(token)) {
|
||||
if (cooldown) return;
|
||||
requestPending.current = true;
|
||||
setBusy(true);
|
||||
setError(null);
|
||||
setSent(false);
|
||||
try {
|
||||
await requestAdminLink(token);
|
||||
setSent(true);
|
||||
setCooldown(60);
|
||||
} catch {
|
||||
setError(adminLinkFailure);
|
||||
} finally {
|
||||
requestPending.current = false;
|
||||
setBusy(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (token.includes('@')) {
|
||||
setError('Enter a valid email address.');
|
||||
return;
|
||||
}
|
||||
setQrToken(token);
|
||||
setError(null);
|
||||
try {
|
||||
@@ -41,7 +76,7 @@ export function Login() {
|
||||
// Attendees: QR + the ticket email (the QR token is the auth password).
|
||||
const loginEmail = isStaff ? found?.email : email.trim();
|
||||
const loginPassword = isStaff ? staffPassword : qrToken;
|
||||
if (!loginEmail || !loginPassword) return;
|
||||
if (!loginEmail || !loginPassword || busy) return;
|
||||
setBusy(true);
|
||||
setError(null);
|
||||
try {
|
||||
@@ -81,8 +116,18 @@ export function Login() {
|
||||
return (
|
||||
<section className="screen no-tab">
|
||||
<div className="h1">Welcome back 👋</div>
|
||||
<div className="muted small">Scan the QR code on your lanyard to log in.</div>
|
||||
<Scanner onResult={handleScan} label="Point your camera at your lanyard QR" />
|
||||
<Scanner
|
||||
onResult={handleScan}
|
||||
label="Point your camera at your lanyard QR"
|
||||
entryLabel="QR code or admin email"
|
||||
placeholder="QR code or admin email"
|
||||
disabled={busy}
|
||||
submitDisabled={isEmailEntry(entry) && cooldown > 0}
|
||||
submitLabel={busy ? 'Sending...' : isEmailEntry(entry) ? cooldown ? `Resend in ${cooldown}s` : sent ? 'Resend magic link' : 'Send magic link' : 'Go'}
|
||||
onEntryChange={(value) => { setEntry(value); setSent(false); setError(null); }}
|
||||
/>
|
||||
{sent && <p role="status">{adminLinkNotice}</p>}
|
||||
{error && <p role="alert" data-testid="login-error">{error}</p>}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -139,7 +184,7 @@ export function Login() {
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
{error && <div className="muted small" data-testid="login-error" style={{ color: 'var(--red)' }}>{error}</div>}
|
||||
{error && <div role="alert" className="muted small" data-testid="login-error" style={{ color: 'var(--red)' }}>{error}</div>}
|
||||
<button
|
||||
className="btn primary"
|
||||
data-testid="login-confirm"
|
||||
|
||||
@@ -11,7 +11,7 @@ export default defineConfig({
|
||||
host: true,
|
||||
port: 3000,
|
||||
proxy: {
|
||||
'/auth': { target: SUPABASE_TARGET, changeOrigin: true },
|
||||
'/auth/v1': { target: SUPABASE_TARGET, changeOrigin: true },
|
||||
'/rest': { target: SUPABASE_TARGET, changeOrigin: true },
|
||||
'/realtime': { target: SUPABASE_TARGET, changeOrigin: true, ws: true },
|
||||
'/storage': { target: SUPABASE_TARGET, changeOrigin: true },
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const XLSX = require('xlsx');
|
||||
const { createHash } = require('node:crypto');
|
||||
|
||||
function excelSerialToTime(serial, durationMin) {
|
||||
const ms = Math.round((serial - 25569) * 86400 * 1000);
|
||||
@@ -21,13 +22,17 @@ function firstNonempty(row, headers) {
|
||||
|
||||
function transformExcel(buffer) {
|
||||
const workbook = XLSX.read(buffer, { type: 'buffer' });
|
||||
const readRows = (sheetName) => sheetName
|
||||
? XLSX.utils.sheet_to_json(workbook.Sheets[sheetName], { defval: '' }).map((row) =>
|
||||
Object.fromEntries(Object.entries(row).map(([header, value]) => [header.trim().toLowerCase(), value])))
|
||||
: [];
|
||||
const toRows = (kind, otherKind) => {
|
||||
const sheetName = workbook.SheetNames.find((name) =>
|
||||
const sheetNames = workbook.SheetNames.filter((name) =>
|
||||
kind !== 'session' || !name.toLowerCase().includes('service'));
|
||||
const sheetName = sheetNames.find((name) =>
|
||||
name.toLowerCase().includes(kind) && !name.toLowerCase().includes(otherKind))
|
||||
|| workbook.SheetNames.find((name) => name.toLowerCase().includes(kind));
|
||||
if (!sheetName) return [];
|
||||
return XLSX.utils.sheet_to_json(workbook.Sheets[sheetName], { defval: '' }).map((row) =>
|
||||
Object.fromEntries(Object.entries(row).map(([header, value]) => [header.trim().toLowerCase(), value])));
|
||||
|| sheetNames.find((name) => name.toLowerCase().includes(kind));
|
||||
return readRows(sheetName);
|
||||
};
|
||||
|
||||
const speakerById = new Map();
|
||||
@@ -50,21 +55,34 @@ function transformExcel(buffer) {
|
||||
}
|
||||
|
||||
const sessionsById = new Map();
|
||||
for (const row of toRows('session', 'speaker')) {
|
||||
const id = firstNonempty(row, ['Session Id']);
|
||||
const serviceSheet = workbook.SheetNames.find((name) => name.trim().toLowerCase() === 'service sessions');
|
||||
const sessionRows = [
|
||||
...toRows('session', 'speaker').map((row) => ({ row, serviceSheet: false })),
|
||||
...readRows(serviceSheet).map((row) => ({ row, serviceSheet: true })),
|
||||
];
|
||||
for (const entry of sessionRows) {
|
||||
const { row } = entry;
|
||||
const title = firstNonempty(row, ['Title']);
|
||||
const scheduledAt = Number(row['scheduled at']);
|
||||
const duration = Number(row['scheduled duration']);
|
||||
if (!id || !title || !scheduledAt) continue;
|
||||
if (!title || !Number.isFinite(scheduledAt) || scheduledAt <= 0) continue;
|
||||
const isServiceSession = entry.serviceSheet
|
||||
|| /service|break|lunch|closing|plenum/i.test(firstNonempty(row, ['Session Format']));
|
||||
const room = firstNonempty(row, ['Room']) || null;
|
||||
const timing = excelSerialToTime(scheduledAt, Number.isFinite(duration) ? duration : 0);
|
||||
const id = firstNonempty(row, ['Session Id']) || (isServiceSession
|
||||
? `excel-service:${createHash('sha256').update(JSON.stringify([title, room, timing.date, timing.start_time])).digest('hex')}`
|
||||
: '');
|
||||
if (!id) continue;
|
||||
const area = firstNonempty(row, ['Themenfeld / Area of Topic', 'Area', 'Topic']) || null;
|
||||
if (!sessionsById.has(id)) {
|
||||
sessionsById.set(id, {
|
||||
external_id: id,
|
||||
title,
|
||||
description: firstNonempty(row, ['Description']) || null,
|
||||
room: firstNonempty(row, ['Room']) || null,
|
||||
...excelSerialToTime(scheduledAt, duration),
|
||||
is_service_session: /service|break|lunch|closing|plenum/i.test(firstNonempty(row, ['Session Format'])),
|
||||
room,
|
||||
...timing,
|
||||
is_service_session: isServiceSession,
|
||||
level: firstNonempty(row, ['Level']) || null,
|
||||
area,
|
||||
speakers: [],
|
||||
|
||||
@@ -90,3 +90,53 @@ test('service session classification and unscheduled-row filtering remain unchan
|
||||
assert.deepEqual(payload.sessions.map((session) => session.is_service_session), [true, true, true, true, true, false]);
|
||||
assert.ok(payload.sessions.every((session) => session.speakers.length === 0));
|
||||
});
|
||||
|
||||
test('explicit service sheet imports ID-less services alongside flattened talks without duplicates', () => {
|
||||
const service = { Title: 'Arrival & Coffee', Room: 'Main hall', 'Scheduled At': 46305.35416666667,
|
||||
'Scheduled Duration': 30 };
|
||||
const sheets = { 'Accepted sessions and speakers': [{ ...sessionRow, ...speakerRow }],
|
||||
' Service Sessions ': [service, service, { ...service, Title: 'Lunch', 'Scheduled At': 46305.5 },
|
||||
{ ...service, 'Session Id': 'service-existing', Title: 'Opening Keynote' }] };
|
||||
const first = transformSheets(sheets);
|
||||
assert.equal(first.sessions.length, 4);
|
||||
assert.equal(first.speakers.length, 1);
|
||||
assert.deepEqual(first.sessions[0].speakers, ['[email protected]']);
|
||||
assert.equal(first.sessions[0].external_id, 'session-1');
|
||||
const arrival = first.sessions[1];
|
||||
assert.match(arrival.external_id, /^excel-service:[a-f0-9]{64}$/);
|
||||
assert.equal(arrival.start_time, '08:30:00');
|
||||
assert.equal(arrival.end_time, '09:00:00');
|
||||
assert.equal(first.sessions[3].external_id, 'service-existing');
|
||||
for (const session of first.sessions.slice(1)) {
|
||||
assert.equal(session.is_service_session, true);
|
||||
assert.deepEqual(session.speakers, []);
|
||||
}
|
||||
assert.deepEqual(transformSheets(sheets), first);
|
||||
const reordered = transformSheets({ ...sheets, ' Service Sessions ': [...sheets[' Service Sessions ']].reverse() });
|
||||
assert.deepEqual(reordered.sessions.map(session => session.external_id).sort(),
|
||||
first.sessions.map(session => session.external_id).sort());
|
||||
});
|
||||
|
||||
test('ID-less format-marked services import but missing IDs on talks and missing titles never do', () => {
|
||||
const payload = transformSheets({ 'Accepted sessions': [
|
||||
{ ...sessionRow, 'Session Id': '', Title: 'Coffee break', 'Session Format': 'Coffee break' },
|
||||
{ ...sessionRow, 'Session Id': '', Title: 'Talk without ID' },
|
||||
{ ...sessionRow, Title: '', 'Session Format': '' },
|
||||
{ ...sessionRow, Title: '', 'Session Format': 'Service' },
|
||||
{ ...sessionRow, Title: 'Invalid schedule', 'Scheduled At': 'not a date' },
|
||||
] });
|
||||
assert.equal(payload.sessions.length, 1);
|
||||
assert.equal(payload.sessions[0].title, 'Coffee break');
|
||||
assert.equal(payload.sessions[0].is_service_session, true);
|
||||
});
|
||||
|
||||
test('service-only workbook uses title, room, date and start as identity, not duration or row order', () => {
|
||||
const row = { Title: 'Break', Room: 'Hall A', 'Scheduled At': 46305.5, 'Scheduled Duration': 15 };
|
||||
const first = transformSheets({ 'Service sessions': [row] });
|
||||
const edited = transformSheets({ 'Service sessions': [{ ...row, 'Scheduled Duration': 30, Description: 'Updated' }] });
|
||||
assert.equal(first.sessions[0].external_id, edited.sessions[0].external_id);
|
||||
assert.equal(edited.sessions[0].end_time, '12:30:00');
|
||||
const distinct = transformSheets({ 'Service sessions': [row, { ...row, Room: 'Hall B' },
|
||||
{ ...row, 'Scheduled At': 46305.6 }, { ...row, 'Scheduled At': 46306.5 }, { ...row, Title: 'Lunch' }] });
|
||||
assert.equal(new Set(distinct.sessions.map(session => session.external_id)).size, 5);
|
||||
});
|
||||
@@ -28,6 +28,7 @@ system works*; the root [`README.md`](../README.md) is the quick-start.
|
||||
| API client (how the app talks to Supabase) | [frontend/api-client.md](./frontend/api-client.md) |
|
||||
| **Admin console** (views, auth guard, QR reset, points, schedule) | [frontend/admin-app.md](./frontend/admin-app.md) |
|
||||
| **Deployment — VM access (remote host for `appe.at`)** | [deployment.md](./deployment.md) |
|
||||
| **2026-10-10 changes, deployment and verification** | [releases/2026-10-10.md](./releases/2026-10-10.md) |
|
||||
| **What's next (Redesign Phases 3–6 + later + open items)** | [next-steps.md](./next-steps.md) |
|
||||
|
||||
## Reading order
|
||||
|
||||
@@ -139,6 +139,47 @@ from `checkin_attendee`, which checks someone into a specific session).
|
||||
check-in's job).
|
||||
- `already` is `true` if the attendee was already checked in to the event.
|
||||
|
||||
### `merge_tickets(p_source_id, p_target_id)` -> `jsonb`
|
||||
|
||||
Admin-only atomic merge of an imported, QR-less speaker/staff registration into
|
||||
a purchased Pretix registration in the same event. The destination must have a
|
||||
nonempty QR token and Pretix external ID. The source must have
|
||||
`import_source = 'sessionize'`. New Excel imports record this explicitly; legacy
|
||||
QR-less speaker/staff rows with imported contact IDs and no ticket external ID
|
||||
are backfilled as Sessionize imports.
|
||||
|
||||
Locks event, registrations, contacts and session assignments. Inserts destination
|
||||
speaker links before removing source links, preserving the last-speaker invariant.
|
||||
Staff takes precedence over speaker; a destination sponsor registration adopts the
|
||||
transferred role while its separate sponsor record remains intact. Destination QR,
|
||||
email, points and attendance stay unchanged. Deletes only the source registration
|
||||
and its event leaderboard mirror, never the contact/Auth account or another event.
|
||||
Existing attendee activity on the source must be reconciled first; the RPC rejects
|
||||
it rather than losing or duplicating history. Self-merges and merge chains fail.
|
||||
|
||||
The admin-readable, RLS-protected `ticket_merges` table retains an event-scoped
|
||||
source-to-destination mapping and actor/time audit. Excel and API speaker imports
|
||||
resolve that mapping, and later Pretix role updates preserve the merged role.
|
||||
Returns source/destination registration IDs, destination email, role and the count
|
||||
of transferred session assignments. There is no implicit check-in or points award.
|
||||
|
||||
Event registration/check-in aggregates now count only nonblank QR-bearing rows;
|
||||
imported unticketed rows remain visible in Admin but do not increase ticket totals.
|
||||
|
||||
### Assigned Speaker Role
|
||||
|
||||
Registration writes resolve `attendee` to `speaker` whenever the same email has
|
||||
an assignment to a regular `session` in that registration's event. This applies
|
||||
to Pretix ticket inserts/updates, Excel imports and direct Admin changes, so a
|
||||
regular purchased ticket cannot downgrade an assigned speaker on the next sync.
|
||||
Assignments added or updated after ticket import also promote the registration.
|
||||
Staff/sponsor roles retain their existing precedence; service-session links and
|
||||
links in other events do not promote attendees. Unassigned attendees remain
|
||||
attendees. The migration reconciles existing assigned attendees without changing
|
||||
QR tokens, ticket identifiers, attendance, points or session links. Assignments
|
||||
use exact contact email, not fuzzy name matches; different emails require the
|
||||
explicit ticket merge workflow above.
|
||||
|
||||
### `submit_feedback(p_session_id, p_rating, p_comment)` → `(feedback_id, points, earned)`
|
||||
Post-session feedback.
|
||||
- **Requires the caller to be checked in** to that session (else raises).
|
||||
|
||||
+13
-9
@@ -20,15 +20,20 @@ Bootcamp (Austria)** — instead of random demo data:
|
||||
|
||||
| Data | Count | Notes |
|
||||
|---|---|---|
|
||||
| `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'`) |
|
||||
| `auth.users` + `auth.identities` | 4 | Staff only; **`appe-admin-2026`** (staff password) |
|
||||
| `contacts` | 4 | Staff only (`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 |
|
||||
| `registrations` | 4 | Staff only; each with a staff 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 |
|
||||
|
||||
No synthetic attendees or artificial starting points are seeded. Attendee
|
||||
registrations come from purchased Pretix tickets. Removing fixtures from the seed
|
||||
does not delete accounts already present in a database; do not reset a live
|
||||
database to apply this change.
|
||||
|
||||
> **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.
|
||||
@@ -86,17 +91,16 @@ trigger).
|
||||
| **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:** 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.
|
||||
> speakers** — only the 4 staff.
|
||||
|
||||
## Suggested demo flow
|
||||
|
||||
1. Log in as **Amelia** (staff/admin) in the admin app (`[email protected]` /
|
||||
`appe-admin-2026`) → Dashboard shows the real event (54 registrations, 22
|
||||
1. Log in as **Amelia** (staff/admin) in the admin app using an email magic link
|
||||
for `[email protected]` → Dashboard shows the real event (4 registrations, 22
|
||||
sessions).
|
||||
2. **Interfaces → Import Excel** → choose the "Sessions and speakers
|
||||
(advanced)" `.xlsx` → **Import** → the result modal shows the speakers
|
||||
@@ -105,5 +109,5 @@ trigger).
|
||||
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.
|
||||
5. Sync purchased tickets from Pretix, then log in as an **attendee** in the
|
||||
Convivo app using their ticket QR and email → Home/Agenda show the real agenda.
|
||||
+42
-1
@@ -54,7 +54,48 @@ contacts + registrations.
|
||||
Excel rows are grouped by **Session Id** into one session with all distinct
|
||||
speaker emails; repeated speakers are emitted once by email. Separate session
|
||||
and speaker sheets take precedence over a combined sheet if both are present.
|
||||
Sessions without a title, ID, or scheduled time are skipped as before.
|
||||
Talks without a title, ID, or scheduled time are skipped. Service entries still
|
||||
require a nonempty title and a positive numeric Excel scheduled time, but may
|
||||
omit their **Session Id**.
|
||||
|
||||
### Services omitted from the accepted-session export
|
||||
|
||||
The flattened accepted-session export can omit schedule-only services entirely.
|
||||
The supplied 2026-10-09 export was checked read-only: one sheet, 25 rows, 23
|
||||
scheduled rows, 21 importable sessions and **zero service entries**. Its two
|
||||
excluded scheduled rows have IDs but blank titles and formats; they cannot be
|
||||
identified as breaks or placeholders. None of the depicted Arrival & Coffee,
|
||||
Opening Keynote, breaks, Lunch, Coffee or Placeholder entries is recoverable
|
||||
from this workbook. The importer does not invent titles or fill schedule gaps.
|
||||
|
||||
Use the existing **API sync** with an endpoint that actually includes these
|
||||
service entries, or add their real schedule data to a sheet named **Service
|
||||
sessions** (trimmed and case-insensitive) in the uploaded workbook. This explicit
|
||||
sheet is imported alongside either accepted-session format, or on its own. Its
|
||||
rows are always service sessions; no Session Format is required:
|
||||
|
||||
| Header | Value |
|
||||
|---|---|
|
||||
| Title | Required actual service title |
|
||||
| Scheduled At | Required Excel date/time cell (numeric serial, not a date string) |
|
||||
| Scheduled Duration | Duration in minutes; blank defaults to zero |
|
||||
| Room | Optional room name |
|
||||
| Session Id | Optional stable source ID; prefer the actual Sessionize ID when available |
|
||||
| Description | Optional description |
|
||||
|
||||
Alternatively, service rows in the accepted-session sheet can omit Session Id
|
||||
when **Session Format** matches `service`, `break`, `lunch`, `closing` or
|
||||
`plenum`. Titles alone do not classify services: a talk mentioning coffee is
|
||||
not automatically converted.
|
||||
|
||||
For ID-less services, the external ID is `excel-service:` plus a SHA-256 digest
|
||||
of the trimmed title, trimmed room, normalized date and start time. Duplicate
|
||||
rows merge and repeated imports retain the same identity regardless of row
|
||||
order, duration or description edits. Changing title, room, date or start time
|
||||
changes that identity; supply a stable Session Id for entries that may be
|
||||
renamed or rescheduled. Use the same actual source ID across Excel and API
|
||||
imports to avoid two identities for the same service. Services use the existing
|
||||
RPC's service-slot typing and staff assignment; no database migration is needed.
|
||||
|
||||
Topic classification uses the first nonempty value of **Themenfeld / Area of
|
||||
Topic**, **Area**, then **Topic**. Headers are trimmed and matched
|
||||
|
||||
@@ -82,7 +82,7 @@ npx supabase status
|
||||
| `[auth.rate_limit] email_sent` | `100` | Project-wide hourly budget when using custom SMTP; not an entitlement to provider capacity |
|
||||
| `[auth.email] max_frequency` | `60s` | Minimum resend interval, matching the Admin UI cooldown |
|
||||
| `[auth.email] otp_expiry` | `3600` | Magic links expire after one hour and are single-use |
|
||||
| `[auth.email.smtp] enabled` | `true` | Explicit local opt-in to real outbound MXroute email, not Mailpit capture |
|
||||
| `[auth.email.smtp] enabled` | `true` | Explicit local opt-in to real outbound Brevo email, not Mailpit capture |
|
||||
| `[auth.email.smtp] pass` | `env(CONVIVO_SMTP_PASSWORD)` | Password loaded from a private runtime environment, never committed |
|
||||
| `[db.seed] sql_paths` | `["./seed.sql"]` | Seed runs on reset |
|
||||
|
||||
@@ -101,12 +101,19 @@ Hosts, schemes, ports and paths must match; there are no wildcard redirects.
|
||||
For an alternate dev port, explicitly allow its callback URL before testing
|
||||
real email links. Mocked browser tests do not exercise the Auth allowlist.
|
||||
|
||||
Local Auth explicitly opts into **real outbound email** through MXroute:
|
||||
`heracles.mxrouting.net:465`, SMTP user and From address `convivo@lago.dev`,
|
||||
sender name `Convivo APP`. GoTrue's mail transport selects implicit TLS for
|
||||
port 465 and verifies the server certificate; no insecure TLS override is used.
|
||||
The committed configuration opts into **real outbound email** through Brevo:
|
||||
`smtp-relay.brevo.com:587`, From address `info@convivo.appe.at`, sender name
|
||||
`Convivo APP`. The provider-specific SMTP login is configured separately from
|
||||
the From address. Transport uses STARTTLS with certificate verification;
|
||||
no insecure TLS override is used.
|
||||
Mailpit remains available but does not capture these externally delivered emails.
|
||||
|
||||
Production switched to Brevo on 2026-10-10. The local private credential was
|
||||
aligned, but a configuration edit alone does not restart an existing local Auth
|
||||
container. See [the deployment record](../releases/2026-10-10.md) for activation
|
||||
and verification boundaries. The 2026-10-07 notes below describe the earlier
|
||||
MXroute activation, not the current production provider.
|
||||
|
||||
The password is referenced only as `env(CONVIVO_SMTP_PASSWORD)`. On this machine,
|
||||
it is provisioned in the git-ignored `supabase/.env`, with owner-only permissions
|
||||
(`0600`). Supabase CLI **2.115.0** loads dotenv files starting in `supabase/`
|
||||
|
||||
+40
-1
@@ -6,6 +6,31 @@ Supabase Postgres container.
|
||||
|
||||
## Run it
|
||||
|
||||
Assigned-speaker/Pretix role regression tests (rollback-only):
|
||||
|
||||
```bash
|
||||
{ printf 'BEGIN;\n'; cat supabase/migrations/20261009225632_guard_sessionize_dates.sql supabase/migrations/20261010102828_registration_ticket_merge.sql supabase/migrations/20261010111607_preserve_assigned_speaker_role.sql supabase/tests/assigned_speaker_role_tests.sql; } | docker exec -i supabase_db_Convivo psql -X -U postgres -d postgres -v ON_ERROR_STOP=1
|
||||
```
|
||||
|
||||
Covers purchased attendee tickets becoming assigned speakers, assignment before
|
||||
ticket creation, repeated Pretix updates, Excel/Pretix replay, assignment updates,
|
||||
staff/sponsor precedence, service-session exclusion and other-event isolation.
|
||||
QR, ticket ID, check-in and points are preserved.
|
||||
|
||||
Ticket merge regression tests (rollback-only, including prior date-guard functions
|
||||
when the local database has not installed that migration):
|
||||
|
||||
```bash
|
||||
{ printf 'BEGIN;\n'; cat supabase/migrations/20261009225632_guard_sessionize_dates.sql supabase/migrations/20261010102828_registration_ticket_merge.sql supabase/tests/registration_ticket_merge_tests.sql; } | docker exec -i supabase_db_Convivo psql -X -U postgres -d postgres -v ON_ERROR_STOP=1
|
||||
CONVIVO_ADMIN_URL=http://127.0.0.1:3001 npm test --prefix e2e -- registration-ticket-merge.spec.ts --project=chromium
|
||||
```
|
||||
|
||||
Coverage includes ticket-only totals, authorization, cross-event isolation,
|
||||
last-speaker-safe transfers, duplicate assignments, staff precedence, retained
|
||||
ticket points/QR/check-in, source activity rejection, import provenance and
|
||||
Excel/API replay. Browser tests cover immediate check-in feedback and failure
|
||||
rollback, imported-only merge buttons, suggestions, manual choice, cancel/retry.
|
||||
|
||||
```bash
|
||||
npm run db:start # the Supabase core must be running
|
||||
npm run test:rpc # runs supabase/tests/rpc_tests.sql, exits non-zero on failure
|
||||
@@ -149,7 +174,21 @@ matching, nonempty Area/Topic fallback, complete comma-separated topic strings,
|
||||
flattened multi-speaker session grouping, duplicate speaker IDs/emails, singular
|
||||
Speaker Id fallback, legacy two-sheet plural Speaker Ids, scheduled time and
|
||||
metadata preservation, service-session classification, and unscheduled-row
|
||||
filtering. See [supported Excel formats](./sidecar.md#what-it-does).
|
||||
filtering. Generated XLSX service regressions also cover an explicit service
|
||||
sheet alongside flattened talks, a service-only workbook, missing-ID service
|
||||
classification, duplicate service rows, stable generated IDs across repeated
|
||||
parses and row reordering, unchanged IDs after duration/description edits,
|
||||
distinct identities by title/room/date/start, preservation of explicit source
|
||||
IDs, and exclusion of untitled, invalid-time and ID-less talk rows. See
|
||||
[service export limitations and accepted service format](./sidecar.md#services-omitted-from-the-accepted-session-export).
|
||||
|
||||
Read-only validation of the supplied 2026-10-09 workbook compared its complete
|
||||
parsed payload against the committed parser: unchanged 21 sessions, 24 speakers,
|
||||
21 speaker links and zero service sessions. Parsing twice produced identical
|
||||
payloads. No HTTP import or database writes were performed. Parser repeatability
|
||||
and the existing RPC external-ID upsert contract support idempotent imports;
|
||||
these database-free checks do not verify a live import or prove that any
|
||||
configured API endpoint includes the services missing from Excel.
|
||||
|
||||
## Files
|
||||
|
||||
|
||||
@@ -166,6 +166,21 @@ The Schedule view uploads a session's material to the `materials` bucket and set
|
||||
button calls `evaluate_session_feedback` (the AI stub) to set
|
||||
`ai_generated_feedback`.
|
||||
|
||||
### Registration Tickets
|
||||
|
||||
Registration totals and check-in totals exclude blank/missing QR tokens. Unticketed
|
||||
rows remain listed separately. Check-in toggles update immediately, disable during
|
||||
the request and restore their previous value on failure, without a page refresh.
|
||||
|
||||
**Merge tickets** appears only on QR-less Sessionize-imported registration rows.
|
||||
Its modal ranks purchased tickets from the same event by matching name words,
|
||||
including accent normalization, and allows searching/selecting any purchased
|
||||
ticket regardless of whether its name matches. Nothing merges until confirmation.
|
||||
The destination keeps its QR/email, attendance and points; session assignments and
|
||||
the speaker/staff role transfer before deleting the imported registration. Contact
|
||||
and Auth records and other events are preserved. Source attendee activity requires
|
||||
manual reconciliation before merging. See [the RPC contract](../backend/rpcs.md).
|
||||
|
||||
### Delete current schedule
|
||||
|
||||
The Schedule view keeps the existing active-event selection pattern: it loads
|
||||
|
||||
@@ -18,7 +18,7 @@ export const supabase = createClient(url, anonKey, {
|
||||
|
||||
- **Same-origin by default.** `VITE_SUPABASE_URL` is intentionally left unset, so
|
||||
the client uses `window.location.origin`. The app is served behind a proxy
|
||||
(Vite dev server, or nginx in Docker) that forwards `/auth`, `/rest`,
|
||||
(Vite dev server, or nginx in Docker) that forwards `/auth/v1`, `/rest`,
|
||||
`/realtime`, `/storage` to the Supabase core. This avoids CORS entirely. See
|
||||
[../backend/docker.md](../backend/docker.md).
|
||||
- **Anon key only.** The client is created with the **anon key** (public). The
|
||||
@@ -82,6 +82,51 @@ client-side to avoid leaking other people's data:
|
||||
- **`sessionMaterialUrl(path)`** — builds the public URL for a session material
|
||||
in the `materials` bucket.
|
||||
|
||||
## Admin Email Entry
|
||||
|
||||
[adminEntry.ts](../../apps/convivo/src/lib/adminEntry.ts) handles email requests
|
||||
and the normal app's verified session profile. Before sending, it calls the
|
||||
read-only `can_request_admin_magic_link(p_email)` RPC. Eligibility requires both
|
||||
an existing Auth user and a contact authorized by the existing admin rule
|
||||
(`is_admin` flag or an `@appe.at` contact). Ineligible addresses do not trigger
|
||||
an OTP request. Eligible addresses use `signInWithOtp` with
|
||||
`shouldCreateUser: false` and
|
||||
`emailRedirectTo: window.location.origin + '/auth/callback'`.
|
||||
|
||||
Deployment requires
|
||||
[the eligibility migration](../../supabase/migrations/20261010093021_admin_magic_link_eligibility.sql)
|
||||
and an Auth redirect allowlist entry for
|
||||
`https://convivo.appe.at/auth/callback` (plus the corresponding URL for each
|
||||
development origin). These are deployment prerequisites, not automatic frontend
|
||||
configuration. Vite serves the callback as an SPA route rather than proxying it
|
||||
to Auth; nginx uses an exact callback location with no access logging, no-store
|
||||
caching and no-referrer policy. The document also sets no-referrer before assets
|
||||
load.
|
||||
|
||||
The callback accepts implicit token pairs or a PKCE code exactly once per page
|
||||
load, including StrictMode, and removes callback credentials from the address
|
||||
bar before network calls. `getUser(access_token)` verifies identity at the Auth
|
||||
server; `is_admin()` authorizes admin entry independently of editable metadata.
|
||||
Failed callbacks sign out locally. Normal restored/QR sessions also verify the
|
||||
user and admin role. Contact reads use the verified email; registration reads
|
||||
filter by both that email and the active event, returning null when absent.
|
||||
Admins need no registration or attendance state to use Convivo's existing staff
|
||||
experience. This login path performs no registration, attendance or points
|
||||
mutations.
|
||||
|
||||
Privacy boundary: the screen gives identical confirmations for eligible and
|
||||
ineligible addresses and suppresses account-existence errors from OTP. However,
|
||||
the public eligibility RPC returns a boolean that direct callers can inspect;
|
||||
it is not enumeration-resistant. This gates this UI's sends, not direct calls
|
||||
to Supabase Auth's OTP endpoint. The callback's server-backed admin check remains
|
||||
the access boundary.
|
||||
|
||||
Mocked browser regressions are in
|
||||
[convivo-admin-entry.spec.ts](../../e2e/tests/convivo-admin-entry.spec.ts);
|
||||
[SQL regressions](../../supabase/tests/admin_magic_link_eligibility_tests.sql)
|
||||
use rollback fixtures to check eligibility, grants and unchanged attendance
|
||||
data. Neither suite sends real OTP email.
|
||||
|
||||
## Speaker Portal
|
||||
|
||||
[speakerPortal.ts](../../apps/convivo/src/lib/speakerPortal.ts) recognizes only
|
||||
|
||||
@@ -52,7 +52,8 @@ uses the normal app's check-in gate. See [portal API behavior](./api-client.md#s
|
||||
|
||||
## Login
|
||||
|
||||
A 3-step flow: **splash → scan → confirm**.
|
||||
A QR flow (**splash → scan → confirm**) and an admin email branch share the
|
||||
same entry field.
|
||||
|
||||
1. **Splash** — "APPE / Break the ice. Earn the points." Tap anywhere to continue.
|
||||
2. **Scan** — scan (or type) your lanyard QR. Calls `lanyardLookup(qrToken)` to
|
||||
@@ -71,9 +72,27 @@ A 3-step flow: **splash → scan → confirm**.
|
||||
mismatch, an error is shown ("Email and QR code do not match" for attendees,
|
||||
"That password is incorrect" for staff).
|
||||
|
||||
> This normal QR login sends no email; the separate speaker portal uses magic links. See
|
||||
> [../architecture.md#6-authentication-model](../architecture.md#6-authentication-model)
|
||||
> and [../backend/rls.md](../backend/rls.md).
|
||||
Entering a valid email instead of a QR requests a magic link only when the
|
||||
address belongs to an existing Auth user with server-backed admin eligibility.
|
||||
Whitespace and case are normalized; malformed emails show a validation error
|
||||
without a QR lookup. Enter submits the field. Sending locks controls; a
|
||||
successful request starts a 60-second resend cooldown, while QR entry remains
|
||||
available. Eligible and ineligible addresses receive the same confirmation.
|
||||
Network and rate-limit failures show a generic recoverable error.
|
||||
|
||||
The `/auth/callback` route verifies the Auth user and calls `is_admin()` before
|
||||
admitting the session. Editable user metadata is not an authorization source.
|
||||
Invalid, expired and non-admin callbacks clear the local session and return to
|
||||
the entry field. Tokens/codes are scrubbed before auth calls, and callback
|
||||
consumption is shared across StrictMode mounts.
|
||||
|
||||
Admins stay in Convivo with its existing Staff scan mode; there is no redirect
|
||||
to the admin domain and no registration or physical check-in requirement for
|
||||
admins. Login does not create accounts, registrations, attendance or points.
|
||||
Attendee QR login retains its checked-in gate and staff QR login retains its
|
||||
password confirmation. The separate speaker portal remains independent. See
|
||||
[admin entry API behavior](./api-client.md#admin-email-entry) and
|
||||
[authorization](../backend/rls.md).
|
||||
|
||||
## Home
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
# Release: 2026-10-10
|
||||
|
||||
## Changes
|
||||
|
||||
- Attendee entry accepts an existing administrator's email and requests an
|
||||
existing-user-only magic link. The callback verifies the user and server-side
|
||||
admin rule; an event ticket is not required for this entry. Exact callback
|
||||
allowlisting and token scrubbing are retained. See
|
||||
[screens](../frontend/screens.md) and [API client](../frontend/api-client.md).
|
||||
- Excel import accepts explicit service-session sheets and marked ID-less
|
||||
service rows with stable generated identities. The supplied workbook has no
|
||||
service rows, so these cannot be inferred from it. See
|
||||
[sidecar import formats](../backend/sidecar.md).
|
||||
- Registration totals exclude blank QR tokens. Check-in toggles update
|
||||
immediately and restore the old value on failure. Imported unticketed rows
|
||||
offer an explicit merge into a purchased ticket, with name-ranked suggestions
|
||||
and manual selection. Assignments transfer before source deletion. Ticket QR,
|
||||
points and check-in are preserved; contacts, Auth users and other events remain.
|
||||
Import replay resolves the persistent mapping. See
|
||||
[Admin](../frontend/admin-app.md) and [RPC contracts](../backend/rpcs.md).
|
||||
- Assigned speakers cannot be downgraded to attendee by later Pretix imports.
|
||||
Exact email and regular-session assignment in the same event determine the
|
||||
promotion. Both import orders are supported; staff/sponsor precedence remains.
|
||||
Service-only and other-event links do not promote attendees. Twelve incorrectly
|
||||
classified production registrations were reconciled, including Martin P Lopez.
|
||||
- Removed all fifty fabricated attendee seed accounts, identities, contacts,
|
||||
registrations and artificial points entries. Staff and schedule seeds remain
|
||||
unchanged. Existing accounts are not deleted by editing the seed. See
|
||||
[seed data](../backend/seed.md).
|
||||
- Production magic-link mail now uses Brevo STARTTLS on port 587 with From
|
||||
`[email protected]`. Credentials remain outside Git. TLS and authentication
|
||||
were verified without sending email; inbox delivery is not proven by that
|
||||
check. See [SMTP configuration](../backend/supabase-core.md).
|
||||
|
||||
## Migrations
|
||||
|
||||
All three migrations were applied in production with migration-ledger entries:
|
||||
|
||||
- `20261010093021_admin_magic_link_eligibility`
|
||||
- `20261010102828_registration_ticket_merge`
|
||||
- `20261010111607_preserve_assigned_speaker_role`
|
||||
|
||||
Reapply neither installed migrations nor the seed during a redeployment. The
|
||||
seed is a future-initialization fixture, not a production cleanup procedure.
|
||||
|
||||
## Deployment
|
||||
|
||||
Production runs at https://convivo.appe.at and https://admin.appe.at. The VM is a
|
||||
flat-copy workspace without Git and predates some unrelated local Reports code.
|
||||
Deploy scoped source changes against the actual VM baseline, never overwrite
|
||||
shared API/server files wholesale. Preserve private runtime dotenv/config files,
|
||||
Auth signing/issuer settings and database volumes. Rebuild only the requested
|
||||
application services; do not restart the core or run resets/imports/email tests.
|
||||
|
||||
Private database/source/config backups exist under
|
||||
`/home/APPE/convivo-backups/`, including:
|
||||
|
||||
- `entry-20261010T094841Z`: admin-email entry and service parser.
|
||||
- `brevo-20261010T102723Z`: SMTP activation and Auth rollback container.
|
||||
- `registration-20261010T110534Z`: toggle/merge and migration.
|
||||
- `speaker-role-20261010T111804Z`: assigned-speaker reconciliation.
|
||||
- `release-20261010T112631Z`: final app-only rebuild, database/source backup,
|
||||
rollback image tags and private preservation checks.
|
||||
|
||||
The final redeployment completed successfully. It rebuilt
|
||||
the three app images from their verified VM source, and copied this release's
|
||||
nonsecret documentation, migration sources and revised seed without executing it.
|
||||
Use the saved image tags/source archive for application rollback. Database
|
||||
rollback requires reviewing concurrent changes; never restore a production dump
|
||||
blindly or remove a merge mapping after users have merged real tickets.
|
||||
|
||||
## Verification
|
||||
|
||||
- Attendee/Admin builds, browser-test TypeScript, and generated-workbook parser
|
||||
tests pass locally.
|
||||
- Mocked browser tests cover admin email entry, eligibility, callback handling,
|
||||
immediate check-in feedback, rollback, merge suggestions, selection, cancel
|
||||
and retry. All 35 tests pass against the final production bundles with API mocks.
|
||||
- Rollback-only SQL tests cover admin eligibility, atomic ticket transfers,
|
||||
source activity rejection, role priority, event isolation, Excel/API replay,
|
||||
and Pretix/Excel speaker-role persistence. See [commands](../backend/tests.md).
|
||||
- Production migration checks retained ticket/activity fields and speaker links;
|
||||
speaker reconciliation changed only the expected role fields.
|
||||
- Final redeployment retained every core container ID/start time and the counts
|
||||
of registrations, contacts, speaker assignments, Auth users, sessions and
|
||||
storage objects. All three rollback-only SQL suites and nine isolated-image
|
||||
parser tests passed after rebuilding.
|
||||
- Public roots, callbacks, assets, sidecar and Auth health are checked after
|
||||
redeployment. No real email send, import or ticket merge is needed to verify
|
||||
deployment. Shared authenticated-browser inspection was unavailable; API-mocked
|
||||
browser tests and direct production checks were used instead.
|
||||
|
||||
## Credential Handling
|
||||
|
||||
The private SMTP instructions are ignored by Git. Earlier diagnostic output
|
||||
exposed the SMTP credential; rotation remains required and has not been performed.
|
||||
Never print credential-bearing deployment documents, environment dumps or Auth
|
||||
container inspection data. Commit only allowlisted source/docs/tests/config
|
||||
references, not runtime credentials or private backup artifacts.
|
||||
@@ -0,0 +1,361 @@
|
||||
import { test, expect, type Page } from '@playwright/test';
|
||||
|
||||
const appUrl = process.env.CONVIVO_BASE_URL || 'http://localhost:3000';
|
||||
const notice = 'If this email belongs to an eligible admin account, a sign-in link has been sent.';
|
||||
const invalidLink = 'This sign-in link is invalid or expired. Please request a new link.';
|
||||
|
||||
function mockSession(email: string) {
|
||||
const user = {
|
||||
id: '11111111-1111-4111-8111-111111111111', aud: 'authenticated', role: 'authenticated', email,
|
||||
app_metadata: {}, user_metadata: { is_admin: true }, created_at: '2026-01-01T00:00:00Z',
|
||||
};
|
||||
const payload = Buffer.from(JSON.stringify({ sub: user.id, exp: Math.floor(Date.now() / 1000) + 3600 })).toString('base64url');
|
||||
return { user, access_token: `eyJhbGciOiJIUzI1NiJ9.${payload}.test-signature`, refresh_token: 'mock-refresh-token', token_type: 'bearer', expires_in: 3600 };
|
||||
}
|
||||
|
||||
async function mockApi(page: Page, options: { email?: string; admin?: boolean; registered?: boolean; checkedIn?: boolean; staff?: boolean } = {}) {
|
||||
const email = options.email || '[email protected]';
|
||||
const session = mockSession(email);
|
||||
const calls = { users: 0, exchanges: 0, passwords: 0, logouts: 0, otp: 0, lanyards: 0, mutations: [] as string[] };
|
||||
await page.route('**/auth/v1/**', async (route) => {
|
||||
const url = new URL(route.request().url());
|
||||
if (url.pathname.endsWith('/user')) {
|
||||
calls.users++;
|
||||
await route.fulfill({ json: session.user });
|
||||
} else if (url.pathname.endsWith('/token')) {
|
||||
if (url.searchParams.get('grant_type') === 'pkce') calls.exchanges++;
|
||||
if (url.searchParams.get('grant_type') === 'password') calls.passwords++;
|
||||
await route.fulfill({ json: session });
|
||||
} else if (url.pathname.endsWith('/logout')) {
|
||||
calls.logouts++;
|
||||
await route.fulfill({ status: 204 });
|
||||
} else {
|
||||
if (url.pathname.endsWith('/otp')) calls.otp++;
|
||||
await route.fulfill({ json: {} });
|
||||
}
|
||||
});
|
||||
await page.route('**/rest/v1/**', async (route) => {
|
||||
const request = route.request();
|
||||
const pathname = new URL(request.url()).pathname;
|
||||
const readRpc = /\/(is_admin|can_request_admin_magic_link|lanyard_lookup|get_[a-z_]+)$/.test(pathname);
|
||||
if (request.method() !== 'GET' && !readRpc) calls.mutations.push(pathname);
|
||||
if (pathname.endsWith('/rpc/can_request_admin_magic_link')) {
|
||||
expect(request.postDataJSON()).toEqual({ p_email: email.toLowerCase() });
|
||||
await route.fulfill({ json: options.admin !== false });
|
||||
}
|
||||
else if (pathname.endsWith('/rpc/is_admin')) await route.fulfill({ json: options.admin !== false });
|
||||
else if (pathname.endsWith('/contacts')) await route.fulfill({ json: { email, full_name: 'Test Member', is_admin: false, show_email: false, show_linkedin: false } });
|
||||
else if (pathname.endsWith('/registrations')) {
|
||||
expect(new URL(request.url()).searchParams.get('event_id')).toBe('eq.33333333-3333-4333-8333-333333333333');
|
||||
await route.fulfill({ json: options.registered ? {
|
||||
id: '22222222-2222-4222-8222-222222222222', event_id: '33333333-3333-4333-8333-333333333333',
|
||||
contact_email: email, type: options.staff ? 'staff' : 'attendee', checked_in: !!options.checkedIn, points: 0, qr_token: 'CVV-TEST-1234',
|
||||
} : null });
|
||||
}
|
||||
else if (pathname.endsWith('/events')) await route.fulfill({ json: {
|
||||
id: '33333333-3333-4333-8333-333333333333', name: 'Test Event', is_active: true,
|
||||
start_date: '2026-02-20', end_date: '2026-02-20', use_realtime_clock: false,
|
||||
} });
|
||||
else if (pathname.endsWith('/rpc/lanyard_lookup')) {
|
||||
calls.lanyards++;
|
||||
expect(request.postDataJSON()).toEqual({ p_qr_token: 'CVV-TEST-1234' });
|
||||
await route.fulfill({ json: [{ email, full_name: 'Test Member', registration_type: options.staff ? 'staff' : 'attendee' }] });
|
||||
} else await route.fulfill({ json: [] });
|
||||
});
|
||||
return { session, calls };
|
||||
}
|
||||
|
||||
async function openEntry(page: Page) {
|
||||
await page.goto(appUrl);
|
||||
await page.getByTestId('login-splash').click();
|
||||
await expect(page.getByLabel('QR code or admin email')).toBeVisible();
|
||||
}
|
||||
|
||||
test.describe('Convivo admin email entry', () => {
|
||||
for (const email of ['[email protected]', '[email protected]', '[email protected]']) {
|
||||
test(`ineligible ${email} gets private confirmation without OTP`, async ({ page }) => {
|
||||
const { calls } = await mockApi(page, { email, admin: false });
|
||||
await openEntry(page);
|
||||
await page.getByLabel('QR code or admin email').fill(email);
|
||||
await page.getByLabel('QR code or admin email').press('Enter');
|
||||
await expect(page.getByRole('status')).toHaveText(notice);
|
||||
expect(calls.otp).toBe(0);
|
||||
expect(calls.lanyards).toBe(0);
|
||||
expect(calls.mutations).toEqual([]);
|
||||
});
|
||||
}
|
||||
|
||||
test('eligibility server failure never sends OTP', async ({ page }) => {
|
||||
const { calls } = await mockApi(page);
|
||||
await page.route('**/rest/v1/rpc/can_request_admin_magic_link', (route) => route.fulfill({ status: 401, json: { message: 'Sensitive eligibility detail' } }));
|
||||
await openEntry(page);
|
||||
await page.getByLabel('QR code or admin email').fill('[email protected]');
|
||||
await page.getByTestId('scanner-manual-go').click();
|
||||
await expect(page.getByRole('alert')).toHaveText('Unable to send a sign-in link right now. Please try again later.');
|
||||
expect(calls.otp).toBe(0);
|
||||
await expect(page.getByText('Sensitive eligibility detail')).toHaveCount(0);
|
||||
});
|
||||
|
||||
for (const responseStatus of [400, 422, 429, 500]) {
|
||||
test(`OTP response ${responseStatus} stays generic and recoverable`, async ({ page }) => {
|
||||
await mockApi(page);
|
||||
await page.route('**/auth/v1/otp**', (route) => route.fulfill({ status: responseStatus, json: { message: 'Sensitive account detail' } }));
|
||||
await openEntry(page);
|
||||
await page.getByLabel('QR code or admin email').fill('[email protected]');
|
||||
await page.getByTestId('scanner-manual-go').click();
|
||||
if (responseStatus === 400 || responseStatus === 422) {
|
||||
await expect(page.getByRole('status')).toHaveText(notice);
|
||||
} else {
|
||||
await expect(page.getByRole('alert')).toHaveText('Unable to send a sign-in link right now. Please try again later.');
|
||||
await expect(page.getByTestId('scanner-manual-go')).toBeEnabled();
|
||||
}
|
||||
await expect(page.getByText('Sensitive account detail')).toHaveCount(0);
|
||||
await expect(page.getByLabel('QR code or admin email')).toBeEnabled();
|
||||
});
|
||||
}
|
||||
|
||||
test('same field requests an admin-only link, normalizes email, supports keyboard and resend', async ({ page }) => {
|
||||
const { calls } = await mockApi(page);
|
||||
await page.clock.install();
|
||||
let sends = 0;
|
||||
await page.route('**/auth/v1/otp**', async (route) => {
|
||||
sends++;
|
||||
expect(route.request().postDataJSON()).toMatchObject({ email: '[email protected]', create_user: false });
|
||||
expect(new URL(route.request().url()).searchParams.get('redirect_to')).toBe(`${appUrl}/auth/callback`);
|
||||
await route.fulfill({ status: 202, json: { ok: true } });
|
||||
});
|
||||
await openEntry(page);
|
||||
const entry = page.getByLabel('QR code or admin email');
|
||||
await expect(entry).toHaveAttribute('type', 'text');
|
||||
await entry.fill(' [email protected] ');
|
||||
await expect(page.getByTestId('scanner-manual-go')).toHaveText('Send magic link');
|
||||
await entry.press('Enter');
|
||||
await expect(page.getByRole('status')).toHaveText(notice);
|
||||
await expect(page.getByRole('button', { name: 'Resend in 60s' })).toBeDisabled();
|
||||
await expect(entry).toBeEnabled();
|
||||
await page.clock.runFor(60_000);
|
||||
await page.getByRole('button', { name: 'Resend magic link', exact: true }).click();
|
||||
await expect(page.getByRole('button', { name: 'Resend in 60s' })).toBeDisabled();
|
||||
expect(sends).toBe(2);
|
||||
expect(calls.otp).toBe(0);
|
||||
expect(calls.lanyards).toBe(0);
|
||||
expect(calls.passwords).toBe(0);
|
||||
});
|
||||
|
||||
test('pending send locks controls and failed resend clears the sent state', async ({ page }) => {
|
||||
await mockApi(page);
|
||||
await page.clock.install();
|
||||
let release!: () => void;
|
||||
const pending = new Promise<void>((resolve) => { release = resolve; });
|
||||
let sends = 0;
|
||||
await page.route('**/auth/v1/otp**', async (route) => {
|
||||
sends++;
|
||||
if (sends === 1) { await pending; await route.fulfill({ status: 202, json: {} }); }
|
||||
else await route.fulfill({ status: 503, json: { error: 'Sensitive server detail' } });
|
||||
});
|
||||
await openEntry(page);
|
||||
await page.getByLabel('QR code or admin email').fill('[email protected]');
|
||||
await page.getByTestId('scanner-manual-go').click();
|
||||
await expect(page.getByLabel('QR code or admin email')).toBeDisabled();
|
||||
await expect(page.getByRole('button', { name: 'Sending...' })).toBeDisabled();
|
||||
release();
|
||||
await expect(page.getByRole('status')).toHaveText(notice);
|
||||
await page.clock.runFor(60_000);
|
||||
await page.getByRole('button', { name: 'Resend magic link', exact: true }).click();
|
||||
await expect(page.getByRole('alert')).toHaveText('Unable to send a sign-in link right now. Please try again later.');
|
||||
await expect(page.getByRole('status')).toHaveCount(0);
|
||||
await expect(page.getByTestId('scanner-manual-go')).toBeEnabled();
|
||||
await expect(page.getByText('Sensitive server detail')).toHaveCount(0);
|
||||
});
|
||||
|
||||
test('invalid email and network failures are recoverable without QR lookup', async ({ page }) => {
|
||||
const { calls } = await mockApi(page);
|
||||
await page.route('**/auth/v1/otp**', (route) => route.abort());
|
||||
await openEntry(page);
|
||||
const entry = page.getByLabel('QR code or admin email');
|
||||
await entry.fill('admin@');
|
||||
await entry.press('Enter');
|
||||
await expect(page.getByRole('alert')).toHaveText('Enter a valid email address.');
|
||||
await entry.fill('[email protected]');
|
||||
await entry.press('Enter');
|
||||
await expect(page.getByRole('alert')).toHaveText('Unable to send a sign-in link right now. Please try again later.');
|
||||
await expect(entry).toBeEnabled();
|
||||
expect(calls.lanyards).toBe(0);
|
||||
expect(calls.otp).toBe(0);
|
||||
});
|
||||
|
||||
for (const registered of [false, true]) {
|
||||
test(`verified admin callback enters Convivo with registered=${registered}, without attendance writes`, async ({ page }) => {
|
||||
const { session, calls } = await mockApi(page, { registered, checkedIn: false });
|
||||
await page.goto(`${appUrl}/auth/callback?next=https://example.org#access_token=${session.access_token}&refresh_token=${session.refresh_token}&type=magiclink`);
|
||||
await expect(page.getByTestId('tab-home')).toBeVisible();
|
||||
await expect(page.getByTestId('checkin-required-gate')).toHaveCount(0);
|
||||
await expect(page).toHaveURL(`${appUrl}/`);
|
||||
await page.getByTestId('tab-scan').click();
|
||||
await expect(page.getByTestId('scan-mode-staff')).toBeVisible();
|
||||
await page.reload();
|
||||
await expect(page.getByTestId('tab-home')).toBeVisible();
|
||||
expect(calls.users).toBeGreaterThan(0);
|
||||
expect(calls.passwords).toBe(0);
|
||||
expect(calls.lanyards).toBe(0);
|
||||
expect(calls.mutations).toEqual([]);
|
||||
});
|
||||
}
|
||||
|
||||
for (const email of ['[email protected]', '[email protected]', '[email protected]']) {
|
||||
test(`server denies non-admin callback ${email} despite editable admin metadata`, async ({ page }) => {
|
||||
const { session, calls } = await mockApi(page, { email, admin: false, registered: true, checkedIn: true });
|
||||
await page.goto(`${appUrl}/auth/callback#access_token=${session.access_token}&refresh_token=${session.refresh_token}&type=magiclink`);
|
||||
await expect(page.getByRole('alert')).toHaveText('This account is not an admin.');
|
||||
await expect(page.getByTestId('tab-home')).toHaveCount(0);
|
||||
await expect(page).toHaveURL(`${appUrl}/`);
|
||||
expect(calls.logouts).toBe(1);
|
||||
expect(calls.mutations).toEqual([]);
|
||||
expect(await page.evaluate(() => Object.keys(localStorage).filter((key) => key.endsWith('-auth-token')))).toEqual([]);
|
||||
});
|
||||
}
|
||||
|
||||
test('code exchange is consumed once under StrictMode and scrubbed', async ({ page }) => {
|
||||
const { calls } = await mockApi(page);
|
||||
await page.goto(`${appUrl}/auth/callback?code=mock-code&redirect_to=https://example.org`);
|
||||
await expect(page.getByTestId('tab-home')).toBeVisible();
|
||||
await expect(page).toHaveURL(`${appUrl}/`);
|
||||
expect(calls.exchanges).toBe(1);
|
||||
});
|
||||
|
||||
test('root callback also rejects non-admins and removes callback credentials', async ({ page }) => {
|
||||
const { session } = await mockApi(page, { admin: false, registered: true, checkedIn: true });
|
||||
await page.goto(`${appUrl}/#access_token=${session.access_token}&refresh_token=${session.refresh_token}&type=magiclink`);
|
||||
await expect(page.getByRole('alert')).toHaveText('This account is not an admin.');
|
||||
await expect(page).toHaveURL(`${appUrl}/`);
|
||||
await expect(page.getByTestId('tab-home')).toHaveCount(0);
|
||||
});
|
||||
|
||||
test('denied callback clears local credentials even when logout fails', async ({ page }) => {
|
||||
const { session } = await mockApi(page, { admin: false, registered: true, checkedIn: true });
|
||||
await page.route('**/auth/v1/logout**', (route) => route.fulfill({ status: 500, json: { message: 'Logout unavailable' } }));
|
||||
await page.goto(`${appUrl}/auth/callback#access_token=${session.access_token}&refresh_token=${session.refresh_token}&type=magiclink`);
|
||||
await expect(page.getByRole('alert')).toHaveText('This account is not an admin.');
|
||||
expect(await page.evaluate(() => Object.keys(localStorage).filter((key) => key.endsWith('-auth-token')))).toEqual([]);
|
||||
await page.reload();
|
||||
await expect(page.getByTestId('tab-home')).toHaveCount(0);
|
||||
await expect(page.getByTestId('login-splash')).toBeVisible();
|
||||
});
|
||||
|
||||
test('rejected exchange clears an existing local session and offers a fresh request', async ({ page }) => {
|
||||
const { session } = await mockApi(page);
|
||||
await page.goto(`${appUrl}/auth/callback#access_token=${session.access_token}&refresh_token=${session.refresh_token}&type=magiclink`);
|
||||
await expect(page.getByTestId('tab-home')).toBeVisible();
|
||||
await page.route('**/auth/v1/token**', (route) => route.fulfill({ status: 400, json: { error: 'invalid_grant', error_description: 'Sensitive exchange detail' } }));
|
||||
await page.goto(`${appUrl}/auth/callback?code=expired-code`);
|
||||
await expect(page.getByRole('alert')).toHaveText(invalidLink);
|
||||
await expect(page).toHaveURL(`${appUrl}/`);
|
||||
expect(await page.evaluate(() => Object.keys(localStorage).filter((key) => key.endsWith('-auth-token')))).toEqual([]);
|
||||
await page.getByLabel('QR code or admin email').fill('[email protected]');
|
||||
await page.getByRole('button', { name: 'Send magic link', exact: true }).click();
|
||||
await expect(page.getByRole('status')).toHaveText(notice);
|
||||
await expect(page.getByRole('alert')).toHaveCount(0);
|
||||
await expect(page.getByText('Sensitive exchange detail')).toHaveCount(0);
|
||||
});
|
||||
|
||||
for (const endpoint of ['user', 'is_admin', 'contacts']) {
|
||||
test(`callback stays denied when server ${endpoint} verification fails`, async ({ page }) => {
|
||||
const { session, calls } = await mockApi(page);
|
||||
const path = endpoint === 'user' ? '**/auth/v1/user' : endpoint === 'is_admin' ? '**/rest/v1/rpc/is_admin' : '**/rest/v1/contacts**';
|
||||
await page.route(path, (route) => route.fulfill({ status: 401, json: { message: 'Sensitive authorization detail' } }));
|
||||
await page.goto(`${appUrl}/auth/callback#access_token=${session.access_token}&refresh_token=${session.refresh_token}&type=magiclink`);
|
||||
await expect(page.getByRole('alert')).toHaveText(invalidLink);
|
||||
await expect(page.getByTestId('tab-home')).toHaveCount(0);
|
||||
await expect(page).toHaveURL(`${appUrl}/`);
|
||||
expect(calls.mutations).toEqual([]);
|
||||
await expect(page.getByText('Sensitive authorization detail')).toHaveCount(0);
|
||||
});
|
||||
}
|
||||
|
||||
test('staff QR still requires the staff password and enables staff mode', async ({ page }) => {
|
||||
const { calls } = await mockApi(page, { staff: true, registered: true, checkedIn: false });
|
||||
await page.route('**/auth/v1/token**', async (route) => {
|
||||
expect(route.request().postDataJSON()).toMatchObject({ email: '[email protected]', password: 'mock-staff-password' });
|
||||
calls.passwords++;
|
||||
await route.fulfill({ json: mockSession('[email protected]') });
|
||||
});
|
||||
await openEntry(page);
|
||||
await page.getByLabel('QR code or admin email').fill('CVV-TEST-1234');
|
||||
await page.getByLabel('QR code or admin email').press('Enter');
|
||||
await expect(page.getByTestId('staff-login-password')).toBeVisible();
|
||||
await expect(page.getByTestId('login-confirm')).toBeDisabled();
|
||||
await page.getByTestId('staff-login-password').fill('mock-staff-password');
|
||||
await page.getByTestId('staff-login-password').press('Enter');
|
||||
await expect(page.getByTestId('tab-home')).toBeVisible();
|
||||
await page.getByTestId('tab-scan').click();
|
||||
await expect(page.getByTestId('scan-mode-staff')).toBeVisible();
|
||||
expect(calls.passwords).toBe(1);
|
||||
expect(calls.otp).toBe(0);
|
||||
expect(calls.mutations).toEqual([]);
|
||||
});
|
||||
|
||||
test('failed attendee QR confirmation stays outside the app', async ({ page }) => {
|
||||
await mockApi(page, { admin: false, registered: true, checkedIn: true });
|
||||
await page.route('**/auth/v1/token**', (route) => route.fulfill({ status: 400, json: { error: 'invalid_grant', error_description: 'Invalid login credentials' } }));
|
||||
await openEntry(page);
|
||||
await page.getByLabel('QR code or admin email').fill('CVV-TEST-1234');
|
||||
await page.getByTestId('scanner-manual-go').click();
|
||||
await page.getByTestId('attendee-login-email').fill('[email protected]');
|
||||
await page.getByTestId('login-confirm').click();
|
||||
await expect(page.getByTestId('login-error')).toHaveText('Email and QR code do not match. Please try again.');
|
||||
await expect(page.getByTestId('tab-home')).toHaveCount(0);
|
||||
});
|
||||
|
||||
test('mobile email controls fit and QR remains available during cooldown', async ({ page }) => {
|
||||
await page.setViewportSize({ width: 375, height: 812 });
|
||||
const { calls } = await mockApi(page);
|
||||
await openEntry(page);
|
||||
await page.getByLabel('QR code or admin email').fill('[email protected]');
|
||||
await page.getByRole('button', { name: 'Send magic link', exact: true }).click();
|
||||
await expect(page.getByRole('status')).toHaveText(notice);
|
||||
const button = await page.getByTestId('scanner-manual-go').boundingBox();
|
||||
const input = await page.getByLabel('QR code or admin email').boundingBox();
|
||||
expect(button).not.toBeNull();
|
||||
expect(input).not.toBeNull();
|
||||
expect(input!.x + input!.width).toBeLessThanOrEqual(button!.x);
|
||||
expect(button!.x + button!.width).toBeLessThanOrEqual(375);
|
||||
await page.screenshot({ path: '/tmp/convivo-admin-entry-mobile.png', fullPage: true });
|
||||
await page.getByLabel('QR code or admin email').fill('CVV-TEST-1234');
|
||||
await expect(page.getByTestId('scanner-manual-go')).toHaveText('Go');
|
||||
await expect(page.getByTestId('scanner-manual-go')).toBeEnabled();
|
||||
await page.getByTestId('scanner-manual-go').click();
|
||||
await expect(page.getByTestId('attendee-login-email')).toBeVisible();
|
||||
expect(calls.lanyards).toBe(1);
|
||||
});
|
||||
|
||||
for (const suffix of ['#error=access_denied&error_code=otp_expired&error_description=Sensitive+detail', '#access_token=incomplete', '']) {
|
||||
test(`invalid callback is scrubbed and recoverable ${suffix || 'empty'}`, async ({ page }) => {
|
||||
const { calls } = await mockApi(page);
|
||||
await page.goto(`${appUrl}/auth/callback${suffix}`);
|
||||
await expect(page.getByRole('alert')).toHaveText(invalidLink);
|
||||
await expect(page.getByLabel('QR code or admin email')).toBeVisible();
|
||||
await expect(page).toHaveURL(`${appUrl}/`);
|
||||
expect(calls.exchanges).toBe(0);
|
||||
expect(calls.users).toBe(0);
|
||||
await expect(page.getByText('Sensitive detail')).toHaveCount(0);
|
||||
});
|
||||
}
|
||||
|
||||
for (const checkedIn of [false, true]) {
|
||||
test(`attendee QR login retains the checked-in=${checkedIn} gate`, async ({ page }) => {
|
||||
const email = '[email protected]';
|
||||
const { calls } = await mockApi(page, { email, admin: false, registered: true, checkedIn });
|
||||
await openEntry(page);
|
||||
await page.getByLabel('QR code or admin email').fill('CVV-TEST-1234');
|
||||
await page.getByTestId('scanner-manual-go').click();
|
||||
await page.getByTestId('attendee-login-email').fill(email);
|
||||
await page.getByTestId('login-confirm').click();
|
||||
if (checkedIn) await expect(page.getByTestId('tab-home')).toBeVisible();
|
||||
else await expect(page.getByTestId('checkin-required-gate')).toBeVisible();
|
||||
expect(calls.passwords).toBe(1);
|
||||
expect(calls.lanyards).toBe(1);
|
||||
expect(calls.otp).toBe(0);
|
||||
expect(calls.mutations).toEqual([]);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,109 @@
|
||||
import { test, expect, type Page } from '@playwright/test';
|
||||
|
||||
const adminUrl = process.env.CONVIVO_ADMIN_URL || 'http://localhost:3001';
|
||||
const eventId = 'aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa';
|
||||
const sourceId = '11111111-1111-4111-8111-111111111111';
|
||||
const targetId = '22222222-2222-4222-8222-222222222222';
|
||||
const otherId = '33333333-3333-4333-8333-333333333333';
|
||||
const manualId = '44444444-4444-4444-8444-444444444444';
|
||||
|
||||
async function openRegistrations(page: Page, options: { patchFailure?: boolean; mergeFailure?: boolean } = {}) {
|
||||
const user = { id: '99999999-9999-4999-8999-999999999999', email: '[email protected]', aud: 'authenticated', role: 'authenticated', app_metadata: {}, user_metadata: {} };
|
||||
const payload = Buffer.from(JSON.stringify({ sub: user.id, exp: Math.floor(Date.now() / 1000) + 3600 })).toString('base64url');
|
||||
const session = { user, access_token: `eyJhbGciOiJIUzI1NiJ9.${payload}.test`, refresh_token: 'mock-refresh-token', expires_in: 3600, token_type: 'bearer' };
|
||||
const event = { id: eventId, name: 'Merge Conference', is_active: true, start_date: '2026-11-01', end_date: '2026-11-01', num_registrations: 2, num_checked_in_registrations: 0, num_sessions: 1, num_speakers: 1 };
|
||||
const contacts = [
|
||||
{ email: user.email, full_name: 'Admin', is_admin: true },
|
||||
{ email: '[email protected]', full_name: 'Alex Smith', is_admin: false },
|
||||
{ email: '[email protected]', full_name: 'Alex Smith', is_admin: false },
|
||||
{ email: '[email protected]', full_name: 'Robin Jones', is_admin: false },
|
||||
{ email: '[email protected]', full_name: 'Manual Person', is_admin: false },
|
||||
];
|
||||
let registrations = [
|
||||
{ id: sourceId, event_id: eventId, contact_email: contacts[1].email, type: 'speaker', qr_token: null, external_id: null, import_source: 'sessionize', checked_in: false, points: 0 },
|
||||
{ id: targetId, event_id: eventId, contact_email: contacts[2].email, type: 'attendee', qr_token: 'real-qr-one', external_id: 'pretix-one', import_source: null, checked_in: false, points: 0 },
|
||||
{ id: otherId, event_id: eventId, contact_email: contacts[3].email, type: 'attendee', qr_token: 'real-qr-two', external_id: 'pretix-two', import_source: null, checked_in: false, points: 0 },
|
||||
{ id: manualId, event_id: eventId, contact_email: contacts[4].email, type: 'attendee', qr_token: ' ', external_id: null, import_source: null, checked_in: true, points: 0 },
|
||||
];
|
||||
const merges: Array<{ p_source_id: string; p_target_id: string }> = [];
|
||||
await page.route('**/auth/v1/**', async route => {
|
||||
const path = new URL(route.request().url()).pathname;
|
||||
await route.fulfill({ json: path.endsWith('/user') ? user : path.endsWith('/token') ? session : {} });
|
||||
});
|
||||
await page.route('**/rest/v1/**', async route => {
|
||||
const url = new URL(route.request().url());
|
||||
const table = url.pathname.split('/').pop();
|
||||
if (table === 'merge_tickets') {
|
||||
const body = route.request().postDataJSON();
|
||||
merges.push(body);
|
||||
if (options.mergeFailure) return route.fulfill({ status: 400, json: { message: 'Ticket no longer exists' } });
|
||||
const target = registrations.find(row => row.id === body.p_target_id)!;
|
||||
registrations = registrations.filter(row => row.id !== body.p_source_id).map(row => row.id === target.id ? { ...row, type: 'speaker' } : row);
|
||||
return route.fulfill({ json: { source_id: body.p_source_id, target_id: target.id, target_email: target.contact_email, type: 'speaker', sessions_transferred: 2 } });
|
||||
}
|
||||
if (table === 'contacts') return route.fulfill({ json: url.searchParams.has('email') ? contacts[0] : contacts });
|
||||
if (table === 'events') return route.fulfill({ json: url.searchParams.has('is_active') ? event : [event] });
|
||||
if (table === 'registrations') {
|
||||
if (route.request().method() === 'PATCH') {
|
||||
if (options.patchFailure) return route.fulfill({ status: 500, json: { message: 'Check-in failed' } });
|
||||
const id = url.searchParams.get('id')!.replace('eq.', '');
|
||||
registrations = registrations.map(row => row.id === id ? { ...row, ...route.request().postDataJSON() } : row);
|
||||
return route.fulfill({ json: { id } });
|
||||
}
|
||||
return route.fulfill({ json: registrations });
|
||||
}
|
||||
return route.fulfill({ json: [] });
|
||||
});
|
||||
await page.goto(`${adminUrl}/auth/callback#access_token=${session.access_token}&refresh_token=${session.refresh_token}&type=magiclink`);
|
||||
await expect(page.getByRole('button', { name: 'Sign out', exact: true })).toBeVisible();
|
||||
await page.locator('.nav').getByRole('button', { name: /Registrations/ }).click();
|
||||
await expect(page.getByRole('button', { name: 'Merge tickets', exact: true })).toBeVisible();
|
||||
return { merges };
|
||||
}
|
||||
|
||||
test('counts only QR tickets and check-in slides without refresh', async ({ page }) => {
|
||||
await openRegistrations(page);
|
||||
await expect(page.getByText('2 tickets · 0 checked in · 2 without tickets.', { exact: false })).toBeVisible();
|
||||
const row = page.getByRole('row').filter({ hasText: '[email protected]' });
|
||||
await row.locator('label.toggle').click();
|
||||
await expect(row.getByRole('checkbox')).toBeChecked();
|
||||
await expect(page.getByText('2 tickets · 1 checked in · 2 without tickets.', { exact: false })).toBeVisible();
|
||||
});
|
||||
|
||||
test('failed check-in rolls the toggle back', async ({ page }) => {
|
||||
await openRegistrations(page, { patchFailure: true });
|
||||
const row = page.getByRole('row').filter({ hasText: '[email protected]' });
|
||||
await row.locator('label.toggle').click();
|
||||
await expect(page.getByText('Check-in failed', { exact: true })).toBeVisible();
|
||||
await expect(row.getByRole('checkbox')).not.toBeChecked();
|
||||
});
|
||||
|
||||
test('merge is imported-only, suggests names, cancels safely, and permits any purchased ticket', async ({ page }) => {
|
||||
const state = await openRegistrations(page);
|
||||
await expect(page.getByRole('button', { name: 'Merge tickets', exact: true })).toHaveCount(1);
|
||||
await page.getByRole('button', { name: 'Merge tickets', exact: true }).click();
|
||||
const choices = page.getByRole('radiogroup', { name: 'Destination ticket' });
|
||||
await expect(choices.getByRole('radio').first()).toHaveAccessibleName(/Alex Smith/);
|
||||
await expect(page.getByRole('button', { name: 'Confirm merge' })).toBeDisabled();
|
||||
await page.getByRole('button', { name: 'Cancel', exact: true }).click();
|
||||
expect(state.merges).toHaveLength(0);
|
||||
await page.getByRole('button', { name: 'Merge tickets', exact: true }).click();
|
||||
await page.getByPlaceholder('Search name or email').fill('Robin');
|
||||
await page.getByRole('radio', { name: /Robin Jones/ }).check();
|
||||
await page.getByRole('button', { name: 'Confirm merge' }).click();
|
||||
await expect(page.getByText('Merged into [email protected]; 2 session assignment(s) transferred.', { exact: true })).toBeVisible();
|
||||
expect(state.merges).toEqual([{ p_source_id: sourceId, p_target_id: otherId }]);
|
||||
await expect(page.getByRole('row').filter({ hasText: '[email protected]' })).toHaveCount(0);
|
||||
await expect(page.getByRole('row').filter({ hasText: '[email protected]' }).locator('select')).toHaveValue('speaker');
|
||||
});
|
||||
|
||||
test('failed merge keeps source row and allows retry', async ({ page }) => {
|
||||
await openRegistrations(page, { mergeFailure: true });
|
||||
await page.getByRole('button', { name: 'Merge tickets', exact: true }).click();
|
||||
await page.getByRole('radio', { name: /Alex Smith/ }).check();
|
||||
await page.getByRole('button', { name: 'Confirm merge' }).click();
|
||||
await expect(page.getByRole('alert')).toHaveText('Ticket no longer exists');
|
||||
await expect(page.getByRole('button', { name: 'Confirm merge' })).toBeEnabled();
|
||||
await page.getByRole('button', { name: 'Cancel', exact: true }).click();
|
||||
await expect(page.getByRole('row').filter({ hasText: '[email protected]' })).toBeVisible();
|
||||
});
|
||||
@@ -246,11 +246,11 @@ otp_expiry = 3600
|
||||
# Local Auth explicitly opts into real email delivery; password stays in a private env file.
|
||||
[auth.email.smtp]
|
||||
enabled = true
|
||||
host = "heracles.mxrouting.net"
|
||||
port = 465
|
||||
user = "[email protected]"
|
||||
host = "smtp-relay.brevo.com"
|
||||
port = 587
|
||||
user = "[email protected]"
|
||||
pass = "env(CONVIVO_SMTP_PASSWORD)"
|
||||
admin_email = "convivo@lago.dev"
|
||||
admin_email = "info@convivo.appe.at"
|
||||
sender_name = "Convivo APP"
|
||||
|
||||
# Uncomment to customize email template
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
create or replace function public.can_request_admin_magic_link(p_email text)
|
||||
returns boolean
|
||||
language sql stable security definer
|
||||
set search_path = ''
|
||||
as $$
|
||||
select exists (
|
||||
select 1
|
||||
from public.contacts as contact
|
||||
where contact.email = lower(btrim(p_email))
|
||||
and (contact.is_admin or contact.email like '%@appe.at')
|
||||
and exists (
|
||||
select 1 from auth.users as auth_user
|
||||
where auth_user.email = contact.email
|
||||
)
|
||||
);
|
||||
$$;
|
||||
|
||||
revoke all on function public.can_request_admin_magic_link(text) from public;
|
||||
grant execute on function public.can_request_admin_magic_link(text) to anon, authenticated;
|
||||
@@ -0,0 +1,200 @@
|
||||
alter table public.registrations add column import_source text
|
||||
check (import_source in ('sessionize'));
|
||||
|
||||
update public.registrations registration set import_source = 'sessionize'
|
||||
from public.contacts contact
|
||||
where contact.email = registration.contact_email
|
||||
and nullif(btrim(contact.external_id), '') is not null
|
||||
and nullif(btrim(registration.qr_token), '') is null
|
||||
and nullif(btrim(registration.external_id), '') is null
|
||||
and registration.type in ('speaker', 'staff');
|
||||
|
||||
create table public.ticket_merges (
|
||||
event_id uuid not null references public.events(id) on delete cascade,
|
||||
source_email text not null references public.contacts(email) on delete cascade,
|
||||
target_email text not null references public.contacts(email) on delete cascade,
|
||||
transferred_type public.registration_type not null,
|
||||
merged_by uuid not null,
|
||||
merged_at timestamptz not null default now(),
|
||||
primary key (event_id, source_email),
|
||||
check (source_email <> target_email),
|
||||
check (transferred_type in ('speaker', 'staff'))
|
||||
);
|
||||
alter table public.ticket_merges enable row level security;
|
||||
revoke all on public.ticket_merges from public, anon, authenticated;
|
||||
grant select on public.ticket_merges to authenticated;
|
||||
create policy ticket_merges_admin_read on public.ticket_merges
|
||||
for select to authenticated using (public.is_admin());
|
||||
|
||||
create function public._ticket_email(p_event_id uuid, p_email text)
|
||||
returns text language sql stable security definer set search_path = '' as $$
|
||||
select coalesce((select target_email from public.ticket_merges
|
||||
where event_id = p_event_id and source_email = p_email), p_email);
|
||||
$$;
|
||||
revoke all on function public._ticket_email(uuid, text) from public, anon, authenticated;
|
||||
|
||||
create function public._apply_ticket_merge_registration()
|
||||
returns trigger language plpgsql security definer set search_path = '' as $$
|
||||
declare
|
||||
mapping public.ticket_merges;
|
||||
begin
|
||||
select * into mapping from public.ticket_merges
|
||||
where event_id = new.event_id and source_email = new.contact_email;
|
||||
if found then
|
||||
if nullif(btrim(new.qr_token), '') is not null then
|
||||
raise exception 'This imported account was merged; reconcile its new ticket manually';
|
||||
end if;
|
||||
update public.registrations set type = case
|
||||
when type = 'staff' or mapping.transferred_type = 'staff' then 'staff'::public.registration_type
|
||||
else 'speaker'::public.registration_type end
|
||||
where event_id = mapping.event_id and contact_email = mapping.target_email;
|
||||
if not found then raise exception 'Merged ticket no longer exists'; end if;
|
||||
return null;
|
||||
end if;
|
||||
select * into mapping from public.ticket_merges
|
||||
where event_id = new.event_id and target_email = new.contact_email
|
||||
order by (transferred_type = 'staff') desc limit 1;
|
||||
if found then
|
||||
new.type := case when new.type = 'staff' or mapping.transferred_type = 'staff'
|
||||
then 'staff'::public.registration_type else 'speaker'::public.registration_type end;
|
||||
end if;
|
||||
return new;
|
||||
end;
|
||||
$$;
|
||||
revoke all on function public._apply_ticket_merge_registration() from public, anon, authenticated;
|
||||
create trigger ticket_merge_registration before insert or update on public.registrations
|
||||
for each row execute function public._apply_ticket_merge_registration();
|
||||
|
||||
do $$
|
||||
declare
|
||||
function_name text;
|
||||
definition text;
|
||||
needle text := E'insert into public.registrations (event_id, contact_email, type)\n values (p_event_id, v_email, ''speaker''::public.registration_type)';
|
||||
begin
|
||||
foreach function_name in array array['sync_sessionize_event', 'sync_sessionize_excel'] loop
|
||||
definition := pg_get_functiondef(to_regprocedure('public.' || function_name || '(uuid,jsonb)'));
|
||||
if function_name = 'sync_sessionize_excel' and position(needle in definition) = 0 then
|
||||
raise exception 'Unexpected Sessionize registration definition: %', function_name;
|
||||
end if;
|
||||
if position('values (v_session.id, v_spk)' in definition) = 0
|
||||
or position('where e = ss.contact_email' in definition) = 0 then
|
||||
raise exception 'Unexpected Sessionize speaker definition: %', function_name;
|
||||
end if;
|
||||
definition := replace(definition, needle,
|
||||
E'insert into public.registrations (event_id, contact_email, type, import_source)\n values (p_event_id, v_email, ''speaker''::public.registration_type, ''sessionize'')');
|
||||
if function_name = 'sync_sessionize_excel' then
|
||||
definition := replace(definition, E' v_email := v_item ->> ''email'';',
|
||||
E' v_email := public._ticket_email(p_event_id, v_item ->> ''email'');');
|
||||
definition := replace(definition, 'set type = case when public.registrations.type',
|
||||
E'set import_source = ''sessionize'',\n type = case when public.registrations.type');
|
||||
definition := replace(definition, E'\n where public.registrations.type not in (''staff'', ''sponsor'');', ';');
|
||||
end if;
|
||||
definition := replace(definition, 'values (v_session.id, v_spk)',
|
||||
'values (v_session.id, public._ticket_email(p_event_id, v_spk))');
|
||||
definition := replace(definition, 'where e = ss.contact_email',
|
||||
'where public._ticket_email(p_event_id, e) = ss.contact_email');
|
||||
execute definition;
|
||||
end loop;
|
||||
end;
|
||||
$$;
|
||||
|
||||
create or replace function public._recalc_event_aggregates(p_event_id uuid) returns void
|
||||
language plpgsql security definer set search_path = '' as $$
|
||||
begin
|
||||
update public.events set
|
||||
num_sessions = (select count(*) from public.sessions where event_id = p_event_id),
|
||||
num_speakers = (select count(distinct speaker.contact_email) from public.session_speakers speaker
|
||||
join public.sessions talk on talk.id = speaker.session_id where talk.event_id = p_event_id),
|
||||
num_registrations = (select count(*) from public.registrations
|
||||
where event_id = p_event_id and nullif(btrim(qr_token), '') is not null),
|
||||
num_checked_in_registrations = (select count(*) from public.registrations
|
||||
where event_id = p_event_id and checked_in and nullif(btrim(qr_token), '') is not null),
|
||||
avg_feedback = (select avg(rating) from public.feedback where event_id = p_event_id)
|
||||
where id = p_event_id;
|
||||
end;
|
||||
$$;
|
||||
|
||||
create function public.merge_tickets(p_source_id uuid, p_target_id uuid)
|
||||
returns jsonb language plpgsql security definer set search_path = '' as $$
|
||||
declare
|
||||
source_registration public.registrations;
|
||||
target_registration public.registrations;
|
||||
transferred_type public.registration_type;
|
||||
session_count integer;
|
||||
begin
|
||||
if auth.uid() is null or not public.is_admin() then
|
||||
raise exception 'admin only' using errcode = '42501';
|
||||
end if;
|
||||
if p_source_id is null or p_target_id is null or p_source_id = p_target_id then
|
||||
raise exception 'Pick two different registrations';
|
||||
end if;
|
||||
select * into source_registration from public.registrations where id = p_source_id;
|
||||
if not found then raise exception 'Imported registration no longer exists'; end if;
|
||||
perform 1 from public.events where id = source_registration.event_id for update;
|
||||
perform 1 from public.registrations where id in (p_source_id, p_target_id) order by id for update;
|
||||
select * into source_registration from public.registrations where id = p_source_id;
|
||||
if not found then raise exception 'Imported registration no longer exists'; end if;
|
||||
select * into target_registration from public.registrations where id = p_target_id;
|
||||
if not found then raise exception 'Ticket no longer exists'; end if;
|
||||
if source_registration.event_id <> target_registration.event_id then
|
||||
raise exception 'Tickets must belong to the same event';
|
||||
end if;
|
||||
if source_registration.import_source is distinct from 'sessionize'
|
||||
or nullif(btrim(source_registration.qr_token), '') is not null
|
||||
or source_registration.type not in ('speaker', 'staff') then
|
||||
raise exception 'Source must be an imported speaker/staff registration without a QR';
|
||||
end if;
|
||||
if nullif(btrim(target_registration.qr_token), '') is null
|
||||
or nullif(btrim(target_registration.external_id), '') is null then
|
||||
raise exception 'Destination must be a purchased Pretix ticket';
|
||||
end if;
|
||||
if exists (select 1 from public.ticket_merges where event_id = source_registration.event_id
|
||||
and (target_email = source_registration.contact_email or source_email = target_registration.contact_email)) then
|
||||
raise exception 'Merge chains are not supported';
|
||||
end if;
|
||||
perform 1 from public.contacts
|
||||
where email in (source_registration.contact_email, target_registration.contact_email)
|
||||
order by email for update;
|
||||
if source_registration.checked_in or source_registration.points <> 0
|
||||
or exists (select 1 from public.preferences where event_id = source_registration.event_id and contact_email = source_registration.contact_email)
|
||||
or exists (select 1 from public.checkins where event_id = source_registration.event_id and contact_email = source_registration.contact_email)
|
||||
or exists (select 1 from public.feedback where event_id = source_registration.event_id and contact_email = source_registration.contact_email)
|
||||
or exists (select 1 from public.points_log where event_id = source_registration.event_id and contact_email = source_registration.contact_email)
|
||||
or exists (select 1 from public.connections where event_id = source_registration.event_id
|
||||
and (from_email = source_registration.contact_email or to_email = source_registration.contact_email)) then
|
||||
raise exception 'Imported account has attendee activity; reconcile it before merging';
|
||||
end if;
|
||||
transferred_type := case when source_registration.type = 'staff' or target_registration.type = 'staff'
|
||||
then 'staff'::public.registration_type else 'speaker'::public.registration_type end;
|
||||
perform 1 from public.sessions where event_id = source_registration.event_id order by id for update;
|
||||
perform 1 from public.session_speakers speaker join public.sessions talk on talk.id = speaker.session_id
|
||||
where talk.event_id = source_registration.event_id order by speaker.session_id, speaker.contact_email for update of speaker;
|
||||
select count(*) into session_count from public.session_speakers speaker
|
||||
join public.sessions talk on talk.id = speaker.session_id
|
||||
where talk.event_id = source_registration.event_id and speaker.contact_email = source_registration.contact_email;
|
||||
insert into public.session_speakers(session_id, contact_email)
|
||||
select speaker.session_id, target_registration.contact_email from public.session_speakers speaker
|
||||
join public.sessions talk on talk.id = speaker.session_id
|
||||
where talk.event_id = source_registration.event_id and speaker.contact_email = source_registration.contact_email
|
||||
on conflict (session_id, contact_email) do nothing;
|
||||
delete from public.session_speakers speaker using public.sessions talk
|
||||
where talk.id = speaker.session_id and talk.event_id = source_registration.event_id
|
||||
and speaker.contact_email = source_registration.contact_email;
|
||||
update public.registrations set type = transferred_type where id = p_target_id;
|
||||
insert into public.ticket_merges(event_id, source_email, target_email, transferred_type, merged_by)
|
||||
values (source_registration.event_id, source_registration.contact_email, target_registration.contact_email, transferred_type, auth.uid());
|
||||
delete from public.registrations where id = p_source_id;
|
||||
delete from public.leaderboard where event_id = source_registration.event_id and contact_email = source_registration.contact_email;
|
||||
return jsonb_build_object('source_id', p_source_id, 'target_id', p_target_id,
|
||||
'target_email', target_registration.contact_email, 'type', transferred_type, 'sessions_transferred', session_count);
|
||||
end;
|
||||
$$;
|
||||
revoke all on function public.merge_tickets(uuid, uuid) from public, anon, authenticated;
|
||||
grant execute on function public.merge_tickets(uuid, uuid) to authenticated;
|
||||
|
||||
do $$ declare event_row record; begin
|
||||
for event_row in select id from public.events loop
|
||||
perform public._recalc_event_aggregates(event_row.id);
|
||||
end loop;
|
||||
end; $$;
|
||||
notify pgrst, 'reload schema';
|
||||
@@ -0,0 +1,51 @@
|
||||
create function public._preserve_assigned_speaker_role()
|
||||
returns trigger language plpgsql security definer set search_path = '' as $$
|
||||
begin
|
||||
if new.type = 'attendee' and exists (
|
||||
select 1 from public.session_speakers speaker
|
||||
join public.sessions talk on talk.id = speaker.session_id
|
||||
join public.slots slot on slot.id = talk.slot_id and slot.event_id = talk.event_id
|
||||
where speaker.contact_email = new.contact_email
|
||||
and talk.event_id = new.event_id and slot.type = 'session'
|
||||
) then
|
||||
new.type := 'speaker'::public.registration_type;
|
||||
end if;
|
||||
return new;
|
||||
end;
|
||||
$$;
|
||||
revoke all on function public._preserve_assigned_speaker_role() from public, anon, authenticated;
|
||||
|
||||
create trigger trg_registrations_assigned_speaker
|
||||
before insert or update on public.registrations
|
||||
for each row execute function public._preserve_assigned_speaker_role();
|
||||
|
||||
create or replace function public._trg_speaker_promote()
|
||||
returns trigger language plpgsql security definer set search_path = '' as $$
|
||||
begin
|
||||
update public.registrations registration set type = 'speaker'::public.registration_type
|
||||
from public.sessions talk join public.slots slot
|
||||
on slot.id = talk.slot_id and slot.event_id = talk.event_id
|
||||
where talk.id = new.session_id and slot.type = 'session'
|
||||
and registration.event_id = talk.event_id
|
||||
and registration.contact_email = new.contact_email
|
||||
and registration.type = 'attendee';
|
||||
return new;
|
||||
end;
|
||||
$$;
|
||||
revoke all on function public._trg_speaker_promote() from public, anon, authenticated;
|
||||
|
||||
drop trigger session_speakers_speaker_promote on public.session_speakers;
|
||||
create trigger session_speakers_speaker_promote
|
||||
after insert or update on public.session_speakers
|
||||
for each row execute function public._trg_speaker_promote();
|
||||
|
||||
update public.registrations registration set type = 'speaker'::public.registration_type
|
||||
where registration.type = 'attendee' and exists (
|
||||
select 1 from public.session_speakers speaker
|
||||
join public.sessions talk on talk.id = speaker.session_id
|
||||
join public.slots slot on slot.id = talk.slot_id and slot.event_id = talk.event_id
|
||||
where speaker.contact_email = registration.contact_email
|
||||
and talk.event_id = registration.event_id and slot.type = 'session'
|
||||
);
|
||||
|
||||
notify pgrst, 'reload schema';
|
||||
+4
-259
@@ -6,180 +6,30 @@
|
||||
-- "Sessions and speakers (advanced)" .xlsx (imported via the Interfaces menu,
|
||||
-- which creates the speaker contacts + registrations + links by email).
|
||||
--
|
||||
-- Seeded here: the event (with its Sessionize endpoint), 50 attendees, 4 staff
|
||||
-- Seeded here: the event (with its Sessionize endpoint), 4 staff
|
||||
-- (admin role), and the agenda. Speaker contacts/registrations are NOT seeded —
|
||||
-- run the Excel import to add them.
|
||||
-- =============================================================================
|
||||
|
||||
-- -----------------------------------------------------------------------------
|
||||
-- AUTH USERS (QR token = password). 50 attendees + 4 staff.
|
||||
-- AUTH USERS (staff password). 4 staff.
|
||||
-- -----------------------------------------------------------------------------
|
||||
insert into auth.users (instance_id, id, aud, role, email, encrypted_password, email_confirmed_at, confirmation_token, recovery_token, email_change_token_new, email_change, raw_app_meta_data, raw_user_meta_data, created_at, updated_at, confirmation_sent_at, last_sign_in_at) values
|
||||
('00000000-0000-0000-0000-000000000000', 'a40737e3-11ca-48e0-9445-4f72096cdcd4', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1000', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Lena Huber"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '298d54fd-6e35-460d-aabf-135e2eefac00', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1001', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Felix Berger"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '446a6e86-73da-41ae-8134-7609556dca96', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1002', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Mia Moser"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '6abea183-d84e-4502-9eb8-b5bc751a3ca4', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1003', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Jonas Unger"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', 'c18e5356-3c14-4a43-8e0b-0739ff0fc1c0', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1004', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Emma Dorfer"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', 'cf916c0c-b501-4c1b-bd1b-366fbe5fe4d8', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1005', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Paul Klein"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', 'c322e223-6965-4a98-860e-367acfa21202', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1006', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Hannah Steiner"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '52f0e634-09a4-444d-a6e6-cbd9e4ee5b9f', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1007', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Lukas Fischer"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '4546c422-584b-4108-8a5b-25c832fc0114', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1008', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Sofia Oberhuber"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', 'd2ea8708-22a9-446b-8fb8-833f2f9a733c', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1009', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"David Winkler"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '296330bd-a169-4798-8df1-38221381d2e0', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1010', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Clara Falk"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '935f1800-1b99-4894-8891-db2c86491a5b', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1011', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Max Wagner"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '2ce35e62-822a-4e5b-b3c9-e6b5b6cc7531', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1012', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Ella Hofer"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '2d1a4f08-19dc-4239-bf3d-27fb912500aa', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1013', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Finn Hofmann"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', 'e27a487b-df20-4bf6-83a8-41d17533cbb5', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1014', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Livia Rainer"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '2daa1a3f-2b27-4532-9d4d-dd1fbe37d3b5', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1015', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Noah Aigner"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '67938a9a-5041-4882-8947-4274e78a0bcb', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1016', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Mara Hartl"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', 'eb7570a3-9ffc-4260-bfca-d45bfe128c26', 'authenticated', 'authenticated', 'elias.mü[email protected]', crypt('CVV-ATT-1017', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Elias Müller"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '584eed6e-d953-4672-b7c8-891d0674e7f9', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1018', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Nora Pichler"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '74a99e87-42b3-4d0a-bc5c-635b22dc2023', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1019', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Ben Lederer"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '311399c5-d98c-4785-a94c-617982503e14', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1020', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Ida Tausch"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '78be51e6-65f0-46ad-80d5-2399390ff501', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1021', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Oscar Cerny"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '05a54110-7182-4095-93de-85306ce572d4', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1022', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Freja Jank"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', 'cd6bc4d5-afb0-4da2-99b9-f3e5bb7c5f32', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1023', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Hugo Gruber"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', 'd66f79b9-9dec-4a6a-94e7-82f4b0ad01c0', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1024', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Alma Egger"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', 'bb7736de-d32a-41d7-b2d9-ee64275b145e', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1025', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Theo Nagl"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', 'f09aca1d-4d95-49a6-a9e0-6f1362fe8361', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1026', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Greta Vogler"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', 'd1bbda95-3df1-4c3b-95ee-ed1eb523d30e', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1027', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Milo Eisen"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', 'e9fa34ff-9215-4397-8c1e-1f00ced2fecd', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1028', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Vera Lorenz"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '83766fe2-2e9f-41ca-9862-3a7459fdea9f', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1029', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Arno Maier"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '6801de1c-802d-4ec6-9781-17f5ffd20cbe', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1030', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Lotte Graf"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '67cddcb9-c467-48cf-a3dc-4d48fdd1cd4b', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1031', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Kai Pfeiffer"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', 'f1e37d99-2f8e-4a92-8138-68ef50bb94d9', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1032', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Mira Zech"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', 'a6d3f6a1-a01e-431a-9338-28d55b69b0d6', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1033', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Erik Gassner"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', 'c4fece75-2a7d-46c3-b968-d76c5ec97d47', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1034', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Anna Schmidt"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '692cd876-e621-44d4-b152-f36397684392', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1035', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Tobias Wolfer"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '0e4d3be9-f1c6-4278-9e6e-2f7f80956830', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1036', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Lena Keller"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '299e0882-fb69-43b2-b496-04a628865953', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1037', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Samuel Sailer"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '8d3d4484-4f82-4ac4-85b0-89aa01d415f1', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1038', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Julia Bauer"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '51a4fecc-e038-4ffb-b715-a3d4e1c1e7d7', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1039', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Moritz Ismail"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '88907380-da12-4ccb-9f33-b8ab4a00d6d0', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1040', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Eva Huber"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', 'b3275d03-3b89-477c-9881-2b0a0e2e3ce9', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1041', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Leon Berger"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '74b47dc2-0eb7-44b5-8faa-6ceaae4d8a3d', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1042', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Klara Moser"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '66d71898-d8c4-4d95-847a-496e899d8e9a', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1043', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Felix Unger"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', 'bed7dceb-8be7-4a71-a4aa-3b344da4dbb9', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1044', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Nina Dorfer"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '3ff5d5d5-204b-46fe-a5cc-2db6e8c643f0', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1045', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Jan Klein"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '3c39579c-4216-4206-9346-46fe69c2c280', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1046', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Lena Steiner"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '661359f0-8771-4dc8-a517-58822e2f60be', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1047', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Paul Fischer"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', 'e1a2c232-2dcd-462f-afc8-01b2e4c1646d', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1048', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Sara Oberhuber"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '8bb02227-1008-436c-93ae-d4dbe8c8a063', 'authenticated', 'authenticated', '[email protected]', crypt('CVV-ATT-1049', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Markus Winkler"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '8ca780f4-dea0-4848-80d0-12f7529193a6', 'authenticated', 'authenticated', '[email protected]', crypt('appe-admin-2026', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Amelia Hernandez"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', 'a6607c2b-9adc-4eaf-95d1-357076b8ef96', 'authenticated', 'authenticated', '[email protected]', crypt('appe-admin-2026', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Sabrina Hota"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', '2eb5e467-eb1e-4c96-a1c8-748173676da4', 'authenticated', 'authenticated', '[email protected]', crypt('appe-admin-2026', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Jose Lago"}', now(), now(), now(), now()),
|
||||
('00000000-0000-0000-0000-000000000000', 'c46da711-f429-4410-adde-21d7c6846aef', 'authenticated', 'authenticated', '[email protected]', crypt('appe-admin-2026', gen_salt('bf')), now(), '', '', '', '', '{"provider":"email","providers":["email"]}', '{"full_name":"Markus Franz"}', now(), now(), now(), now()) on conflict (id) do nothing;
|
||||
|
||||
insert into auth.identities (id, provider_id, identity_data, provider, user_id, created_at, updated_at, last_sign_in_at) values
|
||||
('a40737e3-11ca-48e0-9445-4f72096cdcd4', 'a40737e3-11ca-48e0-9445-4f72096cdcd4', '{"sub":"a40737e3-11ca-48e0-9445-4f72096cdcd4","email":"[email protected]"}', 'email', 'a40737e3-11ca-48e0-9445-4f72096cdcd4', now(), now(), now()),
|
||||
('298d54fd-6e35-460d-aabf-135e2eefac00', '298d54fd-6e35-460d-aabf-135e2eefac00', '{"sub":"298d54fd-6e35-460d-aabf-135e2eefac00","email":"[email protected]"}', 'email', '298d54fd-6e35-460d-aabf-135e2eefac00', now(), now(), now()),
|
||||
('446a6e86-73da-41ae-8134-7609556dca96', '446a6e86-73da-41ae-8134-7609556dca96', '{"sub":"446a6e86-73da-41ae-8134-7609556dca96","email":"[email protected]"}', 'email', '446a6e86-73da-41ae-8134-7609556dca96', now(), now(), now()),
|
||||
('6abea183-d84e-4502-9eb8-b5bc751a3ca4', '6abea183-d84e-4502-9eb8-b5bc751a3ca4', '{"sub":"6abea183-d84e-4502-9eb8-b5bc751a3ca4","email":"[email protected]"}', 'email', '6abea183-d84e-4502-9eb8-b5bc751a3ca4', now(), now(), now()),
|
||||
('c18e5356-3c14-4a43-8e0b-0739ff0fc1c0', 'c18e5356-3c14-4a43-8e0b-0739ff0fc1c0', '{"sub":"c18e5356-3c14-4a43-8e0b-0739ff0fc1c0","email":"[email protected]"}', 'email', 'c18e5356-3c14-4a43-8e0b-0739ff0fc1c0', now(), now(), now()),
|
||||
('cf916c0c-b501-4c1b-bd1b-366fbe5fe4d8', 'cf916c0c-b501-4c1b-bd1b-366fbe5fe4d8', '{"sub":"cf916c0c-b501-4c1b-bd1b-366fbe5fe4d8","email":"[email protected]"}', 'email', 'cf916c0c-b501-4c1b-bd1b-366fbe5fe4d8', now(), now(), now()),
|
||||
('c322e223-6965-4a98-860e-367acfa21202', 'c322e223-6965-4a98-860e-367acfa21202', '{"sub":"c322e223-6965-4a98-860e-367acfa21202","email":"[email protected]"}', 'email', 'c322e223-6965-4a98-860e-367acfa21202', now(), now(), now()),
|
||||
('52f0e634-09a4-444d-a6e6-cbd9e4ee5b9f', '52f0e634-09a4-444d-a6e6-cbd9e4ee5b9f', '{"sub":"52f0e634-09a4-444d-a6e6-cbd9e4ee5b9f","email":"[email protected]"}', 'email', '52f0e634-09a4-444d-a6e6-cbd9e4ee5b9f', now(), now(), now()),
|
||||
('4546c422-584b-4108-8a5b-25c832fc0114', '4546c422-584b-4108-8a5b-25c832fc0114', '{"sub":"4546c422-584b-4108-8a5b-25c832fc0114","email":"[email protected]"}', 'email', '4546c422-584b-4108-8a5b-25c832fc0114', now(), now(), now()),
|
||||
('d2ea8708-22a9-446b-8fb8-833f2f9a733c', 'd2ea8708-22a9-446b-8fb8-833f2f9a733c', '{"sub":"d2ea8708-22a9-446b-8fb8-833f2f9a733c","email":"[email protected]"}', 'email', 'd2ea8708-22a9-446b-8fb8-833f2f9a733c', now(), now(), now()),
|
||||
('296330bd-a169-4798-8df1-38221381d2e0', '296330bd-a169-4798-8df1-38221381d2e0', '{"sub":"296330bd-a169-4798-8df1-38221381d2e0","email":"[email protected]"}', 'email', '296330bd-a169-4798-8df1-38221381d2e0', now(), now(), now()),
|
||||
('935f1800-1b99-4894-8891-db2c86491a5b', '935f1800-1b99-4894-8891-db2c86491a5b', '{"sub":"935f1800-1b99-4894-8891-db2c86491a5b","email":"[email protected]"}', 'email', '935f1800-1b99-4894-8891-db2c86491a5b', now(), now(), now()),
|
||||
('2ce35e62-822a-4e5b-b3c9-e6b5b6cc7531', '2ce35e62-822a-4e5b-b3c9-e6b5b6cc7531', '{"sub":"2ce35e62-822a-4e5b-b3c9-e6b5b6cc7531","email":"[email protected]"}', 'email', '2ce35e62-822a-4e5b-b3c9-e6b5b6cc7531', now(), now(), now()),
|
||||
('2d1a4f08-19dc-4239-bf3d-27fb912500aa', '2d1a4f08-19dc-4239-bf3d-27fb912500aa', '{"sub":"2d1a4f08-19dc-4239-bf3d-27fb912500aa","email":"[email protected]"}', 'email', '2d1a4f08-19dc-4239-bf3d-27fb912500aa', now(), now(), now()),
|
||||
('e27a487b-df20-4bf6-83a8-41d17533cbb5', 'e27a487b-df20-4bf6-83a8-41d17533cbb5', '{"sub":"e27a487b-df20-4bf6-83a8-41d17533cbb5","email":"[email protected]"}', 'email', 'e27a487b-df20-4bf6-83a8-41d17533cbb5', now(), now(), now()),
|
||||
('2daa1a3f-2b27-4532-9d4d-dd1fbe37d3b5', '2daa1a3f-2b27-4532-9d4d-dd1fbe37d3b5', '{"sub":"2daa1a3f-2b27-4532-9d4d-dd1fbe37d3b5","email":"[email protected]"}', 'email', '2daa1a3f-2b27-4532-9d4d-dd1fbe37d3b5', now(), now(), now()),
|
||||
('67938a9a-5041-4882-8947-4274e78a0bcb', '67938a9a-5041-4882-8947-4274e78a0bcb', '{"sub":"67938a9a-5041-4882-8947-4274e78a0bcb","email":"[email protected]"}', 'email', '67938a9a-5041-4882-8947-4274e78a0bcb', now(), now(), now()),
|
||||
('eb7570a3-9ffc-4260-bfca-d45bfe128c26', 'eb7570a3-9ffc-4260-bfca-d45bfe128c26', '{"sub":"eb7570a3-9ffc-4260-bfca-d45bfe128c26","email":"elias.mü[email protected]"}', 'email', 'eb7570a3-9ffc-4260-bfca-d45bfe128c26', now(), now(), now()),
|
||||
('584eed6e-d953-4672-b7c8-891d0674e7f9', '584eed6e-d953-4672-b7c8-891d0674e7f9', '{"sub":"584eed6e-d953-4672-b7c8-891d0674e7f9","email":"[email protected]"}', 'email', '584eed6e-d953-4672-b7c8-891d0674e7f9', now(), now(), now()),
|
||||
('74a99e87-42b3-4d0a-bc5c-635b22dc2023', '74a99e87-42b3-4d0a-bc5c-635b22dc2023', '{"sub":"74a99e87-42b3-4d0a-bc5c-635b22dc2023","email":"[email protected]"}', 'email', '74a99e87-42b3-4d0a-bc5c-635b22dc2023', now(), now(), now()),
|
||||
('311399c5-d98c-4785-a94c-617982503e14', '311399c5-d98c-4785-a94c-617982503e14', '{"sub":"311399c5-d98c-4785-a94c-617982503e14","email":"[email protected]"}', 'email', '311399c5-d98c-4785-a94c-617982503e14', now(), now(), now()),
|
||||
('78be51e6-65f0-46ad-80d5-2399390ff501', '78be51e6-65f0-46ad-80d5-2399390ff501', '{"sub":"78be51e6-65f0-46ad-80d5-2399390ff501","email":"[email protected]"}', 'email', '78be51e6-65f0-46ad-80d5-2399390ff501', now(), now(), now()),
|
||||
('05a54110-7182-4095-93de-85306ce572d4', '05a54110-7182-4095-93de-85306ce572d4', '{"sub":"05a54110-7182-4095-93de-85306ce572d4","email":"[email protected]"}', 'email', '05a54110-7182-4095-93de-85306ce572d4', now(), now(), now()),
|
||||
('cd6bc4d5-afb0-4da2-99b9-f3e5bb7c5f32', 'cd6bc4d5-afb0-4da2-99b9-f3e5bb7c5f32', '{"sub":"cd6bc4d5-afb0-4da2-99b9-f3e5bb7c5f32","email":"[email protected]"}', 'email', 'cd6bc4d5-afb0-4da2-99b9-f3e5bb7c5f32', now(), now(), now()),
|
||||
('d66f79b9-9dec-4a6a-94e7-82f4b0ad01c0', 'd66f79b9-9dec-4a6a-94e7-82f4b0ad01c0', '{"sub":"d66f79b9-9dec-4a6a-94e7-82f4b0ad01c0","email":"[email protected]"}', 'email', 'd66f79b9-9dec-4a6a-94e7-82f4b0ad01c0', now(), now(), now()),
|
||||
('bb7736de-d32a-41d7-b2d9-ee64275b145e', 'bb7736de-d32a-41d7-b2d9-ee64275b145e', '{"sub":"bb7736de-d32a-41d7-b2d9-ee64275b145e","email":"[email protected]"}', 'email', 'bb7736de-d32a-41d7-b2d9-ee64275b145e', now(), now(), now()),
|
||||
('f09aca1d-4d95-49a6-a9e0-6f1362fe8361', 'f09aca1d-4d95-49a6-a9e0-6f1362fe8361', '{"sub":"f09aca1d-4d95-49a6-a9e0-6f1362fe8361","email":"[email protected]"}', 'email', 'f09aca1d-4d95-49a6-a9e0-6f1362fe8361', now(), now(), now()),
|
||||
('d1bbda95-3df1-4c3b-95ee-ed1eb523d30e', 'd1bbda95-3df1-4c3b-95ee-ed1eb523d30e', '{"sub":"d1bbda95-3df1-4c3b-95ee-ed1eb523d30e","email":"[email protected]"}', 'email', 'd1bbda95-3df1-4c3b-95ee-ed1eb523d30e', now(), now(), now()),
|
||||
('e9fa34ff-9215-4397-8c1e-1f00ced2fecd', 'e9fa34ff-9215-4397-8c1e-1f00ced2fecd', '{"sub":"e9fa34ff-9215-4397-8c1e-1f00ced2fecd","email":"[email protected]"}', 'email', 'e9fa34ff-9215-4397-8c1e-1f00ced2fecd', now(), now(), now()),
|
||||
('83766fe2-2e9f-41ca-9862-3a7459fdea9f', '83766fe2-2e9f-41ca-9862-3a7459fdea9f', '{"sub":"83766fe2-2e9f-41ca-9862-3a7459fdea9f","email":"[email protected]"}', 'email', '83766fe2-2e9f-41ca-9862-3a7459fdea9f', now(), now(), now()),
|
||||
('6801de1c-802d-4ec6-9781-17f5ffd20cbe', '6801de1c-802d-4ec6-9781-17f5ffd20cbe', '{"sub":"6801de1c-802d-4ec6-9781-17f5ffd20cbe","email":"[email protected]"}', 'email', '6801de1c-802d-4ec6-9781-17f5ffd20cbe', now(), now(), now()),
|
||||
('67cddcb9-c467-48cf-a3dc-4d48fdd1cd4b', '67cddcb9-c467-48cf-a3dc-4d48fdd1cd4b', '{"sub":"67cddcb9-c467-48cf-a3dc-4d48fdd1cd4b","email":"[email protected]"}', 'email', '67cddcb9-c467-48cf-a3dc-4d48fdd1cd4b', now(), now(), now()),
|
||||
('f1e37d99-2f8e-4a92-8138-68ef50bb94d9', 'f1e37d99-2f8e-4a92-8138-68ef50bb94d9', '{"sub":"f1e37d99-2f8e-4a92-8138-68ef50bb94d9","email":"[email protected]"}', 'email', 'f1e37d99-2f8e-4a92-8138-68ef50bb94d9', now(), now(), now()),
|
||||
('a6d3f6a1-a01e-431a-9338-28d55b69b0d6', 'a6d3f6a1-a01e-431a-9338-28d55b69b0d6', '{"sub":"a6d3f6a1-a01e-431a-9338-28d55b69b0d6","email":"[email protected]"}', 'email', 'a6d3f6a1-a01e-431a-9338-28d55b69b0d6', now(), now(), now()),
|
||||
('c4fece75-2a7d-46c3-b968-d76c5ec97d47', 'c4fece75-2a7d-46c3-b968-d76c5ec97d47', '{"sub":"c4fece75-2a7d-46c3-b968-d76c5ec97d47","email":"[email protected]"}', 'email', 'c4fece75-2a7d-46c3-b968-d76c5ec97d47', now(), now(), now()),
|
||||
('692cd876-e621-44d4-b152-f36397684392', '692cd876-e621-44d4-b152-f36397684392', '{"sub":"692cd876-e621-44d4-b152-f36397684392","email":"[email protected]"}', 'email', '692cd876-e621-44d4-b152-f36397684392', now(), now(), now()),
|
||||
('0e4d3be9-f1c6-4278-9e6e-2f7f80956830', '0e4d3be9-f1c6-4278-9e6e-2f7f80956830', '{"sub":"0e4d3be9-f1c6-4278-9e6e-2f7f80956830","email":"[email protected]"}', 'email', '0e4d3be9-f1c6-4278-9e6e-2f7f80956830', now(), now(), now()),
|
||||
('299e0882-fb69-43b2-b496-04a628865953', '299e0882-fb69-43b2-b496-04a628865953', '{"sub":"299e0882-fb69-43b2-b496-04a628865953","email":"[email protected]"}', 'email', '299e0882-fb69-43b2-b496-04a628865953', now(), now(), now()),
|
||||
('8d3d4484-4f82-4ac4-85b0-89aa01d415f1', '8d3d4484-4f82-4ac4-85b0-89aa01d415f1', '{"sub":"8d3d4484-4f82-4ac4-85b0-89aa01d415f1","email":"[email protected]"}', 'email', '8d3d4484-4f82-4ac4-85b0-89aa01d415f1', now(), now(), now()),
|
||||
('51a4fecc-e038-4ffb-b715-a3d4e1c1e7d7', '51a4fecc-e038-4ffb-b715-a3d4e1c1e7d7', '{"sub":"51a4fecc-e038-4ffb-b715-a3d4e1c1e7d7","email":"[email protected]"}', 'email', '51a4fecc-e038-4ffb-b715-a3d4e1c1e7d7', now(), now(), now()),
|
||||
('88907380-da12-4ccb-9f33-b8ab4a00d6d0', '88907380-da12-4ccb-9f33-b8ab4a00d6d0', '{"sub":"88907380-da12-4ccb-9f33-b8ab4a00d6d0","email":"[email protected]"}', 'email', '88907380-da12-4ccb-9f33-b8ab4a00d6d0', now(), now(), now()),
|
||||
('b3275d03-3b89-477c-9881-2b0a0e2e3ce9', 'b3275d03-3b89-477c-9881-2b0a0e2e3ce9', '{"sub":"b3275d03-3b89-477c-9881-2b0a0e2e3ce9","email":"[email protected]"}', 'email', 'b3275d03-3b89-477c-9881-2b0a0e2e3ce9', now(), now(), now()),
|
||||
('74b47dc2-0eb7-44b5-8faa-6ceaae4d8a3d', '74b47dc2-0eb7-44b5-8faa-6ceaae4d8a3d', '{"sub":"74b47dc2-0eb7-44b5-8faa-6ceaae4d8a3d","email":"[email protected]"}', 'email', '74b47dc2-0eb7-44b5-8faa-6ceaae4d8a3d', now(), now(), now()),
|
||||
('66d71898-d8c4-4d95-847a-496e899d8e9a', '66d71898-d8c4-4d95-847a-496e899d8e9a', '{"sub":"66d71898-d8c4-4d95-847a-496e899d8e9a","email":"[email protected]"}', 'email', '66d71898-d8c4-4d95-847a-496e899d8e9a', now(), now(), now()),
|
||||
('bed7dceb-8be7-4a71-a4aa-3b344da4dbb9', 'bed7dceb-8be7-4a71-a4aa-3b344da4dbb9', '{"sub":"bed7dceb-8be7-4a71-a4aa-3b344da4dbb9","email":"[email protected]"}', 'email', 'bed7dceb-8be7-4a71-a4aa-3b344da4dbb9', now(), now(), now()),
|
||||
('3ff5d5d5-204b-46fe-a5cc-2db6e8c643f0', '3ff5d5d5-204b-46fe-a5cc-2db6e8c643f0', '{"sub":"3ff5d5d5-204b-46fe-a5cc-2db6e8c643f0","email":"[email protected]"}', 'email', '3ff5d5d5-204b-46fe-a5cc-2db6e8c643f0', now(), now(), now()),
|
||||
('3c39579c-4216-4206-9346-46fe69c2c280', '3c39579c-4216-4206-9346-46fe69c2c280', '{"sub":"3c39579c-4216-4206-9346-46fe69c2c280","email":"[email protected]"}', 'email', '3c39579c-4216-4206-9346-46fe69c2c280', now(), now(), now()),
|
||||
('661359f0-8771-4dc8-a517-58822e2f60be', '661359f0-8771-4dc8-a517-58822e2f60be', '{"sub":"661359f0-8771-4dc8-a517-58822e2f60be","email":"[email protected]"}', 'email', '661359f0-8771-4dc8-a517-58822e2f60be', now(), now(), now()),
|
||||
('e1a2c232-2dcd-462f-afc8-01b2e4c1646d', 'e1a2c232-2dcd-462f-afc8-01b2e4c1646d', '{"sub":"e1a2c232-2dcd-462f-afc8-01b2e4c1646d","email":"[email protected]"}', 'email', 'e1a2c232-2dcd-462f-afc8-01b2e4c1646d', now(), now(), now()),
|
||||
('8bb02227-1008-436c-93ae-d4dbe8c8a063', '8bb02227-1008-436c-93ae-d4dbe8c8a063', '{"sub":"8bb02227-1008-436c-93ae-d4dbe8c8a063","email":"[email protected]"}', 'email', '8bb02227-1008-436c-93ae-d4dbe8c8a063', now(), now(), now()),
|
||||
('8ca780f4-dea0-4848-80d0-12f7529193a6', '8ca780f4-dea0-4848-80d0-12f7529193a6', '{"sub":"8ca780f4-dea0-4848-80d0-12f7529193a6","email":"[email protected]"}', 'email', '8ca780f4-dea0-4848-80d0-12f7529193a6', now(), now(), now()),
|
||||
('a6607c2b-9adc-4eaf-95d1-357076b8ef96', 'a6607c2b-9adc-4eaf-95d1-357076b8ef96', '{"sub":"a6607c2b-9adc-4eaf-95d1-357076b8ef96","email":"[email protected]"}', 'email', 'a6607c2b-9adc-4eaf-95d1-357076b8ef96', now(), now(), now()),
|
||||
('2eb5e467-eb1e-4c96-a1c8-748173676da4', '2eb5e467-eb1e-4c96-a1c8-748173676da4', '{"sub":"2eb5e467-eb1e-4c96-a1c8-748173676da4","email":"[email protected]"}', 'email', '2eb5e467-eb1e-4c96-a1c8-748173676da4', now(), now(), now()),
|
||||
('c46da711-f429-4410-adde-21d7c6846aef', 'c46da711-f429-4410-adde-21d7c6846aef', '{"sub":"c46da711-f429-4410-adde-21d7c6846aef","email":"[email protected]"}', 'email', 'c46da711-f429-4410-adde-21d7c6846aef', now(), now(), now()) on conflict (id) do nothing;
|
||||
|
||||
-- -----------------------------------------------------------------------------
|
||||
-- CONTACTS (PK = email). 50 attendees + 4 staff (is_admin = admin role).
|
||||
-- CONTACTS (PK = email). 4 staff (is_admin = admin role).
|
||||
-- -----------------------------------------------------------------------------
|
||||
insert into public.contacts (email, full_name, linkedin_url, show_email, show_linkedin, is_admin, password) values
|
||||
('[email protected]', 'Lena Huber', null, false, false, false, null),
|
||||
('[email protected]', 'Felix Berger', null, false, false, false, null),
|
||||
('[email protected]', 'Mia Moser', null, false, false, false, null),
|
||||
('[email protected]', 'Jonas Unger', null, false, false, false, null),
|
||||
('[email protected]', 'Emma Dorfer', null, false, false, false, null),
|
||||
('[email protected]', 'Paul Klein', null, false, false, false, null),
|
||||
('[email protected]', 'Hannah Steiner', null, false, false, false, null),
|
||||
('[email protected]', 'Lukas Fischer', null, false, false, false, null),
|
||||
('[email protected]', 'Sofia Oberhuber', null, false, false, false, null),
|
||||
('[email protected]', 'David Winkler', null, false, false, false, null),
|
||||
('[email protected]', 'Clara Falk', null, false, false, false, null),
|
||||
('[email protected]', 'Max Wagner', null, false, false, false, null),
|
||||
('[email protected]', 'Ella Hofer', null, false, false, false, null),
|
||||
('[email protected]', 'Finn Hofmann', null, false, false, false, null),
|
||||
('[email protected]', 'Livia Rainer', null, false, false, false, null),
|
||||
('[email protected]', 'Noah Aigner', null, false, false, false, null),
|
||||
('[email protected]', 'Mara Hartl', null, false, false, false, null),
|
||||
('elias.mü[email protected]', 'Elias Müller', null, false, false, false, null),
|
||||
('[email protected]', 'Nora Pichler', null, false, false, false, null),
|
||||
('[email protected]', 'Ben Lederer', null, false, false, false, null),
|
||||
('[email protected]', 'Ida Tausch', null, false, false, false, null),
|
||||
('[email protected]', 'Oscar Cerny', null, false, false, false, null),
|
||||
('[email protected]', 'Freja Jank', null, false, false, false, null),
|
||||
('[email protected]', 'Hugo Gruber', null, false, false, false, null),
|
||||
('[email protected]', 'Alma Egger', null, false, false, false, null),
|
||||
('[email protected]', 'Theo Nagl', null, false, false, false, null),
|
||||
('[email protected]', 'Greta Vogler', null, false, false, false, null),
|
||||
('[email protected]', 'Milo Eisen', null, false, false, false, null),
|
||||
('[email protected]', 'Vera Lorenz', null, false, false, false, null),
|
||||
('[email protected]', 'Arno Maier', null, false, false, false, null),
|
||||
('[email protected]', 'Lotte Graf', null, false, false, false, null),
|
||||
('[email protected]', 'Kai Pfeiffer', null, false, false, false, null),
|
||||
('[email protected]', 'Mira Zech', null, false, false, false, null),
|
||||
('[email protected]', 'Erik Gassner', null, false, false, false, null),
|
||||
('[email protected]', 'Anna Schmidt', null, false, false, false, null),
|
||||
('[email protected]', 'Tobias Wolfer', null, false, false, false, null),
|
||||
('[email protected]', 'Lena Keller', null, false, false, false, null),
|
||||
('[email protected]', 'Samuel Sailer', null, false, false, false, null),
|
||||
('[email protected]', 'Julia Bauer', null, false, false, false, null),
|
||||
('[email protected]', 'Moritz Ismail', null, false, false, false, null),
|
||||
('[email protected]', 'Eva Huber', null, false, false, false, null),
|
||||
('[email protected]', 'Leon Berger', null, false, false, false, null),
|
||||
('[email protected]', 'Klara Moser', null, false, false, false, null),
|
||||
('[email protected]', 'Felix Unger', null, false, false, false, null),
|
||||
('[email protected]', 'Nina Dorfer', null, false, false, false, null),
|
||||
('[email protected]', 'Jan Klein', null, false, false, false, null),
|
||||
('[email protected]', 'Lena Steiner', null, false, false, false, null),
|
||||
('[email protected]', 'Paul Fischer', null, false, false, false, null),
|
||||
('[email protected]', 'Sara Oberhuber', null, false, false, false, null),
|
||||
('[email protected]', 'Markus Winkler', null, false, false, false, null),
|
||||
('[email protected]', 'Amelia Hernandez', null, false, false, true, 'appe-admin-2026'),
|
||||
('[email protected]', 'Sabrina Hota', null, false, false, true, 'appe-admin-2026'),
|
||||
('[email protected]', 'Jose Lago', null, false, false, true, 'appe-admin-2026'),
|
||||
@@ -193,60 +43,10 @@ insert into public.events (id, name, start_date, end_date, location, is_active,
|
||||
on conflict (id) do update set name = excluded.name, start_date = excluded.start_date, end_date = excluded.end_date, location = excluded.location, is_active = true, sessionize_endpoint = excluded.sessionize_endpoint;
|
||||
|
||||
-- -----------------------------------------------------------------------------
|
||||
-- REGISTRATIONS (50 attendee + 4 staff). Speaker registrations are created by
|
||||
-- REGISTRATIONS (4 staff). Speaker registrations are created by
|
||||
-- the Excel import (matched by email).
|
||||
-- -----------------------------------------------------------------------------
|
||||
insert into public.registrations (event_id, contact_email, type, checked_in, points, qr_token) values
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1000'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1001'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1002'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1003'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1004'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1005'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1006'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1007'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1008'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1009'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1010'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1011'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1012'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1013'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1014'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1015'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1016'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', 'elias.mü[email protected]', 'attendee', false, 0, 'CVV-ATT-1017'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1018'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1019'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1020'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1021'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1022'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1023'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1024'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1025'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1026'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1027'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1028'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1029'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1030'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1031'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1032'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1033'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1034'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1035'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1036'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1037'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1038'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1039'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1040'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1041'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1042'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1043'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1044'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1045'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1046'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1047'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1048'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 0, 'CVV-ATT-1049'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'staff', false, 0, 'CVV-STF-2000'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'staff', false, 0, 'CVV-STF-2001'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'staff', false, 0, 'CVV-STF-2002'),
|
||||
@@ -458,58 +258,3 @@ from public.registrations r
|
||||
join public.contacts c on c.email = r.contact_email
|
||||
where r.type <> 'staff'
|
||||
on conflict (event_id, contact_email) do update set full_name = excluded.full_name, points = excluded.points, updated_at = now();
|
||||
|
||||
-- -----------------------------------------------------------------------------
|
||||
-- POINTS LOG (a small starting balance per attendee so the board is alive).
|
||||
-- -----------------------------------------------------------------------------
|
||||
insert into public.points_log (event_id, contact_email, delta, category) values
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 5, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 12, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 19, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 26, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 33, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 40, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 7, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 14, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 21, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 28, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 35, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 42, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 9, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 16, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 23, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 30, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 37, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', 'elias.mü[email protected]', 44, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 11, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 18, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 25, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 32, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 39, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 6, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 13, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 20, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 27, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 34, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 41, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 8, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 15, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 22, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 29, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 36, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 43, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 10, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 17, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 24, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 31, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 38, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 5, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 12, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 19, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 26, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 33, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 40, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 7, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 14, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 21, 'admin'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 28, 'admin');
|
||||
@@ -0,0 +1,67 @@
|
||||
\set ON_ERROR_STOP on
|
||||
begin;
|
||||
|
||||
create function pg_temp.assert_admin_entry(p_condition boolean, p_name text)
|
||||
returns void language plpgsql as $$
|
||||
begin
|
||||
if p_condition is distinct from true then raise exception 'FAIL: %', p_name; end if;
|
||||
raise notice 'PASS: %', p_name;
|
||||
end;
|
||||
$$;
|
||||
|
||||
create temporary table admin_entry_identity as
|
||||
select kind, gen_random_uuid() as user_id,
|
||||
'entry-' || kind || '-' || gen_random_uuid() ||
|
||||
case when kind = 'domain' then '@appe.at' else '@example.invalid' end as email
|
||||
from unnest(array['admin', 'domain', 'attendee', 'speaker', 'noauth', 'authonly']) as kind;
|
||||
grant select on admin_entry_identity to anon, authenticated;
|
||||
|
||||
create temporary table admin_entry_before as
|
||||
select
|
||||
(select coalesce(jsonb_agg(to_jsonb(registration) order by registration.id), '[]') from public.registrations registration) as registrations,
|
||||
(select coalesce(jsonb_agg(to_jsonb(checkin) order by checkin.id), '[]') from public.checkins checkin) as checkins,
|
||||
(select coalesce(jsonb_agg(to_jsonb(points) order by points.id), '[]') from public.points_log points) as points_log;
|
||||
|
||||
insert into auth.users(id, instance_id, aud, role, email, encrypted_password, email_confirmed_at, raw_app_meta_data, raw_user_meta_data, created_at, updated_at)
|
||||
select user_id, '00000000-0000-0000-0000-000000000000'::uuid, 'authenticated', 'authenticated', email,
|
||||
'', now(), '{}'::jsonb, '{"is_admin":true}'::jsonb, now(), now()
|
||||
from admin_entry_identity where kind <> 'noauth';
|
||||
insert into public.contacts(email, full_name, is_admin)
|
||||
select email, 'Entry regression ' || kind, kind in ('admin', 'noauth')
|
||||
from admin_entry_identity where kind <> 'authonly';
|
||||
|
||||
select pg_temp.assert_admin_entry(has_function_privilege('anon', 'public.can_request_admin_magic_link(text)', 'execute'), 'anonymous eligibility lookup allowed');
|
||||
select pg_temp.assert_admin_entry(has_function_privilege('authenticated', 'public.can_request_admin_magic_link(text)', 'execute'), 'authenticated eligibility lookup allowed');
|
||||
select pg_temp.assert_admin_entry(not exists (
|
||||
select 1 from pg_proc as routine, lateral aclexplode(routine.proacl) as privilege
|
||||
where routine.oid = 'public.can_request_admin_magic_link(text)'::regprocedure and privilege.grantee = 0
|
||||
), 'no PUBLIC execution grant');
|
||||
|
||||
set local role anon;
|
||||
select pg_temp.assert_admin_entry(public.can_request_admin_magic_link(email), 'flagged admin with Auth user eligible without registration') from admin_entry_identity where kind = 'admin';
|
||||
select pg_temp.assert_admin_entry(public.can_request_admin_magic_link(email), 'existing domain admin eligible') from admin_entry_identity where kind = 'domain';
|
||||
select pg_temp.assert_admin_entry(public.can_request_admin_magic_link(' ' || upper(email) || ' '), 'email normalization supported') from admin_entry_identity where kind = 'admin';
|
||||
select pg_temp.assert_admin_entry(not public.can_request_admin_magic_link(email), 'non-admin attendee denied despite user metadata') from admin_entry_identity where kind = 'attendee';
|
||||
select pg_temp.assert_admin_entry(not public.can_request_admin_magic_link(email), 'non-admin speaker denied despite user metadata') from admin_entry_identity where kind = 'speaker';
|
||||
select pg_temp.assert_admin_entry(not public.can_request_admin_magic_link(email), 'admin contact without Auth user denied') from admin_entry_identity where kind = 'noauth';
|
||||
select pg_temp.assert_admin_entry(not public.can_request_admin_magic_link(email), 'Auth user without contact denied') from admin_entry_identity where kind = 'authonly';
|
||||
select pg_temp.assert_admin_entry(not public.can_request_admin_magic_link(null), 'null denied');
|
||||
select pg_temp.assert_admin_entry(not public.can_request_admin_magic_link(''), 'empty denied');
|
||||
select pg_temp.assert_admin_entry(not public.can_request_admin_magic_link('[email protected]'), 'unknown denied');
|
||||
reset role;
|
||||
|
||||
select set_config('request.jwt.claims', json_build_object('email', email, 'role', 'authenticated', 'user_metadata', json_build_object('is_admin', true))::text, true)
|
||||
from admin_entry_identity where kind = 'attendee';
|
||||
set local role authenticated;
|
||||
select pg_temp.assert_admin_entry(not public.is_admin(), 'callback authorization ignores editable metadata');
|
||||
select pg_temp.assert_admin_entry(not public.can_request_admin_magic_link(email), 'authenticated non-admin still ineligible') from admin_entry_identity where kind = 'attendee';
|
||||
reset role;
|
||||
|
||||
select pg_temp.assert_admin_entry(
|
||||
(select registrations from admin_entry_before) = (select coalesce(jsonb_agg(to_jsonb(registration) order by registration.id), '[]') from public.registrations registration), 'registrations and attendance unchanged');
|
||||
select pg_temp.assert_admin_entry(
|
||||
(select checkins from admin_entry_before) = (select coalesce(jsonb_agg(to_jsonb(checkin) order by checkin.id), '[]') from public.checkins checkin), 'session checkins unchanged');
|
||||
select pg_temp.assert_admin_entry(
|
||||
(select points_log from admin_entry_before) = (select coalesce(jsonb_agg(to_jsonb(points) order by points.id), '[]') from public.points_log points), 'points log unchanged');
|
||||
|
||||
rollback;
|
||||
@@ -0,0 +1,95 @@
|
||||
\set ON_ERROR_STOP on
|
||||
create function pg_temp.assert_speaker_role(p_condition boolean, p_name text) returns void
|
||||
language plpgsql as $$ begin
|
||||
if p_condition is distinct from true then raise exception 'FAIL: %', p_name; end if;
|
||||
raise notice 'PASS: %', p_name;
|
||||
end; $$;
|
||||
|
||||
create temp table role_fixture as select
|
||||
gen_random_uuid() event_a, gen_random_uuid() event_b,
|
||||
gen_random_uuid() talk, gen_random_uuid() service,
|
||||
gen_random_uuid() reverse_talk,
|
||||
'role-ticket-' || gen_random_uuid() || '@example.invalid' ticket_email,
|
||||
'role-first-' || gen_random_uuid() || '@example.invalid' first_email,
|
||||
'role-normal-' || gen_random_uuid() || '@example.invalid' normal_email,
|
||||
'role-staff-' || gen_random_uuid() || '@example.invalid' staff_email,
|
||||
'role-sponsor-' || gen_random_uuid() || '@example.invalid' sponsor_email,
|
||||
'role-service-' || gen_random_uuid() || '@example.invalid' service_email,
|
||||
-5000000-floor(random()*1000000)::integer talk_slot,
|
||||
-7000000-floor(random()*1000000)::integer service_slot;
|
||||
insert into public.events(id,name,start_date,end_date)
|
||||
select event_a,'Role A',date '2026-11-01',date '2026-11-01' from role_fixture
|
||||
union all select event_b,'Role B',date '2026-11-01',date '2026-11-01' from role_fixture;
|
||||
insert into public.contacts(email,full_name)
|
||||
select ticket_email,'Ticket Speaker' from role_fixture
|
||||
union all select first_email,'First Speaker' from role_fixture
|
||||
union all select normal_email,'Normal Attendee' from role_fixture
|
||||
union all select staff_email,'Staff' from role_fixture
|
||||
union all select sponsor_email,'Sponsor' from role_fixture
|
||||
union all select service_email,'Service Only' from role_fixture;
|
||||
insert into public.slots(id,event_id,type,name,slot_date,start_time,end_time)
|
||||
select talk_slot,event_a,'session'::public.slot_type,'Talk',date '2026-11-01',time '09:00',time '10:00' from role_fixture
|
||||
union all select service_slot,event_a,'service_session','Break',date '2026-11-01',time '10:00',time '11:00' from role_fixture;
|
||||
insert into public.sessions(id,event_id,slot_id,title,external_id)
|
||||
select talk,event_a,talk_slot,'Role talk',talk::text from role_fixture
|
||||
union all select reverse_talk,event_a,talk_slot,'Reverse talk',reverse_talk::text from role_fixture
|
||||
union all select service,event_a,service_slot,'Role break',service::text from role_fixture;
|
||||
insert into public.session_speakers(session_id,contact_email)
|
||||
select reverse_talk,first_email from role_fixture
|
||||
union all select service,service_email from role_fixture;
|
||||
select set_config('request.jwt.claims','{"role":"service_role"}',true);
|
||||
create temp table role_sync_result as
|
||||
select public.sync_pretix_attendees(event_a,jsonb_build_array(
|
||||
jsonb_build_object('email',ticket_email,'full_name','Ticket Speaker','ticket_type','attendee','qr_token','role-ticket-qr','external_id','pretix-role'),
|
||||
jsonb_build_object('email',first_email,'full_name','First Speaker','ticket_type','attendee','qr_token','role-first-qr','external_id','pretix-first'),
|
||||
jsonb_build_object('email',normal_email,'full_name','Normal Attendee','ticket_type','attendee','qr_token','role-normal-qr','external_id','pretix-normal'),
|
||||
jsonb_build_object('email',service_email,'full_name','Service Only','ticket_type','attendee','qr_token','role-service-qr','external_id','pretix-service')
|
||||
)) result from role_fixture;
|
||||
select pg_temp.assert_speaker_role(jsonb_array_length(result->'errors')=0,'initial Pretix sync succeeds') from role_sync_result;
|
||||
select pg_temp.assert_speaker_role((select type='attendee' from public.registrations where event_id=f.event_a and contact_email=f.ticket_email),'ordinary ticket starts as attendee') from role_fixture f;
|
||||
select pg_temp.assert_speaker_role((select type='speaker' from public.registrations where event_id=f.event_a and contact_email=f.first_email),'existing assignment promotes new Pretix registration') from role_fixture f;
|
||||
select pg_temp.assert_speaker_role((select type='attendee' from public.registrations where event_id=f.event_a and contact_email=f.service_email),'service-only assignment does not promote attendee') from role_fixture f;
|
||||
update public.registrations set points=23,checked_in=true where contact_email=(select ticket_email from role_fixture);
|
||||
insert into public.sponsors(event_id,type,name,contact_email)
|
||||
select event_a,'community','Role Sponsor',sponsor_email from role_fixture;
|
||||
insert into public.registrations(event_id,contact_email,type)
|
||||
select event_a,staff_email,'staff'::public.registration_type from role_fixture
|
||||
union all select event_a,sponsor_email,'sponsor' from role_fixture
|
||||
union all select event_b,ticket_email,'attendee' from role_fixture;
|
||||
insert into public.session_speakers(session_id,contact_email)
|
||||
select talk,ticket_email from role_fixture
|
||||
union all select talk,staff_email from role_fixture
|
||||
union all select talk,sponsor_email from role_fixture;
|
||||
select pg_temp.assert_speaker_role((select type='speaker' from public.registrations where event_id=f.event_a and contact_email=f.ticket_email),'assignment promotes purchased ticket') from role_fixture f;
|
||||
select pg_temp.assert_speaker_role((select type='attendee' from public.registrations where event_id=f.event_b and contact_email=f.ticket_email),'other event remains attendee') from role_fixture f;
|
||||
select pg_temp.assert_speaker_role((select type='staff' from public.registrations where contact_email=f.staff_email),'staff role preserved') from role_fixture f;
|
||||
select pg_temp.assert_speaker_role((select type='sponsor' from public.registrations where contact_email=f.sponsor_email),'sponsor role preserved') from role_fixture f;
|
||||
update role_sync_result set result=(select public.sync_pretix_attendees(event_a,jsonb_build_array(
|
||||
jsonb_build_object('email',ticket_email,'full_name','Ticket Speaker','ticket_type','attendee','qr_token','role-ticket-qr','external_id','pretix-role')
|
||||
)) from role_fixture);
|
||||
select pg_temp.assert_speaker_role(jsonb_array_length(result->'errors')=0,'repeated Pretix sync succeeds') from role_sync_result;
|
||||
select pg_temp.assert_speaker_role((select type='speaker' and qr_token='role-ticket-qr' and external_id='pretix-role' and checked_in and points=23
|
||||
from public.registrations where event_id=f.event_a and contact_email=f.ticket_email),'Pretix cannot downgrade speaker; ticket and activity preserved') from role_fixture f;
|
||||
update role_sync_result set result=(select public.sync_sessionize_excel(event_a,jsonb_build_object(
|
||||
'speakers',jsonb_build_array(jsonb_build_object('email',ticket_email,'full_name','Ticket Speaker','external_id','sessionize-role')),
|
||||
'sessions',jsonb_build_array(jsonb_build_object('external_id',talk::text,'title','Role talk','date','2026-11-01','start_time','09:00','end_time','10:00',
|
||||
'speakers',jsonb_build_array(ticket_email,staff_email,sponsor_email)))
|
||||
)) from role_fixture);
|
||||
select pg_temp.assert_speaker_role(jsonb_array_length(result->'errors')=0,'Excel replay succeeds') from role_sync_result;
|
||||
select pg_temp.assert_speaker_role((select type='speaker' and qr_token='role-ticket-qr' and external_id='pretix-role' and checked_in and points=23 and import_source='sessionize'
|
||||
from public.registrations where event_id=f.event_a and contact_email=f.ticket_email),'Excel preserves purchased speaker ticket') from role_fixture f;
|
||||
select pg_temp.assert_speaker_role(exists(select 1 from public.session_speakers where session_id=f.talk and contact_email=f.ticket_email),'Excel keeps correct session assignment') from role_fixture f;
|
||||
update role_sync_result set result=(select public.sync_pretix_attendees(event_a,jsonb_build_array(
|
||||
jsonb_build_object('email',ticket_email,'full_name','Ticket Speaker','ticket_type','attendee','qr_token','role-ticket-qr','external_id','pretix-role')
|
||||
)) from role_fixture);
|
||||
select pg_temp.assert_speaker_role(jsonb_array_length(result->'errors')=0,'Pretix after Excel succeeds') from role_sync_result;
|
||||
select pg_temp.assert_speaker_role((select type='speaker' and qr_token='role-ticket-qr' and checked_in and points=23
|
||||
from public.registrations where event_id=f.event_a and contact_email=f.ticket_email),'Excel then Pretix retains speaker role and ticket') from role_fixture f;
|
||||
update public.session_speakers set contact_email=(select normal_email from role_fixture)
|
||||
where session_id=(select reverse_talk from role_fixture) and contact_email=(select first_email from role_fixture);
|
||||
select pg_temp.assert_speaker_role((select type='speaker' from public.registrations where event_id=f.event_a and contact_email=f.normal_email),'assignment update promotes new speaker') from role_fixture f;
|
||||
update public.registrations set type='attendee' where event_id=(select event_a from role_fixture) and contact_email=(select ticket_email from role_fixture);
|
||||
select pg_temp.assert_speaker_role((select type='speaker' from public.registrations where event_id=f.event_a and contact_email=f.ticket_email),'direct downgrade blocked while assigned') from role_fixture f;
|
||||
select pg_temp.assert_speaker_role(not has_function_privilege('anon','public._preserve_assigned_speaker_role()','execute')
|
||||
and not has_function_privilege('authenticated','public._preserve_assigned_speaker_role()','execute'),'internal role trigger not exposed') from role_fixture;
|
||||
rollback;
|
||||
@@ -0,0 +1,131 @@
|
||||
\set ON_ERROR_STOP on
|
||||
create function pg_temp.assert_merge(p_condition boolean, p_name text) returns void
|
||||
language plpgsql as $$ begin
|
||||
if p_condition is distinct from true then raise exception 'FAIL: %', p_name; end if;
|
||||
raise notice 'PASS: %', p_name;
|
||||
end; $$;
|
||||
create function pg_temp.reject_merge(p_source uuid, p_target uuid, p_name text) returns void
|
||||
language plpgsql as $$ begin
|
||||
begin
|
||||
perform public.merge_tickets(p_source, p_target);
|
||||
exception when others then
|
||||
raise notice 'PASS: % rejected', p_name;
|
||||
return;
|
||||
end;
|
||||
raise exception 'FAIL: % was allowed', p_name;
|
||||
end; $$;
|
||||
|
||||
create temporary table merge_fixture as select
|
||||
gen_random_uuid() event_a, gen_random_uuid() event_b,
|
||||
gen_random_uuid() source_id, gen_random_uuid() target_id, gen_random_uuid() other_id,
|
||||
gen_random_uuid() manual_id, gen_random_uuid() staff_id, gen_random_uuid() staff_target_id,
|
||||
gen_random_uuid() session_a, gen_random_uuid() session_b, gen_random_uuid() session_shared,
|
||||
'merge-source-' || gen_random_uuid() || '@example.invalid' source_email,
|
||||
'merge-target-' || gen_random_uuid() || '@example.invalid' target_email,
|
||||
'merge-manual-' || gen_random_uuid() || '@example.invalid' manual_email,
|
||||
'merge-staff-' || gen_random_uuid() || '@example.invalid' staff_email,
|
||||
'merge-staff-ticket-' || gen_random_uuid() || '@example.invalid' staff_target_email,
|
||||
'merge-admin-' || gen_random_uuid() || '@example.invalid' admin_email,
|
||||
-1000000 - floor(random() * 1000000)::integer slot_a,
|
||||
-3000000 - floor(random() * 1000000)::integer slot_b;
|
||||
grant select on merge_fixture to authenticated, anon;
|
||||
insert into public.contacts(email,full_name,is_admin,external_id)
|
||||
select source_email,'Alex Smith',false,'sessionize-test-source' from merge_fixture
|
||||
union all select target_email,'Alex Smith',false,null from merge_fixture
|
||||
union all select manual_email,'Manual Person',false,null from merge_fixture
|
||||
union all select staff_email,'Staff Person',false,'sessionize-test-staff' from merge_fixture
|
||||
union all select staff_target_email,'Staff Ticket',false,null from merge_fixture
|
||||
union all select admin_email,'Merge Admin',true,null from merge_fixture;
|
||||
insert into public.events(id,name,start_date,end_date)
|
||||
select event_a,'Merge A',date '2026-11-01',date '2026-11-01' from merge_fixture
|
||||
union all select event_b,'Merge B',date '2026-12-01',date '2026-12-01' from merge_fixture;
|
||||
insert into public.slots(id,event_id,type,name,slot_date,start_time,end_time)
|
||||
select slot_a,event_a,'session'::public.slot_type,'Merge A',date '2026-11-01',time '09:00',time '10:00' from merge_fixture
|
||||
union all select slot_b,event_b,'session','Merge B',date '2026-12-01',time '09:00',time '10:00' from merge_fixture;
|
||||
insert into public.sessions(id,event_id,slot_id,title,external_id)
|
||||
select session_a,event_a,slot_a,'Merge talk',session_a::text from merge_fixture
|
||||
union all select session_shared,event_a,slot_a,'Shared talk',session_shared::text from merge_fixture
|
||||
union all select session_b,event_b,slot_b,'Other event talk',session_b::text from merge_fixture;
|
||||
insert into public.registrations(id,event_id,contact_email,type,qr_token,external_id,import_source,checked_in)
|
||||
select source_id,event_a,source_email,'speaker'::public.registration_type,null,null,'sessionize',false from merge_fixture
|
||||
union all select target_id,event_a,target_email,'staff',target_id::text,'pretix-target',null,true from merge_fixture
|
||||
union all select other_id,event_b,target_email,'attendee',other_id::text,'pretix-other',null,false from merge_fixture
|
||||
union all select manual_id,event_a,manual_email,'attendee',' ',null,null,true from merge_fixture
|
||||
union all select staff_id,event_a,staff_email,'staff',null,null,'sessionize',false from merge_fixture
|
||||
union all select staff_target_id,event_a,staff_target_email,'attendee',staff_target_id::text,'pretix-staff-target',null,false from merge_fixture;
|
||||
insert into public.session_speakers(session_id,contact_email)
|
||||
select session_a,source_email from merge_fixture
|
||||
union all select session_shared,source_email from merge_fixture
|
||||
union all select session_shared,target_email from merge_fixture
|
||||
union all select session_b,source_email from merge_fixture;
|
||||
update public.registrations set points = 17 where id = (select target_id from merge_fixture);
|
||||
|
||||
select pg_temp.assert_merge((select num_registrations=2 and num_checked_in_registrations=1
|
||||
from public.events where id=(select event_a from merge_fixture)), 'QR-less and blank-QR rows excluded from totals');
|
||||
select pg_temp.assert_merge(not has_function_privilege('anon','public.merge_tickets(uuid,uuid)','execute'), 'anon execution revoked');
|
||||
select pg_temp.assert_merge(has_function_privilege('authenticated','public.merge_tickets(uuid,uuid)','execute'), 'authenticated execution granted');
|
||||
select pg_temp.reject_merge(source_id,target_id,'unauthenticated merge') from merge_fixture;
|
||||
select set_config('request.jwt.claims',jsonb_build_object('sub',gen_random_uuid(),'email',manual_email,'role','authenticated')::text,true) from merge_fixture;
|
||||
set local role authenticated;
|
||||
select pg_temp.reject_merge(source_id,target_id,'non-admin merge') from merge_fixture;
|
||||
reset role;
|
||||
select set_config('request.jwt.claims',jsonb_build_object('sub',gen_random_uuid(),'email',admin_email,'role','authenticated')::text,true) from merge_fixture;
|
||||
set local role authenticated;
|
||||
select pg_temp.reject_merge(source_id,other_id,'cross-event merge') from merge_fixture;
|
||||
select pg_temp.reject_merge(source_id,source_id,'self merge') from merge_fixture;
|
||||
select pg_temp.reject_merge(manual_id,target_id,'manual source') from merge_fixture;
|
||||
select pg_temp.reject_merge(source_id,staff_id,'QR-less destination') from merge_fixture;
|
||||
reset role;
|
||||
update public.registrations set checked_in = true where id = (select source_id from merge_fixture);
|
||||
set local role authenticated;
|
||||
select pg_temp.reject_merge(source_id,target_id,'source attendance must be reconciled') from merge_fixture;
|
||||
reset role;
|
||||
update public.registrations set checked_in = false where id = (select source_id from merge_fixture);
|
||||
set local role authenticated;
|
||||
create temporary table merge_result as select public.merge_tickets(source_id,target_id) result from merge_fixture;
|
||||
reset role;
|
||||
select pg_temp.assert_merge((select (result->>'sessions_transferred')::integer=2 from merge_result), 'two source assignments transferred');
|
||||
select pg_temp.assert_merge(not exists(select 1 from public.registrations where id=(select source_id from merge_fixture)), 'source registration deleted');
|
||||
select pg_temp.assert_merge((select type='staff' and checked_in and points=17 and qr_token=id::text and external_id='pretix-target'
|
||||
from public.registrations where id=(select target_id from merge_fixture)), 'target staff status QR and attendance preserved');
|
||||
select pg_temp.assert_merge((select count(*)=2 from public.session_speakers where contact_email=(select target_email from merge_fixture)
|
||||
and session_id in(select session_a from merge_fixture union all select session_shared from merge_fixture)), 'replacement links inserted without duplicates');
|
||||
select pg_temp.assert_merge(not exists(select 1 from public.session_speakers where contact_email=(select source_email from merge_fixture)
|
||||
and session_id in(select session_a from merge_fixture union all select session_shared from merge_fixture)), 'old event links removed');
|
||||
select pg_temp.assert_merge(exists(select 1 from public.session_speakers where contact_email=(select source_email from merge_fixture)
|
||||
and session_id=(select session_b from merge_fixture)), 'other event speaker link unchanged');
|
||||
select pg_temp.assert_merge(exists(select 1 from public.contacts where email=(select source_email from merge_fixture)), 'source contact preserved');
|
||||
select pg_temp.assert_merge((select type='attendee' from public.registrations where id=(select other_id from merge_fixture)), 'other event registration unchanged');
|
||||
set local role authenticated;
|
||||
select pg_temp.reject_merge(source_id,target_id,'repeated merge') from merge_fixture;
|
||||
select public.merge_tickets(staff_id,staff_target_id) from merge_fixture;
|
||||
reset role;
|
||||
select pg_temp.assert_merge((select type='staff' from public.registrations where id=(select staff_target_id from merge_fixture)), 'staff role transferred to attendee ticket');
|
||||
update public.registrations set type='attendee' where id=(select target_id from merge_fixture);
|
||||
select pg_temp.assert_merge((select type='staff' from public.registrations where id=(select target_id from merge_fixture)), 'later Pretix-style role update cannot downgrade merged role');
|
||||
|
||||
select set_config('request.jwt.claims','{"role":"service_role"}',true);
|
||||
select public.sync_sessionize_excel(event_a,jsonb_build_object(
|
||||
'speakers',jsonb_build_array(jsonb_build_object('email',source_email,'full_name','Alex Smith','external_id','sessionize-test-source')),
|
||||
'sessions',jsonb_build_array(jsonb_build_object('external_id',session_a::text,'title','Merge talk',
|
||||
'date','2026-11-01','start_time','09:00','end_time','10:00','speakers',jsonb_build_array(source_email)))
|
||||
)) from merge_fixture;
|
||||
select pg_temp.assert_merge(not exists(select 1 from public.registrations where contact_email=(select source_email from merge_fixture)
|
||||
and event_id=(select event_a from merge_fixture)), 'Excel reimport does not recreate source');
|
||||
select pg_temp.assert_merge(exists(select 1 from public.session_speakers where contact_email=(select target_email from merge_fixture)
|
||||
and session_id=(select session_a from merge_fixture)), 'Excel reimport retains canonical speaker link');
|
||||
select pg_temp.assert_merge(not exists(select 1 from public.session_speakers where contact_email=(select source_email from merge_fixture)
|
||||
and session_id=(select session_a from merge_fixture)), 'Excel reimport does not restore old link');
|
||||
select pg_temp.assert_merge((select type='staff' from public.registrations where id=(select target_id from merge_fixture)), 'Excel reimport retains merged role');
|
||||
select public.sync_sessionize_excel(event_a,jsonb_build_object('speakers',jsonb_build_array(
|
||||
jsonb_build_object('email',manual_email,'full_name','Manual Person','external_id','sessionize-manual')
|
||||
), 'sessions','[]'::jsonb)) from merge_fixture;
|
||||
select pg_temp.assert_merge((select import_source='sessionize' and type='speaker' from public.registrations
|
||||
where id=(select manual_id from merge_fixture)), 'Excel marks preexisting registrations as imported');
|
||||
select public.sync_sessionize_event(event_a,jsonb_build_object('sessions',jsonb_build_array(
|
||||
jsonb_build_object('external_id',session_a::text,'title','Merge talk','date','2026-11-01',
|
||||
'start_time','09:00','end_time','10:00','speakers',jsonb_build_array(source_email))
|
||||
), 'speakers','[]'::jsonb)) from merge_fixture;
|
||||
select pg_temp.assert_merge(exists(select 1 from public.session_speakers where contact_email=(select target_email from merge_fixture)
|
||||
and session_id=(select session_a from merge_fixture)), 'API reimport retains canonical speaker link');
|
||||
rollback;
|
||||
Reference in new issue
Block a user