Files
gridpilot.gg/apps/website/lib/view-models/LeagueScheduleViewModel.ts
Marc Mintel d97f50ed72
Some checks failed
Contract Testing / contract-tests (pull_request) Failing after 6m4s
Contract Testing / contract-snapshot (pull_request) Has been skipped
view data fixes
2026-01-23 11:59:49 +01:00

39 lines
880 B
TypeScript

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