Files
circle-collect/src/types.ts
T
2025-09-23 13:25:09 +05:30

95 lines
2.1 KiB
TypeScript

// src/types.ts
export interface ApiResponse<T> {
status: "success" | "error";
message: string;
data?: T;
statusCode: number;
}
export interface MyGroup {
id: string;
groupName: string;
description: string;
visibility: "PUBLIC" | "PRIVATE";
createdByName: string;
currentParticipants: number;
maxParticipants: number;
contributionAmount: number;
cycleType: "MONTHLY" | "QUARTERLY" | "YEARLY";
status: "PENDING" | "ACTIVE" | "COMPLETED";
}
export interface JoinedGroup {
id: string;
groupName: string;
createdBy: string;
}
export interface JoinRequest {
requestId: string;
groupId: string;
groupName: string;
userId: number;
userName: string;
mobile: string;
status: "PENDING";
userAvatar?: string;
}
export interface UserJoinRequest {
createdBy: string;
groupId: string;
groupName: string;
reason: string | null;
requestDate: string;
requestId: any;
status: string;
}
// src/types.ts
// Type for the data received from the GET group details API
export interface GroupDetails {
id: string;
groupName: string;
description: string;
startDate: [number, number, number];
endDate: [number, number, number] | null;
contributionAmount: number;
minParticipants: number;
maxParticipants: number;
portalCharge: number | null;
latePaymentCharge: number | null;
cycleType: 'QUARTERLY' | 'MONTHLY' | 'WEEKLY' | 'CUSTOM';
customCycleDays: number;
withdrawalMethod: 'RANDOM' | 'SEQUENTIAL';
status: 'PENDING' | 'ACTIVE' | 'COMPLETED';
visibility: 'PUBLIC' | 'PRIVATE';
organizerId: string;
organizerFirstName: string;
organizerLastName: string;
organizerMobile: string;
organizerEmail: string;
organizerRole: 'ORGANIZER';
organizerUserId: number;
isActive: boolean;
}
// Type for the payload sent to the edit group API
export interface EditGroupPayload {
groupName: string;
description: string;
visibility: 'PUBLIC' | 'PRIVATE';
cycleType: 'QUARTERLY' | 'MONTHLY' | 'WEEKLY' | 'CUSTOM';
contributionAmount: number;
maxParticipants: number;
latePaymentCharge: number;
customCycleDays: number;
startDate: string; // "YYYY-MM-DD"
endDate: string | null; // "YYYY-MM-DD"
}