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

@@ -18,4 +18,19 @@ export class GetDriverOutputDTO {
@ApiProperty()
joinedAt!: string;
@ApiProperty({ required: false })
rating?: number;
@ApiProperty({ required: false })
experienceLevel?: string;
@ApiProperty({ required: false })
wins?: number;
@ApiProperty({ required: false })
podiums?: number;
@ApiProperty({ required: false })
totalRaces?: number;
}

View File

@@ -1,6 +1,7 @@
import { Result } from '@core/shared/application/Result';
import type { Driver } from '@core/racing/domain/entities/Driver';
import type { GetDriverOutputDTO } from '../dtos/GetDriverOutputDTO';
import { DriverStatsStore } from '@adapters/racing/services/DriverStatsStore';
export class DriverPresenter {
private responseModel: GetDriverOutputDTO | null = null;
@@ -18,6 +19,10 @@ export class DriverPresenter {
return;
}
// Get stats from the store
const statsStore = DriverStatsStore.getInstance();
const stats = statsStore.getDriverStats(driver.id);
this.responseModel = {
id: driver.id,
iracingId: driver.iracingId.toString(),
@@ -25,10 +30,25 @@ export class DriverPresenter {
country: driver.country.toString(),
joinedAt: driver.joinedAt.toDate().toISOString(),
...(driver.bio ? { bio: driver.bio.toString() } : {}),
// Add stats fields
...(stats ? {
rating: stats.rating,
wins: stats.wins,
podiums: stats.podiums,
totalRaces: stats.totalRaces,
experienceLevel: this.getExperienceLevel(stats.rating),
} : {}),
};
}
getResponseModel(): GetDriverOutputDTO | null {
return this.responseModel;
}
private getExperienceLevel(rating: number): string {
if (rating >= 1700) return 'veteran';
if (rating >= 1300) return 'advanced';
if (rating >= 1000) return 'intermediate';
return 'beginner';
}
}