Archived
Type more frontend pages and fix their hook dependencies
Cashup, users, profile, consent, allocations, event options, forms, event tickets, ticket scanning and manual registration now use real types. Data loaders are wrapped in useCallback and listed as effect dependencies. Also adds shared Attendee, Section and form response types. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -212,6 +212,16 @@ export type ReconciledSnapshot = {
|
||||
byMethod: Record<CashupMethod, ReconciledByMethod>;
|
||||
};
|
||||
|
||||
// Reconciliation figures saved part-way through, before the event is closed.
|
||||
export type CashupDraft = {
|
||||
lines?: {
|
||||
method: string;
|
||||
actualAmount?: string | number;
|
||||
notes?: string;
|
||||
denominations?: { value: number; count: number }[];
|
||||
}[];
|
||||
};
|
||||
|
||||
export type SalesByOption = {
|
||||
eventOptionId: string;
|
||||
name: string;
|
||||
@@ -220,7 +230,7 @@ export type SalesByOption = {
|
||||
};
|
||||
|
||||
export type EventFinancials = {
|
||||
event: Pick<Event, "id" | "title" | "cashupStatus" | "closedAt" | "closedById" | "reopenedAt" | "reopenedById"> & { cashupDraft?: any };
|
||||
event: Pick<Event, "id" | "title" | "cashupStatus" | "closedAt" | "closedById" | "reopenedAt" | "reopenedById"> & { cashupDraft?: CashupDraft | null };
|
||||
paymentsByMethod: Record<CashupMethod, number>;
|
||||
totalRevenue: number;
|
||||
costs: EventCost[];
|
||||
@@ -251,6 +261,18 @@ export type RegistrationOption = {
|
||||
variant?: OptionVariant | null;
|
||||
};
|
||||
|
||||
// A named person on a group registration, for one main-ticket place.
|
||||
export type Attendee = {
|
||||
id: string; eventOptionId: string; variantId: string | null; name: string; email: string | null; phone: string | null;
|
||||
registrationId?: string; registrationOptionId?: string | null; userId?: string | null; order?: number;
|
||||
dateOfBirth?: string | null; gender?: string | null; parentName?: string | null; parentEmail?: string | null; parentPhone?: string | null;
|
||||
ticket?: { id: string; isUsed: boolean } | null;
|
||||
consentRequests?: { id: string; status: "pending" | "given" | "declined" }[];
|
||||
};
|
||||
|
||||
export type FormAnswer = { id: string; responseId?: string; fieldId: string; value: string };
|
||||
export type FormResponse = { id: string; registrationId?: string; attendeeId?: string | null; createdAt?: string; answers?: FormAnswer[] };
|
||||
|
||||
export type Registration = {
|
||||
id: string;
|
||||
userId: string;
|
||||
@@ -264,6 +286,8 @@ export type Registration = {
|
||||
event?: Event;
|
||||
registrationOptions?: RegistrationOption[];
|
||||
payments?: Payment[];
|
||||
formResponses?: FormResponse[];
|
||||
attendees?: Attendee[];
|
||||
// Tranche-aware total the backend attaches to registration responses.
|
||||
totalDueComputed?: number | null;
|
||||
};
|
||||
@@ -282,8 +306,10 @@ export type Ticket = {
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
user?: UserSummary;
|
||||
attendee?: { id: string; name: string; email?: string | null; phone?: string | null } | null;
|
||||
event?: Event;
|
||||
registrationOption?: RegistrationOption;
|
||||
usages?: { id: string; scannedAt: string; quantityRedeemed?: number }[];
|
||||
};
|
||||
|
||||
export type Payment = {
|
||||
@@ -339,7 +365,7 @@ export type RecentScan = {
|
||||
id: string;
|
||||
eventId?: string;
|
||||
event?: { title: string } | null;
|
||||
registrationOption?: { eventOption?: { name: string } | null } | null;
|
||||
registrationOption?: { eventOption?: { name: string } | null; variant?: { name: string } | null } | null;
|
||||
} | null;
|
||||
};
|
||||
|
||||
@@ -349,3 +375,12 @@ export type DashboardStats = {
|
||||
paymentStats: PaymentStats;
|
||||
activeEventsCount: number;
|
||||
};
|
||||
|
||||
// A scanning section (e.g. "Main hall") and the ticket options valid at it.
|
||||
export type Section = {
|
||||
id: string;
|
||||
eventId: string;
|
||||
name: string;
|
||||
allowedOptions?: { id: string; sectionId?: string; eventOptionId: string; eventOption?: EventOption }[];
|
||||
event?: Pick<Event, "id" | "title">;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user