25 lines
574 B
TypeScript
25 lines
574 B
TypeScript
import type { HomeViewData } from '@/templates/HomeTemplate';
|
|
import type { HomeDataDTO } from '@/lib/types/dtos/HomeDataDTO';
|
|
|
|
/**
|
|
* HomeViewDataBuilder
|
|
*
|
|
* Transforms HomeDataDTO to HomeViewData.
|
|
*/
|
|
export class HomeViewDataBuilder {
|
|
/**
|
|
* Build HomeViewData from HomeDataDTO
|
|
*
|
|
* @param apiDto - The API DTO
|
|
* @returns HomeViewData
|
|
*/
|
|
static build(apiDto: HomeDataDTO): HomeViewData {
|
|
return {
|
|
isAlpha: apiDto.isAlpha,
|
|
upcomingRaces: apiDto.upcomingRaces,
|
|
topLeagues: apiDto.topLeagues,
|
|
teams: apiDto.teams,
|
|
};
|
|
}
|
|
}
|