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,25 +1,15 @@
import type { LeagueSummaryDTO } from '@/lib/types/generated/LeagueSummaryDTO';
interface LeagueCardDTO {
id: string;
name: string;
description?: string;
}
/**
* League card view model
* UI representation of a league on the landing page.
*/
import { ViewModel } from "../contracts/view-models/ViewModel";
import type { LeagueCardViewData } from "../view-data/LeagueCardViewData";
export class LeagueCardViewModel extends ViewModel {
readonly id: string;
readonly name: string;
readonly description: string;
private readonly data: LeagueCardViewData;
constructor(dto: LeagueCardDTO | LeagueSummaryDTO & { description?: string }) {
this.id = dto.id;
this.name = dto.name;
this.description = dto.description ?? 'Competitive iRacing league';
constructor(data: LeagueCardViewData) {
super();
this.data = data;
}
get id(): string { return this.data.id; }
get name(): string { return this.data.name; }
get description(): string { return this.data.description ?? 'Competitive iRacing league'; }
}