move static data
This commit is contained in:
@@ -33,6 +33,7 @@ import { GetLeagueWalletOutputDTO } from './dtos/GetLeagueWalletOutputDTO';
|
||||
import { TotalLeaguesDTO } from './dtos/TotalLeaguesDTO';
|
||||
import { WithdrawFromLeagueWalletInputDTO } from './dtos/WithdrawFromLeagueWalletInputDTO';
|
||||
import { WithdrawFromLeagueWalletOutputDTO } from './dtos/WithdrawFromLeagueWalletOutputDTO';
|
||||
import { LeagueScoringPresetsDTO } from './dtos/LeagueScoringPresetsDTO';
|
||||
|
||||
@ApiTags('leagues')
|
||||
@Controller('leagues')
|
||||
@@ -239,8 +240,8 @@ export class LeagueController {
|
||||
|
||||
@Get('scoring-presets')
|
||||
@ApiOperation({ summary: 'Get league scoring presets' })
|
||||
@ApiResponse({ status: 200, description: 'List of scoring presets' })
|
||||
async getLeagueScoringPresets() {
|
||||
@ApiResponse({ status: 200, description: 'List of scoring presets', type: LeagueScoringPresetsDTO })
|
||||
async getLeagueScoringPresets(): Promise<LeagueScoringPresetsDTO> {
|
||||
return this.leagueService.listLeagueScoringPresets();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,28 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsEnum } from 'class-validator';
|
||||
import { IsString, IsEnum, IsNumber, ValidateNested } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
|
||||
export class LeagueScoringPresetTimingDefaultsDTO {
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
practiceMinutes!: number;
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
qualifyingMinutes!: number;
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
sprintRaceMinutes!: number;
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
mainRaceMinutes!: number;
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
sessionCount!: number;
|
||||
}
|
||||
|
||||
export class LeagueScoringPresetDTO {
|
||||
@ApiProperty()
|
||||
@@ -29,4 +52,9 @@ export class LeagueScoringPresetDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
dropPolicySummary!: string;
|
||||
|
||||
@ApiProperty({ type: LeagueScoringPresetTimingDefaultsDTO })
|
||||
@ValidateNested()
|
||||
@Type(() => LeagueScoringPresetTimingDefaultsDTO)
|
||||
defaultTimings!: LeagueScoringPresetTimingDefaultsDTO;
|
||||
}
|
||||
10
apps/api/src/domain/league/dtos/LeagueScoringPresetsDTO.ts
Normal file
10
apps/api/src/domain/league/dtos/LeagueScoringPresetsDTO.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { LeagueScoringPresetDTO } from './LeagueScoringPresetDTO';
|
||||
|
||||
export class LeagueScoringPresetsDTO {
|
||||
@ApiProperty({ type: [LeagueScoringPresetDTO] })
|
||||
presets!: LeagueScoringPresetDTO[];
|
||||
|
||||
@ApiProperty()
|
||||
totalCount!: number;
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
import type { UseCaseOutputPort } from '@core/shared/application/UseCaseOutputPort';
|
||||
import type { ListLeagueScoringPresetsResult, LeagueScoringPreset } from '@core/racing/application/use-cases/ListLeagueScoringPresetsUseCase';
|
||||
import type { LeagueScoringPresetsDTO } from '../dtos/LeagueScoringPresetsDTO';
|
||||
|
||||
export interface LeagueScoringPresetsViewModel {
|
||||
presets: LeagueScoringPreset[];
|
||||
totalCount: number;
|
||||
}
|
||||
export type LeagueScoringPresetsViewModel = LeagueScoringPresetsDTO;
|
||||
|
||||
export class LeagueScoringPresetsPresenter implements UseCaseOutputPort<ListLeagueScoringPresetsResult> {
|
||||
private viewModel: LeagueScoringPresetsViewModel | null = null;
|
||||
|
||||
Reference in New Issue
Block a user