move static data

This commit is contained in:
2025-12-26 00:20:53 +01:00
parent c977defd6a
commit b6cbb81388
63 changed files with 1482 additions and 418 deletions

View File

@@ -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();
}

View File

@@ -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;
}

View 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;
}

View File

@@ -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;