28 lines
964 B
TypeScript
28 lines
964 B
TypeScript
import { ViewModel } from "../contracts/view-models/ViewModel";
|
|
import { RaceViewData } from "../view-data/RaceViewData";
|
|
|
|
export class RaceViewModel extends ViewModel {
|
|
private readonly data: RaceViewData;
|
|
|
|
constructor(data: RaceViewData) {
|
|
super();
|
|
this.data = data;
|
|
}
|
|
|
|
get id(): string { return this.data.id; }
|
|
get name(): string { return this.data.name; }
|
|
get date(): string { return this.data.date; }
|
|
get scheduledAt(): string { return this.data.date; }
|
|
get track(): string { return this.data.track; }
|
|
get car(): string { return this.data.car; }
|
|
get status(): string | undefined { return this.data.status; }
|
|
get registeredCount(): number | undefined { return this.data.registeredCount; }
|
|
get strengthOfField(): number | undefined { return this.data.strengthOfField; }
|
|
|
|
/** UI-specific: Formatted date */
|
|
get formattedDate(): string {
|
|
// Client-only formatting
|
|
return new Date(this.date).toLocaleDateString();
|
|
}
|
|
}
|