feat(giving): frontend models + API services

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Chris Chen
2026-05-28 16:57:15 -07:00
parent b5a15dd9f2
commit 4a2b142061
4 changed files with 223 additions and 0 deletions
@@ -0,0 +1,119 @@
export type PaymentMethod = 'Cash' | 'Check' | 'Zelle' | 'PayPal' | 'Other';
export type SessionStatus = 'Draft' | 'Submitted' | 'Reconciled';
export interface PagedResult<T> {
items: T[];
totalCount: number;
page: number;
pageSize: number;
totalPages: number;
}
// ── Giving categories ─────────────────────────────────────────────
export interface GivingCategoryDto {
id: number;
name_en: string;
name_zh: string | null;
description_en: string | null;
description_zh: string | null;
isActive: boolean;
sortOrder: number;
}
export interface CreateGivingCategoryRequest {
name_en: string;
name_zh: string | null;
description_en: string | null;
description_zh: string | null;
sortOrder: number;
}
export interface UpdateGivingCategoryRequest extends CreateGivingCategoryRequest {
isActive: boolean;
}
// ── Single giving ─────────────────────────────────────────────────
export interface GivingListItemDto {
id: number;
memberId: number | null;
memberName: string | null;
givingCategoryId: number;
categoryName: string;
amount: number;
paymentMethod: PaymentMethod;
givingDate: string; // yyyy-MM-dd
isAnonymous: boolean;
offeringSessionId: number | null;
}
export interface CreateGivingRequest {
memberId: number | null;
givingCategoryId: number;
amount: number;
paymentMethod: PaymentMethod;
checkNumber: string | null;
zelleReferenceCode: string | null;
payPalTransactionId: string | null;
givingDate: string; // yyyy-MM-dd
isAnonymous: boolean;
notes: string | null;
}
export type UpdateGivingRequest = CreateGivingRequest;
// ── Offering session (batch) ──────────────────────────────────────
export interface OfferingGivingLineRequest {
memberId: number | null;
givingCategoryId: number;
amount: number;
paymentMethod: PaymentMethod;
checkNumber: string | null;
zelleReferenceCode: string | null;
payPalTransactionId: string | null;
isAnonymous: boolean;
notes: string | null;
}
export interface CreateOfferingSessionRequest {
sessionDate: string; // yyyy-MM-dd
cashTotal: number;
checkTotal: number;
notes: string | null;
givings: OfferingGivingLineRequest[];
}
export interface OfferingGivingLineDto {
id: number;
memberId: number | null;
memberName: string | null;
givingCategoryId: number;
categoryName: string;
amount: number;
paymentMethod: PaymentMethod;
checkNumber: string | null;
zelleReferenceCode: string | null;
payPalTransactionId: string | null;
isAnonymous: boolean;
notes: string | null;
}
export interface OfferingSessionDto {
id: number;
sessionDate: string;
status: SessionStatus;
cashTotal: number;
checkTotal: number;
systemTotal: number;
difference: number;
notes: string | null;
givings: OfferingGivingLineDto[];
}
export interface OfferingSessionListItemDto {
id: number;
sessionDate: string;
status: SessionStatus;
cashTotal: number;
checkTotal: number;
systemTotal: number;
difference: number;
lineCount: number;
}
/** A row held in the client-side batch buffer before submit. */
export interface OfferingBufferLine extends OfferingGivingLineRequest {
memberName: string | null; // for display only
categoryName: string; // for display only
}