25 lines
862 B
TypeScript
25 lines
862 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,
|
|
country: driver.country,
|
|
avatarUrl: driver.avatarUrl || '',
|
|
iracingId: driver.iracingId || null,
|
|
rating: driver.rating || null,
|
|
globalRank: driver.globalRank || null,
|
|
consistency: driver.consistency || null,
|
|
totalRaces: driver.racesCompleted,
|
|
wins: driver.wins,
|
|
isActive: driver.isActive,
|
|
})),
|
|
totalRaces: dto.totalRaces,
|
|
totalWins: dto.totalWins,
|
|
activeCount: dto.activeCount,
|
|
};
|
|
}
|
|
} |