Files
gridpilot.gg/apps/website/lib/view-models/RaceDetailEntryViewModel.ts
Marc Mintel d97f50ed72
Some checks failed
Contract Testing / contract-tests (pull_request) Failing after 6m4s
Contract Testing / contract-snapshot (pull_request) Has been skipped
view data fixes
2026-01-23 11:59:49 +01:00

21 lines
622 B
TypeScript

import { RaceDetailEntryDTO } from '@/lib/types/generated/RaceDetailEntryDTO';
import { ViewModel } from "../contracts/view-models/ViewModel";
export class RaceDetailEntryViewModel extends ViewModel {
id: string;
name: string;
country: string;
avatarUrl: string;
isCurrentUser: boolean;
rating: number | null;
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;
}
}