Setting events up on API v2, pg-boss 11 (1.51.7)

- v2: /events/manage, create, PATCH, deactivate, copy-from, notify-recipients.
- src/services/events.ts (from eventController.js, with the schedule helpers); v1 uses it.
- fetchManagedEvents() for every picker; the event wizard writes through v2.
- pg-boss 11 in its own schema (pgboss_v11); old pgboss schema left in place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ls1vMdg2GYqbnKZmPaX1ot
This commit is contained in:
2026-10-29 11:57:08 +02:00
co-authored by Claude Opus 5.5
parent b2906011fd
commit 2bcc9ac651
43 changed files with 3080 additions and 648 deletions
File diff suppressed because it is too large Load Diff
+698 -1
View File
@@ -4,6 +4,28 @@
*/
export interface paths {
"/events/manage": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/**
* Every event staff can see
* @description Hidden ones too. Upcoming by default; `past`, `inactive` and `closed` (cashed-up) widen it. Campus-scoped staff see their campuses' events and church-wide ones. Not paged — it's what the event pickers search.
*
* **Who:** Staff, supervisors and admins.
*/
get: operations["getEventsManage"];
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/events": {
parameters: {
query?: never;
@@ -19,7 +41,13 @@ export interface paths {
*/
get: operations["getEvents"];
put?: never;
post?: never;
/**
* Create an event
* @description Gets a "Main Ticket" at the event price (unless registration is off). A campus-scoped supervisor must choose one of their campuses.
*
* **Who:** Supervisors and admins.
*/
post: operations["postEvents"];
delete?: never;
options?: never;
head?: never;
@@ -42,6 +70,66 @@ export interface paths {
get: operations["getEventsId"];
put?: never;
post?: never;
/**
* Deactivate an event
* @description Admins only. The event is deactivated, not deleted: registrations, payments and tickets stay.
*
* **Who:** Admins only.
*/
delete: operations["deleteEventsId"];
options?: never;
head?: never;
/**
* Change an event
* @description Only the fields sent change. Sessions save with the event (a refused schedule change saves nothing). A cashed-up event can't change until an admin reopens it. The answer includes `sessionChanges` (added, moved, cancelled… counts) when sessions were sent.
*
* **Who:** Supervisors and admins.
*/
patch: operations["patchEventsId"];
trace?: never;
};
"/events/{id}/copy-from": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/**
* Copy set-up from another event
* @description Allocation groups, and planned costs for admins — used right after copying an event.
*
* **Who:** Supervisors and admins.
*/
post: operations["postEventsIdCopy-from"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/events/{id}/notify-recipients": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/**
* Who gets this event's emails
* @description Registration, payment and daily-summary emails.
*
* **Who:** Supervisors and admins.
*/
get: operations["getEventsIdNotify-recipients"];
/**
* Set who gets this event's emails
* @description **Who:** Supervisors and admins.
*/
put: operations["putEventsIdNotify-recipients"];
post?: never;
delete?: never;
options?: never;
head?: never;
@@ -312,6 +400,106 @@ export interface components {
}
export type $defs = Record<string, never>;
export interface operations {
getEventsManage: {
parameters: {
query?: {
/** @description Include events that have ended */
past?: "true" | "false";
/** @description Include deactivated events */
inactive?: "true" | "false";
/** @description Include cashed-up events (default true) */
closed?: "true" | "false";
/** @description A campus id or slug, or 'all' for church-wide events only */
campus?: string;
};
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
data: ({
id: string;
title: string;
description: string | null;
/** Format: date-time */
startDate: string;
/** Format: date-time */
endDate: string;
isActive: boolean;
isHidden: boolean;
requiresRegistration: boolean;
/** @enum {string} */
scheduleType: "single" | "sessions";
/** @enum {string} */
attendanceMode: "whole" | "pick";
/** @enum {string} */
cashupStatus: "open" | "closed";
campusId: string | null;
seriesId: string | null;
picture: string | null;
eventOptions?: ({
id: string;
name: string;
price: number;
isMainTicket: boolean;
stockLimit: number;
} & {
[key: string]: unknown;
})[];
sessions?: ({
id: string;
label: string | null;
/** Format: date-time */
startsAt: string;
/** Format: date-time */
endsAt: string;
cancelled: boolean;
} & {
[key: string]: unknown;
})[];
} & {
[key: string]: unknown;
})[];
};
};
};
/** @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"];
};
};
};
};
getEvents: {
parameters: {
query?: {
@@ -387,6 +575,116 @@ export interface operations {
};
};
};
postEvents: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": {
title: string;
description?: string | null;
startDate: string;
endDate: string;
price?: number | string;
campusId?: string | null;
seriesId?: string | null;
/** @enum {string} */
scheduleType?: "single" | "sessions";
sessions?: {
[key: string]: unknown;
}[];
} & {
[key: string]: unknown;
};
};
};
responses: {
/** @description OK */
201: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
data: {
id: string;
title: string;
description: string | null;
/** Format: date-time */
startDate: string;
/** Format: date-time */
endDate: string;
isActive: boolean;
isHidden: boolean;
requiresRegistration: boolean;
/** @enum {string} */
scheduleType: "single" | "sessions";
/** @enum {string} */
attendanceMode: "whole" | "pick";
/** @enum {string} */
cashupStatus: "open" | "closed";
campusId: string | null;
seriesId: string | null;
picture: string | null;
eventOptions?: ({
id: string;
name: string;
price: number;
isMainTicket: boolean;
stockLimit: number;
} & {
[key: string]: unknown;
})[];
sessions?: ({
id: string;
label: string | null;
/** Format: date-time */
startsAt: string;
/** Format: date-time */
endsAt: string;
cancelled: boolean;
} & {
[key: string]: unknown;
})[];
} & {
[key: string]: unknown;
};
};
};
};
/** @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"];
};
};
};
};
getEventsId: {
parameters: {
query?: never;
@@ -482,6 +780,405 @@ export interface operations {
};
};
};
deleteEventsId: {
parameters: {
query?: never;
header?: never;
path: {
/** @description The id */
id: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
data: {
id: string;
/** @constant */
isActive: false;
};
};
};
};
/** @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"];
};
};
};
};
patchEventsId: {
parameters: {
query?: never;
header?: never;
path: {
/** @description The id */
id: string;
};
cookie?: never;
};
requestBody: {
content: {
"application/json": {
title?: string;
description?: string | null;
startDate?: string;
endDate?: string;
price?: number | string;
campusId?: string | null;
seriesId?: string | null;
/** @enum {string} */
scheduleType?: "single" | "sessions";
sessions?: {
[key: string]: unknown;
}[];
} & {
[key: string]: unknown;
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
data: {
id: string;
title: string;
description: string | null;
/** Format: date-time */
startDate: string;
/** Format: date-time */
endDate: string;
isActive: boolean;
isHidden: boolean;
requiresRegistration: boolean;
/** @enum {string} */
scheduleType: "single" | "sessions";
/** @enum {string} */
attendanceMode: "whole" | "pick";
/** @enum {string} */
cashupStatus: "open" | "closed";
campusId: string | null;
seriesId: string | null;
picture: string | null;
eventOptions?: ({
id: string;
name: string;
price: number;
isMainTicket: boolean;
stockLimit: number;
} & {
[key: string]: unknown;
})[];
sessions?: ({
id: string;
label: string | null;
/** Format: date-time */
startsAt: string;
/** Format: date-time */
endsAt: string;
cancelled: boolean;
} & {
[key: string]: unknown;
})[];
sessionChanges: {
[key: string]: number;
} | null;
} & {
[key: string]: unknown;
};
};
};
};
/** @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"];
};
};
};
};
"postEventsIdCopy-from": {
parameters: {
query?: never;
header?: never;
path: {
/** @description The id */
id: string;
};
cookie?: never;
};
requestBody: {
content: {
"application/json": {
fromEventId: string;
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
data: {
[key: string]: unknown;
};
};
};
};
/** @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"];
};
};
};
};
"getEventsIdNotify-recipients": {
parameters: {
query?: never;
header?: never;
path: {
/** @description The id */
id: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
data: {
id: string;
name: string;
email: string;
/** @enum {string} */
role: "admin" | "supervisor" | "staff" | "user";
}[];
};
};
};
/** @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"];
};
};
};
};
"putEventsIdNotify-recipients": {
parameters: {
query?: never;
header?: never;
path: {
/** @description The id */
id: string;
};
cookie?: never;
};
requestBody: {
content: {
"application/json": {
userIds: string[];
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
data: {
id: string;
name: string;
email: string;
/** @enum {string} */
role: "admin" | "supervisor" | "staff" | "user";
}[];
};
};
};
/** @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"];
};
};
};
};
postRegistrations: {
parameters: {
query?: never;