67 lines
1.2 KiB
TypeScript
67 lines
1.2 KiB
TypeScript
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[];
|
|
}
|