resolve manual DTOs
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import type { GetDriverTeamOutputDTO } from '@/lib/types/generated/GetDriverTeamOutputDTO';
|
||||
|
||||
/**
|
||||
* View Model for Driver's Team
|
||||
*
|
||||
@@ -6,21 +8,22 @@
|
||||
export class DriverTeamViewModel {
|
||||
teamId: string;
|
||||
teamName: string;
|
||||
tag: string;
|
||||
role: string;
|
||||
isOwner: boolean;
|
||||
canManage: boolean;
|
||||
|
||||
constructor(dto: { teamId: string; teamName: string; role: string }) {
|
||||
this.teamId = dto.teamId;
|
||||
this.teamName = dto.teamName;
|
||||
this.role = dto.role;
|
||||
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);
|
||||
}
|
||||
|
||||
/** UI-specific: Is owner */
|
||||
get isOwner(): boolean {
|
||||
return this.role === 'owner';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user