WIP 1.51.10: registration management on v2 (routes, frontend)
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
+1439
-1
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
import type { Event, Paginated, Payment, User } from "@/types";
|
||||
import type { Event, Paginated, Payment, Registration, User } from "@/types";
|
||||
|
||||
export type ApiOptions = {
|
||||
method?: string;
|
||||
@@ -216,6 +216,23 @@ export async function fetchManagedEvents<T = Event>(token: string | null | undef
|
||||
return data as unknown as T[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Every registration staff may see (API v2 GET /registrations, all pages), newest first, in full.
|
||||
* `unpaid`: only ones still owing; `userId`: one person's.
|
||||
*/
|
||||
export async function fetchAllRegistrations<T = Registration>(token: string | null | undefined, filter: { unpaid?: boolean; userId?: string } = {}): Promise<T[]> {
|
||||
const { apiV2 } = await import("@/lib/apiV2");
|
||||
const out: T[] = [];
|
||||
for (let page = 1; ; page++) {
|
||||
const res = await apiV2("get", "/registrations", {
|
||||
authToken: token,
|
||||
query: { page, limit: 200, unpaid: filter.unpaid ? "true" : "false", ...(filter.userId ? { userId: filter.userId } : {}) },
|
||||
});
|
||||
out.push(...(res.data as unknown as T[]));
|
||||
if (page >= res.meta.pages) return out;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* One event in full (API v2 GET /events/{id}/full): ticket options with what's left, sessions,
|
||||
* form, attachments, bundles. Staff signed in (`authToken`) also see inactive and not-yet-live
|
||||
|
||||
Reference in New Issue
Block a user