website cleanup

This commit is contained in:
2025-12-25 00:19:36 +01:00
parent d78854a4c6
commit 9486455b9e
82 changed files with 1223 additions and 363 deletions

View File

@@ -1,22 +1,45 @@
import { RaceDTO } from '../types/generated/RaceDTO';
import { RacesPageDataRaceDTO } from '../types/generated/RacesPageDataRaceDTO';
export class RaceViewModel {
constructor(private readonly dto: RaceDTO, private readonly _status?: string, private readonly _registeredCount?: number, private readonly _strengthOfField?: number) {}
constructor(
private readonly dto: RaceDTO | RacesPageDataRaceDTO,
private readonly _status?: string,
private readonly _registeredCount?: number,
private readonly _strengthOfField?: number
) {}
get id(): string {
return this.dto.id;
}
get name(): string {
return this.dto.name;
if ('name' in this.dto) {
return this.dto.name;
}
return '';
}
get date(): string {
return this.dto.date;
if ('date' in this.dto) {
return this.dto.date;
}
if ('scheduledAt' in this.dto) {
return this.dto.scheduledAt;
}
return '';
}
get track(): string {
return (this.dto as any).track || '';
}
get car(): string {
return (this.dto as any).car || '';
}
get status(): string | undefined {
return this._status;
return this._status || (this.dto as any).status;
}
get registeredCount(): number | undefined {
@@ -24,7 +47,7 @@ export class RaceViewModel {
}
get strengthOfField(): number | undefined {
return this._strengthOfField;
return this._strengthOfField || (this.dto as any).strengthOfField;
}
/** UI-specific: Formatted date */