24 lines
576 B
TypeScript
24 lines
576 B
TypeScript
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';
|
|
}
|
|
}
|