website refactor
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
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,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user