view models
This commit is contained in:
22
apps/website/lib/view-models/LeagueScheduleViewModel.ts
Normal file
22
apps/website/lib/view-models/LeagueScheduleViewModel.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* View Model for League Schedule
|
||||
*
|
||||
* Represents the league's race schedule in a UI-ready format.
|
||||
*/
|
||||
export class LeagueScheduleViewModel {
|
||||
races: Array<unknown>;
|
||||
|
||||
constructor(dto: { races: Array<unknown> }) {
|
||||
this.races = dto.races;
|
||||
}
|
||||
|
||||
/** UI-specific: Number of races in the schedule */
|
||||
get raceCount(): number {
|
||||
return this.races.length;
|
||||
}
|
||||
|
||||
/** UI-specific: Whether the schedule has races */
|
||||
get hasRaces(): boolean {
|
||||
return this.raceCount > 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user