Files
gridpilot.gg/apps/website/lib/view-models/DriverTeamViewModel.ts
2025-12-18 22:19:40 +01:00

29 lines
733 B
TypeScript

import type { GetDriverTeamOutputDTO } from '@/lib/types/generated/GetDriverTeamOutputDTO';
/**
* View Model for Driver's Team
*
* Represents a driver's team membership in a UI-ready format.
*/
export class DriverTeamViewModel {
teamId: string;
teamName: string;
tag: string;
role: string;
isOwner: boolean;
canManage: boolean;
constructor(dto: GetDriverTeamOutputDTO) {
this.teamId = dto.team.id;
this.teamName = dto.team.name;
this.tag = dto.team.tag;
this.role = dto.membership.role;
this.isOwner = dto.isOwner;
this.canManage = dto.canManage;
}
/** UI-specific: Display role */
get displayRole(): string {
return this.role.charAt(0).toUpperCase() + this.role.slice(1);
}
}