refactor core presenters
This commit is contained in:
@@ -1,16 +1,43 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsNumber, IsArray, ValidateNested } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { LeagueWithCapacityDTO } from './LeagueWithCapacityDTO';
|
||||
|
||||
export class LeagueWithCapacityDTO {
|
||||
@ApiProperty()
|
||||
id!: string;
|
||||
|
||||
@ApiProperty()
|
||||
name!: string;
|
||||
|
||||
@ApiProperty()
|
||||
description!: string;
|
||||
|
||||
@ApiProperty()
|
||||
ownerId!: string;
|
||||
|
||||
@ApiProperty()
|
||||
settings!: {
|
||||
maxDrivers: number;
|
||||
sessionDuration?: number;
|
||||
visibility?: string;
|
||||
};
|
||||
|
||||
@ApiProperty()
|
||||
createdAt!: string;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
socialLinks?: {
|
||||
discordUrl?: string;
|
||||
youtubeUrl?: string;
|
||||
websiteUrl?: string;
|
||||
};
|
||||
|
||||
@ApiProperty()
|
||||
usedSlots!: number;
|
||||
}
|
||||
|
||||
export class AllLeaguesWithCapacityDTO {
|
||||
@ApiProperty({ type: [LeagueWithCapacityDTO] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => LeagueWithCapacityDTO)
|
||||
leagues: LeagueWithCapacityDTO[];
|
||||
leagues!: LeagueWithCapacityDTO[];
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
totalCount: number;
|
||||
totalCount!: number;
|
||||
}
|
||||
Reference in New Issue
Block a user