Files
gridpilot.gg/apps/website/lib/builders/view-data/DriverProfileViewDataBuilder.ts
2026-01-14 10:51:05 +01:00

21 lines
783 B
TypeScript

import type { GetDriverProfileOutputDTO } from '@/lib/types/generated/GetDriverProfileOutputDTO';
import type { DriverProfileViewData } from './DriverProfileViewData';
/**
* DriverProfileViewDataBuilder
*
* Transforms GetDriverProfileOutputDTO into ViewData for the driver profile page.
* Deterministic, side-effect free, no HTTP calls.
*/
export class DriverProfileViewDataBuilder {
static build(apiDto: GetDriverProfileOutputDTO): DriverProfileViewData {
return {
currentDriver: apiDto.currentDriver || null,
stats: apiDto.stats || null,
finishDistribution: apiDto.finishDistribution || null,
teamMemberships: apiDto.teamMemberships,
socialSummary: apiDto.socialSummary,
extendedProfile: apiDto.extendedProfile || null,
};
}
}