website refactor

This commit is contained in:
2026-01-14 16:28:39 +01:00
parent 85e09b6f4d
commit 4b7d82ab43
119 changed files with 2403 additions and 1615 deletions

View File

@@ -1,22 +1,26 @@
import type { DriversLeaderboardDTO } from '@/lib/types/generated/DriversLeaderboardDTO';
import type { DriversViewData } from './DriversViewData';
import type { DriversViewData } from '@/lib/types/view-data/DriversViewData';
/**
* DriversViewDataBuilder
*
* Transforms DriversLeaderboardDTO into ViewData for the drivers listing page.
* Deterministic, side-effect free, no HTTP calls.
*
* This builder does NOT perform filtering or sorting - that belongs in the API.
* If the API doesn't support filtering, it should be marked as NotImplemented.
*/
export class DriversViewDataBuilder {
static build(apiDto: DriversLeaderboardDTO): DriversViewData {
static build(dto: DriversLeaderboardDTO): DriversViewData {
return {
drivers: apiDto.drivers,
totalRaces: apiDto.totalRaces,
totalWins: apiDto.totalWins,
activeCount: apiDto.activeCount,
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,
};
}
}