Files
gridpilot.gg/apps/website/lib/view-models/LeagueScheduleViewModel.ts
2026-01-19 14:07:49 +01:00

35 lines
714 B
TypeScript

/**
* View Model for League Schedule
*
* Service layer maps DTOs into these shapes; UI consumes ViewModels only.
*/
export interface LeagueScheduleRaceViewModel {
id: string;
name: string;
scheduledAt: Date;
formattedDate: string;
formattedTime: string;
isPast: boolean;
isUpcoming: boolean;
status: string;
track?: string;
car?: string;
sessionType?: string;
isRegistered?: boolean;
}
export class LeagueScheduleViewModel {
readonly races: LeagueScheduleRaceViewModel[];
constructor(races: LeagueScheduleRaceViewModel[]) {
this.races = races;
}
get raceCount(): number {
return this.races.length;
}
get hasRaces(): boolean {
return this.raceCount > 0;
}
}