Files
gridpilot.gg/apps/website/lib/view-models/TeamJoinRequestViewModel.ts
2025-12-18 00:08:47 +01:00

55 lines
1.2 KiB
TypeScript

// Note: No generated DTO available for TeamJoinRequest yet
interface TeamJoinRequestDTO {
id: string;
teamId: string;
driverId: string;
requestedAt: string;
message?: string;
}
export class TeamJoinRequestViewModel {
id: string;
teamId: string;
driverId: string;
requestedAt: string;
message?: string;
private currentUserId: string;
private isOwner: boolean;
constructor(dto: TeamJoinRequestDTO, currentUserId: string, isOwner: boolean) {
Object.assign(this, dto);
this.currentUserId = currentUserId;
this.isOwner = isOwner;
}
/** UI-specific: Whether current user can approve */
get canApprove(): boolean {
return this.isOwner;
}
/** UI-specific: Formatted requested date */
get formattedRequestedAt(): string {
return new Date(this.requestedAt).toLocaleString();
}
/** UI-specific: Request status (pending) */
get status(): string {
return 'Pending';
}
/** UI-specific: Status color */
get statusColor(): string {
return 'yellow';
}
/** UI-specific: Approve button text */
get approveButtonText(): string {
return 'Approve';
}
/** UI-specific: Reject button text */
get rejectButtonText(): string {
return 'Reject';
}
}