fix data flow issues
This commit is contained in:
23
apps/website/lib/view-models/LeagueCardViewModel.ts
Normal file
23
apps/website/lib/view-models/LeagueCardViewModel.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
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.
|
||||
*/
|
||||
export class LeagueCardViewModel {
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
readonly description: string;
|
||||
|
||||
constructor(dto: LeagueCardDTO | LeagueSummaryDTO & { description?: string }) {
|
||||
this.id = dto.id;
|
||||
this.name = dto.name;
|
||||
this.description = dto.description ?? 'Competitive iRacing league';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user