26 lines
853 B
TypeScript
26 lines
853 B
TypeScript
import type { DriversLeaderboardDTO } from '@/lib/types/generated/DriversLeaderboardDTO';
|
|
import type { DriversViewData } from '@/lib/types/view-data/DriversViewData';
|
|
|
|
export class DriversViewDataBuilder {
|
|
static build(dto: DriversLeaderboardDTO): DriversViewData {
|
|
return {
|
|
drivers: dto.drivers.map(driver => ({
|
|
id: driver.id,
|
|
name: driver.name,
|
|
rating: driver.rating,
|
|
skillLevel: driver.skillLevel,
|
|
category: driver.category,
|
|
nationality: driver.nationality,
|
|
racesCompleted: driver.racesCompleted,
|
|
wins: driver.wins,
|
|
podiums: driver.podiums,
|
|
isActive: driver.isActive,
|
|
rank: driver.rank,
|
|
avatarUrl: driver.avatarUrl,
|
|
})),
|
|
totalRaces: dto.totalRaces,
|
|
totalWins: dto.totalWins,
|
|
activeCount: dto.activeCount,
|
|
};
|
|
}
|
|
} |