resolve manual DTOs

This commit is contained in:
2025-12-18 22:19:40 +01:00
parent 4a3087ae35
commit d617654928
179 changed files with 3716 additions and 1257 deletions

View File

@@ -1,18 +1,10 @@
// Note: No generated DTO available for TeamSummary yet
interface TeamSummaryDTO {
id: string;
name: string;
logoUrl?: string;
memberCount: number;
rating: number;
}
import type { TeamListItemDTO } from '@/lib/types/generated/GetAllTeamsOutputDTO';
export class TeamSummaryViewModel {
id: string;
name: string;
logoUrl?: string;
tag: string;
memberCount: number;
rating: number;
description?: string;
totalWins: number = 0;
totalRaces: number = 0;
@@ -21,23 +13,20 @@ export class TeamSummaryViewModel {
specialization?: string;
region?: string;
languages: string[] = [];
leagues: string[] = [];
private maxMembers = 10; // Assuming max members
constructor(dto: TeamSummaryDTO & { description?: string; totalWins?: number; totalRaces?: number; performanceLevel?: string; isRecruiting?: boolean; specialization?: string; region?: string; languages?: string[] }) {
constructor(dto: TeamListItemDTO) {
this.id = dto.id;
this.name = dto.name;
if (dto.logoUrl !== undefined) this.logoUrl = dto.logoUrl;
this.tag = dto.tag;
this.memberCount = dto.memberCount;
this.rating = dto.rating;
this.description = dto.description;
this.totalWins = dto.totalWins ?? 0;
this.totalRaces = dto.totalRaces ?? 0;
this.performanceLevel = dto.performanceLevel ?? '';
this.isRecruiting = dto.isRecruiting ?? false;
this.specialization = dto.specialization;
this.region = dto.region;
this.languages = dto.languages ?? [];
this.leagues = dto.leagues;
}
/** UI-specific: Whether team is full */
@@ -45,9 +34,9 @@ export class TeamSummaryViewModel {
return this.memberCount >= this.maxMembers;
}
/** UI-specific: Rating display */
get ratingDisplay(): string {
return this.rating.toFixed(0);
/** UI-specific: Tag display */
get tagDisplay(): string {
return `[${this.tag}]`;
}
/** UI-specific: Member count display */