API v2 accounts and check-in (1.51.2)
- v2: auth/signup, auth/login (+ code step, rate limited), PATCH /me; check-in look-up and scan returning an outcome for every normal result. Campus rule as v1. - Sign up/login/2FA/profile moved to src/services/auth.ts; scan preview and scan to src/services/checkin.ts. v1 answers unchanged (ServiceError v1Status). - Login, 2FA step, sign up and profile/password pages use v2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ls1vMdg2GYqbnKZmPaX1ot
This commit is contained in:
File diff suppressed because it is too large
Load Diff
+562
-1
@@ -157,7 +157,13 @@ export interface paths {
|
||||
delete?: never;
|
||||
options?: never;
|
||||
head?: never;
|
||||
patch?: never;
|
||||
/**
|
||||
* Change my details
|
||||
* @description Only what is sent changes. A new `password` needs `currentPassword`; it sends a security notice and stops other devices skipping the 2FA code. The answer has a fresh `token` (the old one keeps working).
|
||||
*
|
||||
* **Who:** Any signed-in person.
|
||||
*/
|
||||
patch: operations["patchMe"];
|
||||
trace?: never;
|
||||
};
|
||||
"/me/registrations": {
|
||||
@@ -182,6 +188,104 @@ export interface paths {
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/checkin/{qrCode}": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
/**
|
||||
* Look a ticket up before checking it in
|
||||
* @description Who it is for, how many are left to check in (for today's session on multi-day events, or `sessionId`), and parental consent. Nothing is changed.
|
||||
*
|
||||
* **Who:** Staff, supervisors and admins.
|
||||
*/
|
||||
get: operations["getCheckinQrCode"];
|
||||
put?: never;
|
||||
/**
|
||||
* Check a ticket in
|
||||
* @description Checks in everyone left on the ticket, or `people`. Every normal result is a 200 with an `outcome`:
|
||||
*
|
||||
* `checked_in`, `already_used`, `consent_required` (a supervisor can resend with `overrideConsent`, which is logged), `wrong_event`, `wrong_section`, `section_not_found`, `no_session` (multi-day: nothing open now), `locked` (offline-locked to another device) or `transferred` (handed on; `message` says to whom).
|
||||
*
|
||||
* An unknown code is `NOT_FOUND`.
|
||||
*
|
||||
* **Who:** Staff, supervisors and admins.
|
||||
*/
|
||||
post: operations["postCheckinQrCode"];
|
||||
delete?: never;
|
||||
options?: never;
|
||||
head?: never;
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/auth/signup": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
get?: never;
|
||||
put?: never;
|
||||
/**
|
||||
* Create an account
|
||||
* @description Signs the new account in straight away. `acceptTerms` must be true (the Terms of Use and Privacy Policy); `newsOptIn` is the unticked "News & announcements" box.
|
||||
*
|
||||
* **Who:** Anyone.
|
||||
*/
|
||||
post: operations["postAuthSignup"];
|
||||
delete?: never;
|
||||
options?: never;
|
||||
head?: never;
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/auth/login": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
get?: never;
|
||||
put?: never;
|
||||
/**
|
||||
* Log in
|
||||
* @description With an email address or phone number. Five wrong passwords lock the account for five minutes (`RATE_LIMITED`).
|
||||
*
|
||||
* With two-factor authentication (always for supervisors and admins), the answer is `code_required`: a code was sent by email or WhatsApp — finish with `POST /auth/login/code`.
|
||||
*
|
||||
* **Who:** Anyone.
|
||||
*/
|
||||
post: operations["postAuthLogin"];
|
||||
delete?: never;
|
||||
options?: never;
|
||||
head?: never;
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/auth/login/code": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
get?: never;
|
||||
put?: never;
|
||||
/**
|
||||
* Finish logging in with the code
|
||||
* @description **Who:** Anyone.
|
||||
*/
|
||||
post: operations["postAuthLoginCode"];
|
||||
delete?: never;
|
||||
options?: never;
|
||||
head?: never;
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
}
|
||||
export type webhooks = Record<string, never>;
|
||||
export interface components {
|
||||
@@ -737,6 +841,9 @@ export interface operations {
|
||||
/** @enum {string} */
|
||||
role: "admin" | "supervisor" | "staff" | "user";
|
||||
twoFactorEnabled: boolean;
|
||||
/** @enum {string} */
|
||||
notificationPreference: "email" | "whatsapp" | "both";
|
||||
homeCampusId: string | null;
|
||||
/** Format: date-time */
|
||||
createdAt: string;
|
||||
};
|
||||
@@ -754,6 +861,76 @@ export interface operations {
|
||||
};
|
||||
};
|
||||
};
|
||||
patchMe: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody: {
|
||||
content: {
|
||||
"application/json": {
|
||||
name?: string;
|
||||
/** Format: email */
|
||||
email?: string;
|
||||
/** @description null or empty removes it */
|
||||
phone?: string | null;
|
||||
/** @enum {string} */
|
||||
notificationPreference?: "email" | "whatsapp" | "both";
|
||||
/** @description While campuses are on */
|
||||
homeCampusId?: string | null;
|
||||
password?: string;
|
||||
currentPassword?: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
responses: {
|
||||
/** @description OK */
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": {
|
||||
data: {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
phone: string | null;
|
||||
/** @enum {string} */
|
||||
role: "admin" | "supervisor" | "staff" | "user";
|
||||
twoFactorEnabled: boolean;
|
||||
/** @enum {string} */
|
||||
notificationPreference: "email" | "whatsapp" | "both";
|
||||
homeCampusId: string | null;
|
||||
/** Format: date-time */
|
||||
createdAt: string;
|
||||
};
|
||||
token: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
/** @description Validation failed (VALIDATION_FAILED) */
|
||||
400: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
/** @description Not signed in (UNAUTHENTICATED) */
|
||||
401: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
getMeRegistrations: {
|
||||
parameters: {
|
||||
query?: {
|
||||
@@ -835,4 +1012,388 @@ export interface operations {
|
||||
};
|
||||
};
|
||||
};
|
||||
getCheckinQrCode: {
|
||||
parameters: {
|
||||
query?: {
|
||||
/** @description Multi-day events: the session (default: today's) */
|
||||
sessionId?: string;
|
||||
};
|
||||
header?: never;
|
||||
path: {
|
||||
/** @description The code in the ticket's QR */
|
||||
qrCode: string;
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody?: never;
|
||||
responses: {
|
||||
/** @description OK */
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": {
|
||||
data: {
|
||||
/** @enum {string} */
|
||||
outcome: "found" | "transferred";
|
||||
/** @description For a transferred ticket: who has it now */
|
||||
message: string | null;
|
||||
ticket: {
|
||||
id: string;
|
||||
eventId: string;
|
||||
eventTitle: string | null;
|
||||
ticketName: string | null;
|
||||
variant: string | null;
|
||||
/** @description The attendee named on it, or the person who registered */
|
||||
holder: string | null;
|
||||
quantity: number;
|
||||
/** @description Still to check in (this session, on multi-day events) */
|
||||
remaining: number;
|
||||
session: {
|
||||
id: string;
|
||||
label: string;
|
||||
} | null;
|
||||
/** @description Why no session is open for check-in now */
|
||||
sessionError: string | null;
|
||||
/** @description not_required, given, pending, declined or missing */
|
||||
consentStatus: string;
|
||||
} | null;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
/** @description Validation failed (VALIDATION_FAILED) */
|
||||
400: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
/** @description Not signed in (UNAUTHENTICATED) */
|
||||
401: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
/** @description Not allowed for this role (FORBIDDEN) */
|
||||
403: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
/** @description Not found (NOT_FOUND) */
|
||||
404: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
postCheckinQrCode: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path: {
|
||||
/** @description The code in the ticket's QR */
|
||||
qrCode: string;
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody: {
|
||||
content: {
|
||||
"application/json": {
|
||||
/** @description Refuse tickets for any other event */
|
||||
eventId?: string;
|
||||
/** @description Only tickets valid for this section */
|
||||
sectionId?: string;
|
||||
/** @description Multi-day events: the session (default: today's) */
|
||||
sessionId?: string;
|
||||
/** @description How many to check in (default: everyone left) */
|
||||
people?: number;
|
||||
overrideConsent?: boolean;
|
||||
/** @description This scanner, so its own offline lock doesn't block it */
|
||||
deviceId?: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
responses: {
|
||||
/** @description OK */
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": {
|
||||
data: {
|
||||
/** @enum {string} */
|
||||
outcome: "checked_in" | "already_used" | "consent_required" | "wrong_event" | "wrong_section" | "section_not_found" | "no_session" | "locked" | "transferred";
|
||||
message: string;
|
||||
ticket: {
|
||||
id: string;
|
||||
eventId: string;
|
||||
eventTitle: string | null;
|
||||
/** @description The ticket option, e.g. "Adult" */
|
||||
ticketName: string | null;
|
||||
/** @description People on this ticket */
|
||||
quantity: number;
|
||||
} | null;
|
||||
/** @description People checked in by this request (0 unless checked_in) */
|
||||
checkedIn: number;
|
||||
/** @description Still to check in afterwards */
|
||||
remaining: number | null;
|
||||
session: {
|
||||
id: string;
|
||||
label: string;
|
||||
} | null;
|
||||
consentStatus: string | null;
|
||||
/** @description consent_required: whether you may override */
|
||||
canOverride: boolean;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
/** @description Validation failed (VALIDATION_FAILED) */
|
||||
400: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
/** @description Not signed in (UNAUTHENTICATED) */
|
||||
401: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
/** @description Not allowed for this role (FORBIDDEN) */
|
||||
403: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
/** @description Not found (NOT_FOUND) */
|
||||
404: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
postAuthSignup: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody: {
|
||||
content: {
|
||||
"application/json": {
|
||||
name: string;
|
||||
/** Format: email */
|
||||
email: string;
|
||||
password: string;
|
||||
phone?: string;
|
||||
/**
|
||||
* @description WhatsApp needs a valid South African number; otherwise email is used
|
||||
* @enum {string}
|
||||
*/
|
||||
notificationPreference?: "email" | "whatsapp" | "both";
|
||||
newsOptIn?: boolean;
|
||||
/** @constant */
|
||||
acceptTerms: true;
|
||||
};
|
||||
};
|
||||
};
|
||||
responses: {
|
||||
/** @description OK */
|
||||
201: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": {
|
||||
data: {
|
||||
/** @constant */
|
||||
status: "signed_in";
|
||||
/** @description Send as `Authorization: Bearer <token>` */
|
||||
token: string;
|
||||
user: {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
/** @enum {string} */
|
||||
role: "admin" | "supervisor" | "staff" | "user";
|
||||
};
|
||||
/** @description Ask once whether they want News & announcements */
|
||||
newsPromptPending: boolean;
|
||||
/** @description A privacy notice they must accept: never accepted (first) or a newer version (updated) */
|
||||
noticePromptPending: false | ("first" | "updated");
|
||||
/** @description With rememberDevice: send it with the next login to skip the code on this device */
|
||||
deviceToken?: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
/** @description Validation failed (VALIDATION_FAILED) */
|
||||
400: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
postAuthLogin: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody: {
|
||||
content: {
|
||||
"application/json": {
|
||||
/** @description Email address or phone number */
|
||||
identifier: string;
|
||||
password: string;
|
||||
/** @description From an earlier login with rememberDevice */
|
||||
deviceToken?: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
responses: {
|
||||
/** @description OK */
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": {
|
||||
data: {
|
||||
/** @constant */
|
||||
status: "signed_in";
|
||||
/** @description Send as `Authorization: Bearer <token>` */
|
||||
token: string;
|
||||
user: {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
/** @enum {string} */
|
||||
role: "admin" | "supervisor" | "staff" | "user";
|
||||
};
|
||||
/** @description Ask once whether they want News & announcements */
|
||||
newsPromptPending: boolean;
|
||||
/** @description A privacy notice they must accept: never accepted (first) or a newer version (updated) */
|
||||
noticePromptPending: false | ("first" | "updated");
|
||||
/** @description With rememberDevice: send it with the next login to skip the code on this device */
|
||||
deviceToken?: string;
|
||||
} | {
|
||||
/** @constant */
|
||||
status: "code_required";
|
||||
challengeId: string;
|
||||
/** @enum {string} */
|
||||
method: "email" | "whatsapp";
|
||||
/** @description Where the code went, partly hidden */
|
||||
destination: string | null;
|
||||
/** @description true = this turns two-factor on (required for the role) */
|
||||
enrolling: boolean;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
/** @description Validation failed (VALIDATION_FAILED) */
|
||||
400: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
postAuthLoginCode: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody: {
|
||||
content: {
|
||||
"application/json": {
|
||||
challengeId: string;
|
||||
code: string;
|
||||
/** @description Skip the code on this device next time (30 days) */
|
||||
rememberDevice?: boolean;
|
||||
};
|
||||
};
|
||||
};
|
||||
responses: {
|
||||
/** @description OK */
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": {
|
||||
data: {
|
||||
/** @constant */
|
||||
status: "signed_in";
|
||||
/** @description Send as `Authorization: Bearer <token>` */
|
||||
token: string;
|
||||
user: {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
/** @enum {string} */
|
||||
role: "admin" | "supervisor" | "staff" | "user";
|
||||
};
|
||||
/** @description Ask once whether they want News & announcements */
|
||||
newsPromptPending: boolean;
|
||||
/** @description A privacy notice they must accept: never accepted (first) or a newer version (updated) */
|
||||
noticePromptPending: false | ("first" | "updated");
|
||||
/** @description With rememberDevice: send it with the next login to skip the code on this device */
|
||||
deviceToken?: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
/** @description Validation failed (VALIDATION_FAILED) */
|
||||
400: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user