21 lines
783 B
TypeScript
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,
|
|
};
|
|
}
|
|
} |