view data fixes
This commit is contained in:
66
apps/api/src/domain/home/dtos/HomeDataDTO.ts
Normal file
66
apps/api/src/domain/home/dtos/HomeDataDTO.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsArray, IsBoolean, ValidateNested } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
|
||||
export class HomeUpcomingRaceDTO {
|
||||
@ApiProperty()
|
||||
id!: string;
|
||||
|
||||
@ApiProperty()
|
||||
track!: string;
|
||||
|
||||
@ApiProperty()
|
||||
car!: string;
|
||||
|
||||
@ApiProperty()
|
||||
formattedDate!: string;
|
||||
}
|
||||
|
||||
export class HomeTopLeagueDTO {
|
||||
@ApiProperty()
|
||||
id!: string;
|
||||
|
||||
@ApiProperty()
|
||||
name!: string;
|
||||
|
||||
@ApiProperty()
|
||||
description!: string;
|
||||
}
|
||||
|
||||
export class HomeTeamDTO {
|
||||
@ApiProperty()
|
||||
id!: string;
|
||||
|
||||
@ApiProperty()
|
||||
name!: string;
|
||||
|
||||
@ApiProperty()
|
||||
description!: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
logoUrl?: string;
|
||||
}
|
||||
|
||||
export class HomeDataDTO {
|
||||
@ApiProperty()
|
||||
@IsBoolean()
|
||||
isAlpha!: boolean;
|
||||
|
||||
@ApiProperty({ type: [HomeUpcomingRaceDTO] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => HomeUpcomingRaceDTO)
|
||||
upcomingRaces!: HomeUpcomingRaceDTO[];
|
||||
|
||||
@ApiProperty({ type: [HomeTopLeagueDTO] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => HomeTopLeagueDTO)
|
||||
topLeagues!: HomeTopLeagueDTO[];
|
||||
|
||||
@ApiProperty({ type: [HomeTeamDTO] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => HomeTeamDTO)
|
||||
teams!: HomeTeamDTO[];
|
||||
}
|
||||
Reference in New Issue
Block a user