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,21 +1,18 @@
import { RaceDetailEntryDTO } from '@/lib/types/generated/RaceDetailEntryDTO';
import { ViewModel } from "../contracts/view-models/ViewModel";
import type { RaceDetailEntryViewData } from "../view-data/RaceDetailEntryViewData";
export class RaceDetailEntryViewModel extends ViewModel {
id: string;
name: string;
country: string;
avatarUrl: string;
isCurrentUser: boolean;
rating: number | null;
private readonly data: RaceDetailEntryViewData;
constructor(dto: RaceDetailEntryDTO, currentDriverId: string, rating?: number) {
this.id = dto.id;
this.name = dto.name;
this.country = dto.country;
this.avatarUrl = dto.avatarUrl || '';
this.isCurrentUser = dto.id === currentDriverId;
this.rating = rating ?? null;
constructor(data: RaceDetailEntryViewData) {
super();
this.data = data;
}
get id(): string { return this.data.id; }
get name(): string { return this.data.name; }
get country(): string { return this.data.country; }
get avatarUrl(): string { return this.data.avatarUrl; }
get isCurrentUser(): boolean { return this.data.isCurrentUser; }
get rating(): number | null { return this.data.rating; }
}