seed data

This commit is contained in:
2025-12-30 00:15:35 +01:00
parent 7a853d4e43
commit ccaa39c39c
22 changed files with 1342 additions and 173 deletions

View File

@@ -27,5 +27,20 @@ export class TeamListItemDTO {
@ApiProperty({ type: [String], required: false })
languages?: string[];
@ApiProperty({ required: false })
totalWins?: number;
@ApiProperty({ required: false })
totalRaces?: number;
@ApiProperty({ required: false, enum: ['beginner', 'intermediate', 'advanced', 'pro'] })
performanceLevel?: 'beginner' | 'intermediate' | 'advanced' | 'pro';
@ApiProperty({ required: false })
logoUrl?: string;
@ApiProperty({ required: false })
rating?: number;
}

View File

@@ -1,6 +1,7 @@
import type { UseCaseOutputPort } from '@core/shared/application/UseCaseOutputPort';
import type { GetAllTeamsResult } from '@core/racing/application/use-cases/GetAllTeamsUseCase';
import { GetAllTeamsOutputDTO } from '../dtos/GetAllTeamsOutputDTO';
import { TeamStatsStore } from '@adapters/racing/services/TeamStatsStore';
export class AllTeamsPresenter implements UseCaseOutputPort<GetAllTeamsResult> {
private model: GetAllTeamsOutputDTO | null = null;
@@ -10,16 +11,41 @@ export class AllTeamsPresenter implements UseCaseOutputPort<GetAllTeamsResult> {
}
present(result: GetAllTeamsResult): void {
const statsStore = TeamStatsStore.getInstance();
this.model = {
teams: result.teams.map(team => ({
id: team.id,
name: team.name.toString(),
tag: team.tag.toString(),
description: team.description?.toString() || '',
memberCount: team.memberCount,
leagues: team.leagues?.map(l => l.toString()) || [],
// Note: specialization, region, languages not available in output
})),
teams: result.teams.map(team => {
const stats = statsStore.getTeamStats(team.id.toString());
return {
id: team.id,
name: team.name.toString(),
tag: team.tag.toString(),
description: team.description?.toString() || '',
memberCount: team.memberCount,
leagues: team.leagues?.map(l => l.toString()) || [],
// Add stats fields
...(stats ? {
totalWins: stats.totalWins,
totalRaces: stats.totalRaces,
performanceLevel: stats.performanceLevel,
specialization: stats.specialization,
region: stats.region,
languages: stats.languages,
logoUrl: stats.logoUrl,
rating: stats.rating,
} : {
totalWins: 0,
totalRaces: 0,
performanceLevel: 'beginner',
specialization: 'mixed',
region: '',
languages: [],
logoUrl: '',
rating: 0,
}),
};
}),
totalCount: result.totalCount ?? result.teams.length,
};
}