website refactor
This commit is contained in:
24
apps/website/lib/builders/view-data/HomeViewDataBuilder.ts
Normal file
24
apps/website/lib/builders/view-data/HomeViewDataBuilder.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
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,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user