Archived
Initial commit
Next.js + Express event management app for Hope Family Church.
This commit is contained in:
@@ -0,0 +1,187 @@
|
||||
export type Role = "user" | "staff" | "supervisor" | "admin";
|
||||
|
||||
export type AuthUser = {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
role: Role;
|
||||
phoneNumber?: string;
|
||||
isActive?: boolean;
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
};
|
||||
|
||||
export type AuthResponse = {
|
||||
token: string;
|
||||
user: AuthUser;
|
||||
};
|
||||
|
||||
export type EventOption = {
|
||||
id: string;
|
||||
name: string;
|
||||
price: number;
|
||||
isMainTicket?: boolean;
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
};
|
||||
|
||||
export type Event = {
|
||||
id: string;
|
||||
title: string;
|
||||
description?: string;
|
||||
startDate: string;
|
||||
endDate: string;
|
||||
registrationDeadline?: string | null;
|
||||
goLiveAt?: string;
|
||||
price: number;
|
||||
picture?: string;
|
||||
isActive?: boolean;
|
||||
options?: EventOption[];
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
cashupStatus?: "open" | "closed";
|
||||
closedAt?: string | null;
|
||||
closedById?: string | null;
|
||||
reopenedAt?: string | null;
|
||||
reopenedById?: string | null;
|
||||
};
|
||||
|
||||
export type EventCostType = "once_off" | "per_item";
|
||||
export type CashupMethod = "cash" | "card" | "eft" | "other";
|
||||
|
||||
export type EventCost = {
|
||||
id: string;
|
||||
eventId: string;
|
||||
eventOptionId?: string | null;
|
||||
eventOption?: Pick<EventOption, "id" | "name"> | null;
|
||||
label: string;
|
||||
costType: EventCostType;
|
||||
amount: number;
|
||||
paidFromMethod?: CashupMethod | null;
|
||||
total?: number;
|
||||
notes?: string | null;
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
};
|
||||
|
||||
export type EventCashupDenomination = {
|
||||
id: string;
|
||||
lineId: string;
|
||||
value: number;
|
||||
count: number;
|
||||
};
|
||||
|
||||
export type EventCashupLine = {
|
||||
id: string;
|
||||
cashupId: string;
|
||||
method: CashupMethod;
|
||||
expectedAmount: number;
|
||||
actualAmount?: number | null;
|
||||
variance?: number | null;
|
||||
notes?: string | null;
|
||||
denominations?: EventCashupDenomination[];
|
||||
};
|
||||
|
||||
export type CashupAction = "closed" | "quick_closed" | "reopened";
|
||||
|
||||
export type EventCashup = {
|
||||
id: string;
|
||||
eventId: string;
|
||||
action: CashupAction;
|
||||
unallocatedDonationsTotal: number;
|
||||
totalCosts: number;
|
||||
totalExpectedRevenue: number;
|
||||
totalActualRevenue?: number | null;
|
||||
notes?: string | null;
|
||||
performedById?: string | null;
|
||||
performedBy?: { id: string; name: string; email: string } | null;
|
||||
createdAt: string;
|
||||
lines?: EventCashupLine[];
|
||||
event?: Pick<Event, "id" | "title">;
|
||||
};
|
||||
|
||||
export type ReconciledByMethod = {
|
||||
expected: number;
|
||||
actual: number | null;
|
||||
variance: number | null;
|
||||
notes?: string | null;
|
||||
denominations: EventCashupDenomination[];
|
||||
};
|
||||
|
||||
export type ReconciledSnapshot = {
|
||||
id: string;
|
||||
action: CashupAction;
|
||||
createdAt: string;
|
||||
performedBy?: { id: string; name: string; email: string } | null;
|
||||
notes?: string | null;
|
||||
byMethod: Record<CashupMethod, ReconciledByMethod>;
|
||||
};
|
||||
|
||||
export type SalesByOption = {
|
||||
eventOptionId: string;
|
||||
name: string;
|
||||
quantitySold: number;
|
||||
revenue: number;
|
||||
};
|
||||
|
||||
export type EventFinancials = {
|
||||
event: Pick<Event, "id" | "title" | "cashupStatus" | "closedAt" | "closedById" | "reopenedAt" | "reopenedById"> & { cashupDraft?: any };
|
||||
paymentsByMethod: Record<CashupMethod, number>;
|
||||
totalRevenue: number;
|
||||
costs: EventCost[];
|
||||
costsByMethod: Record<CashupMethod, number>;
|
||||
untaggedCostsTotal: number;
|
||||
totalCosts: number;
|
||||
expectedCashByMethod: Record<CashupMethod, number>;
|
||||
reconciled: ReconciledSnapshot | null;
|
||||
effectiveGrossIncomeByMethod: Record<CashupMethod, number>;
|
||||
effectiveTotalRevenue: number;
|
||||
netProfit: number;
|
||||
unallocatedDonations: Payment[];
|
||||
unallocatedDonationsTotal: number;
|
||||
totalDonations: number;
|
||||
salesByOption: SalesByOption[];
|
||||
history: EventCashup[];
|
||||
};
|
||||
|
||||
export type RegistrationItem = {
|
||||
id?: string;
|
||||
eventOptionId: string;
|
||||
quantity: number;
|
||||
};
|
||||
|
||||
export type Registration = {
|
||||
id: string;
|
||||
userId: string;
|
||||
eventId: string;
|
||||
status: "pending" | "paid" | string;
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
event?: Pick<Event, "id" | "title" | "price">;
|
||||
options?: RegistrationItem[];
|
||||
};
|
||||
|
||||
export type Ticket = {
|
||||
id: string;
|
||||
qrCode: string;
|
||||
registrationOptionId?: string;
|
||||
userId: string;
|
||||
eventId: string;
|
||||
isUsed: boolean;
|
||||
emailSent: boolean;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
event?: Pick<Event, "id" | "title">;
|
||||
};
|
||||
|
||||
export type Payment = {
|
||||
id: string;
|
||||
amount: number;
|
||||
method: string;
|
||||
userId: string;
|
||||
registrationId?: string;
|
||||
eventId?: string;
|
||||
isDonation?: boolean;
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
};
|
||||
Reference in New Issue
Block a user