Files
gridpilot.gg/apps/website/lib/view-models/TeamCardViewModel.ts
2025-12-31 15:39:28 +01:00

30 lines
678 B
TypeScript

import type { TeamListItemDTO } from '@/lib/types/generated/TeamListItemDTO';
interface TeamCardDTO {
id: string;
name: string;
tag: string;
description: string;
logoUrl?: string;
}
/**
* Team card view model
* UI representation of a team on the landing page.
*/
export class TeamCardViewModel {
readonly id: string;
readonly name: string;
readonly tag: string;
readonly description: string;
readonly logoUrl?: string;
constructor(dto: TeamCardDTO | TeamListItemDTO) {
this.id = dto.id;
this.name = dto.name;
this.tag = dto.tag;
this.description = dto.description;
this.logoUrl = 'logoUrl' in dto ? dto.logoUrl : undefined;
}
}