resolve manual DTOs

This commit is contained in:
2025-12-18 22:19:40 +01:00
parent 4a3087ae35
commit d617654928
179 changed files with 3716 additions and 1257 deletions

View File

@@ -30,6 +30,8 @@ import { GetLeagueProtestsQueryDTO } from './dtos/GetLeagueProtestsQueryDTO';
import { GetLeagueSeasonsQueryDTO } from './dtos/GetLeagueSeasonsQueryDTO';
import { GetLeagueAdminConfigQueryDTO } from './dtos/GetLeagueAdminConfigQueryDTO';
import { GetLeagueOwnerSummaryQueryDTO } from './dtos/GetLeagueOwnerSummaryQueryDTO';
import { GetSeasonSponsorshipsOutputDTO } from './dtos/GetSeasonSponsorshipsOutputDTO';
import { GetLeagueRacesOutputDTO } from './dtos/GetLeagueRacesOutputDTO';
@ApiTags('leagues')
@Controller('leagues')
@@ -262,4 +264,18 @@ export class LeagueController {
async transferLeagueOwnership(@Param('leagueId') leagueId: string, @Body() body: { currentOwnerId: string, newOwnerId: string }) {
return this.leagueService.transferLeagueOwnership(leagueId, body.currentOwnerId, body.newOwnerId);
}
@Get('seasons/:seasonId/sponsorships')
@ApiOperation({ summary: 'Get season sponsorships' })
@ApiResponse({ status: 200, description: 'Season sponsorships', type: GetSeasonSponsorshipsOutputDTO })
async getSeasonSponsorships(@Param('seasonId') seasonId: string): Promise<GetSeasonSponsorshipsOutputDTO> {
return this.leagueService.getSeasonSponsorships(seasonId);
}
@Get(':leagueId/races')
@ApiOperation({ summary: 'Get league races' })
@ApiResponse({ status: 200, description: 'League races', type: GetLeagueRacesOutputDTO })
async getRaces(@Param('leagueId') leagueId: string): Promise<GetLeagueRacesOutputDTO> {
return this.leagueService.getRaces(leagueId);
}
}

View File

@@ -27,6 +27,8 @@ import { LeagueStatsDTO } from './dtos/LeagueStatsDTO';
import { LeagueAdminDTO } from './dtos/LeagueAdminDTO';
import { CreateLeagueInputDTO } from './dtos/CreateLeagueInputDTO';
import { CreateLeagueOutputDTO } from './dtos/CreateLeagueOutputDTO';
import { GetSeasonSponsorshipsOutputDTO } from './dtos/GetSeasonSponsorshipsOutputDTO';
import { GetLeagueRacesOutputDTO } from './dtos/GetLeagueRacesOutputDTO';
// Core imports
import type { Logger } from '@core/shared/application/Logger';
@@ -328,4 +330,24 @@ export class LeagueService {
success: true,
};
}
async getSeasonSponsorships(seasonId: string): Promise<GetSeasonSponsorshipsOutputDTO> {
this.logger.debug('Getting season sponsorships', { seasonId });
// TODO: Implement actual logic to fetch season sponsorships
// For now, return empty array as placeholder
return {
sponsorships: [],
};
}
async getRaces(leagueId: string): Promise<GetLeagueRacesOutputDTO> {
this.logger.debug('Getting league races', { leagueId });
// TODO: Implement actual logic to fetch league races
// For now, return empty array as placeholder
return {
races: [],
};
}
}

View File

@@ -0,0 +1,7 @@
import { ApiProperty } from '@nestjs/swagger';
import { RaceDTO } from '../../race/dtos/RaceDTO';
export class GetLeagueRacesOutputDTO {
@ApiProperty({ type: [RaceDTO] })
races: RaceDTO[];
}

View File

@@ -0,0 +1,7 @@
import { ApiProperty } from '@nestjs/swagger';
import { SponsorshipDetailDTO } from '../../sponsor/dtos/SponsorshipDetailDTO';
export class GetSeasonSponsorshipsOutputDTO {
@ApiProperty({ type: [SponsorshipDetailDTO] })
sponsorships: SponsorshipDetailDTO[];
}

View File

@@ -0,0 +1,28 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsString, IsEnum } from 'class-validator';
export class LeagueMembershipDTO {
@ApiProperty()
@IsString()
id: string;
@ApiProperty()
@IsString()
leagueId: string;
@ApiProperty()
@IsString()
driverId: string;
@ApiProperty({ enum: ['owner', 'admin', 'steward', 'member'] })
@IsEnum(['owner', 'admin', 'steward', 'member'])
role: 'owner' | 'admin' | 'steward' | 'member';
@ApiProperty({ enum: ['active', 'inactive', 'pending'] })
@IsEnum(['active', 'inactive', 'pending'])
status: 'active' | 'inactive' | 'pending';
@ApiProperty()
@IsString()
joinedAt: string;
}

View File

@@ -0,0 +1,8 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsEnum } from 'class-validator';
export class LeagueRoleDTO {
@ApiProperty({ enum: ['owner', 'admin', 'steward', 'member'] })
@IsEnum(['owner', 'admin', 'steward', 'member'])
value: 'owner' | 'admin' | 'steward' | 'member';
}

View File

@@ -0,0 +1,32 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsString, IsEnum } from 'class-validator';
export class LeagueScoringPresetDTO {
@ApiProperty()
@IsString()
id: string;
@ApiProperty()
@IsString()
name: string;
@ApiProperty()
@IsString()
description: string;
@ApiProperty({ enum: ['driver', 'team', 'nations', 'trophy'] })
@IsEnum(['driver', 'team', 'nations', 'trophy'])
primaryChampionshipType: 'driver' | 'team' | 'nations' | 'trophy';
@ApiProperty()
@IsString()
sessionSummary: string;
@ApiProperty()
@IsString()
bonusSummary: string;
@ApiProperty()
@IsString()
dropPolicySummary: string;
}

View File

@@ -0,0 +1,8 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsEnum } from 'class-validator';
export class MembershipRoleDTO {
@ApiProperty({ enum: ['owner', 'admin', 'steward', 'member'] })
@IsEnum(['owner', 'admin', 'steward', 'member'])
value: 'owner' | 'admin' | 'steward' | 'member';
}

View File

@@ -0,0 +1,8 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsEnum } from 'class-validator';
export class MembershipStatusDTO {
@ApiProperty({ enum: ['active', 'inactive', 'pending'] })
@IsEnum(['active', 'inactive', 'pending'])
value: 'active' | 'inactive' | 'pending';
}

View File

@@ -0,0 +1,92 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsOptional, IsString, ValidateNested } from 'class-validator';
import { Type } from 'class-transformer';
class WizardErrorsBasicsDTO {
@ApiProperty({ required: false })
@IsOptional()
@IsString()
name?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
description?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
visibility?: string;
}
class WizardErrorsStructureDTO {
@ApiProperty({ required: false })
@IsOptional()
@IsString()
maxDrivers?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
maxTeams?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
driversPerTeam?: string;
}
class WizardErrorsTimingsDTO {
@ApiProperty({ required: false })
@IsOptional()
@IsString()
qualifyingMinutes?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
mainRaceMinutes?: string;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
roundsPlanned?: string;
}
class WizardErrorsScoringDTO {
@ApiProperty({ required: false })
@IsOptional()
@IsString()
patternId?: string;
}
export class WizardErrorsDTO {
@ApiProperty({ type: WizardErrorsBasicsDTO, required: false })
@IsOptional()
@ValidateNested()
@Type(() => WizardErrorsBasicsDTO)
basics?: WizardErrorsBasicsDTO;
@ApiProperty({ type: WizardErrorsStructureDTO, required: false })
@IsOptional()
@ValidateNested()
@Type(() => WizardErrorsStructureDTO)
structure?: WizardErrorsStructureDTO;
@ApiProperty({ type: WizardErrorsTimingsDTO, required: false })
@IsOptional()
@ValidateNested()
@Type(() => WizardErrorsTimingsDTO)
timings?: WizardErrorsTimingsDTO;
@ApiProperty({ type: WizardErrorsScoringDTO, required: false })
@IsOptional()
@ValidateNested()
@Type(() => WizardErrorsScoringDTO)
scoring?: WizardErrorsScoringDTO;
@ApiProperty({ required: false })
@IsOptional()
@IsString()
submit?: string;
}

View File

@@ -0,0 +1,8 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsEnum } from 'class-validator';
export class WizardStepDTO {
@ApiProperty({ enum: [1, 2, 3, 4, 5, 6, 7] })
@IsEnum([1, 2, 3, 4, 5, 6, 7])
value: 1 | 2 | 3 | 4 | 5 | 6 | 7;
}