view models

This commit is contained in:
2025-12-18 00:08:47 +01:00
parent f7a56a92ce
commit 7c449af311
56 changed files with 2594 additions and 206 deletions

View File

@@ -1,6 +1,15 @@
import { RaceListItemDto } from '../dtos';
// Note: No generated DTO available for RaceListItem yet
interface RaceListItemDTO {
id: string;
name: string;
leagueId: string;
leagueName: string;
scheduledTime: string;
status: string;
trackName?: string;
}
export class RaceListItemViewModel implements RaceListItemDto {
export class RaceListItemViewModel {
id: string;
name: string;
leagueId: string;
@@ -9,8 +18,14 @@ export class RaceListItemViewModel implements RaceListItemDto {
status: string;
trackName?: string;
constructor(dto: RaceListItemDto) {
Object.assign(this, dto);
constructor(dto: RaceListItemDTO) {
this.id = dto.id;
this.name = dto.name;
this.leagueId = dto.leagueId;
this.leagueName = dto.leagueName;
this.scheduledTime = dto.scheduledTime;
this.status = dto.status;
if (dto.trackName !== undefined) this.trackName = dto.trackName;
}
/** UI-specific: Formatted scheduled time */