view data fixes

This commit is contained in:
2026-01-23 15:30:23 +01:00
parent e22033be38
commit f8099f04bc
213 changed files with 3466 additions and 3003 deletions

View File

@@ -1,32 +1,15 @@
/**
* 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";
import type { LeagueScheduleRaceViewModel } from "./LeagueScheduleRaceViewModel";
import type { LeagueScheduleViewData } from "../view-data/LeagueScheduleViewData";
export class LeagueScheduleViewModel extends ViewModel {
private readonly data: LeagueScheduleViewData;
readonly races: LeagueScheduleRaceViewModel[];
constructor(races: LeagueScheduleRaceViewModel[]) {
this.races = races;
constructor(data: LeagueScheduleViewData) {
super();
this.data = data;
this.races = data.races;
}
get raceCount(): number {
@@ -36,4 +19,4 @@ export class LeagueScheduleViewModel extends ViewModel {
get hasRaces(): boolean {
return this.raceCount > 0;
}
}
}