22 lines
753 B
TypeScript
22 lines
753 B
TypeScript
import type { DriversLeaderboardDTO } from '@/lib/types/generated/DriversLeaderboardDTO';
|
|
import type { DriversViewData } from './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 {
|
|
return {
|
|
drivers: apiDto.drivers,
|
|
totalRaces: apiDto.totalRaces,
|
|
totalWins: apiDto.totalWins,
|
|
activeCount: apiDto.activeCount,
|
|
};
|
|
}
|
|
} |