refactor
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsNumber, IsArray, ValidateNested } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { LeagueSummaryDTO } from './LeagueSummaryDTO';
|
||||
|
||||
export class AllLeaguesWithCapacityAndScoringDTO {
|
||||
@ApiProperty({ type: [LeagueSummaryDTO] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => LeagueSummaryDTO)
|
||||
leagues: LeagueSummaryDTO[];
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
totalCount: number;
|
||||
}
|
||||
16
apps/api/src/domain/league/dtos/AllLeaguesWithCapacityDTO.ts
Normal file
16
apps/api/src/domain/league/dtos/AllLeaguesWithCapacityDTO.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsNumber, IsArray, ValidateNested } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { LeagueWithCapacityDTO } from './LeagueWithCapacityDTO';
|
||||
|
||||
export class AllLeaguesWithCapacityDTO {
|
||||
@ApiProperty({ type: [LeagueWithCapacityDTO] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => LeagueWithCapacityDTO)
|
||||
leagues: LeagueWithCapacityDTO[];
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
totalCount: number;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString } from 'class-validator';
|
||||
|
||||
export class ApproveJoinRequestInputDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
requestId: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
leagueId: string;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsBoolean } from 'class-validator';
|
||||
|
||||
export class ApproveJoinRequestOutputDTO {
|
||||
@ApiProperty()
|
||||
@IsBoolean()
|
||||
success: boolean;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsString()
|
||||
message?: string;
|
||||
}
|
||||
20
apps/api/src/domain/league/dtos/CreateLeagueInputDTO.ts
Normal file
20
apps/api/src/domain/league/dtos/CreateLeagueInputDTO.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsEnum } from 'class-validator';
|
||||
|
||||
export class CreateLeagueInputDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
name: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
description: string;
|
||||
|
||||
@ApiProperty({ enum: ['public', 'private'] })
|
||||
@IsEnum(['public', 'private'])
|
||||
visibility: 'public' | 'private';
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
ownerId: string;
|
||||
}
|
||||
12
apps/api/src/domain/league/dtos/CreateLeagueOutputDTO.ts
Normal file
12
apps/api/src/domain/league/dtos/CreateLeagueOutputDTO.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsBoolean } from 'class-validator';
|
||||
|
||||
export class CreateLeagueOutputDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
leagueId: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsBoolean()
|
||||
success: boolean;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsOptional, ValidateNested } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { LeagueConfigFormModelDTO } from './LeagueConfigFormModelDTO';
|
||||
|
||||
export class GetLeagueAdminConfigOutputDTO {
|
||||
@ApiProperty({ type: () => LeagueConfigFormModelDTO, nullable: true })
|
||||
@IsOptional()
|
||||
@ValidateNested()
|
||||
@Type(() => LeagueConfigFormModelDTO)
|
||||
form: LeagueConfigFormModelDTO | null;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString } from 'class-validator';
|
||||
|
||||
export class GetLeagueAdminConfigQueryDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
leagueId: string;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString } from 'class-validator';
|
||||
|
||||
export class GetLeagueAdminPermissionsInputDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
leagueId: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
performerDriverId: string;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString } from 'class-validator';
|
||||
|
||||
export class GetLeagueJoinRequestsQueryDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
leagueId: string;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString } from 'class-validator';
|
||||
|
||||
export class GetLeagueOwnerSummaryQueryDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
ownerId: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
leagueId: string;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString } from 'class-validator';
|
||||
|
||||
export class GetLeagueProtestsQueryDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
leagueId: string;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString } from 'class-validator';
|
||||
|
||||
export class GetLeagueSeasonsQueryDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
leagueId: string;
|
||||
}
|
||||
12
apps/api/src/domain/league/dtos/LeagueAdminConfigDTO.ts
Normal file
12
apps/api/src/domain/league/dtos/LeagueAdminConfigDTO.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsOptional, ValidateNested } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { LeagueConfigFormModelDTO } from './LeagueConfigFormModelDTO';
|
||||
|
||||
export class LeagueAdminConfigDTO {
|
||||
@ApiProperty({ type: () => LeagueConfigFormModelDTO, nullable: true })
|
||||
@IsOptional()
|
||||
@ValidateNested()
|
||||
@Type(() => LeagueConfigFormModelDTO)
|
||||
form: LeagueConfigFormModelDTO | null;
|
||||
}
|
||||
38
apps/api/src/domain/league/dtos/LeagueAdminDTO.ts
Normal file
38
apps/api/src/domain/league/dtos/LeagueAdminDTO.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsOptional, IsArray, ValidateNested } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { LeagueJoinRequestDTO } from './LeagueJoinRequestDTO';
|
||||
import { LeagueOwnerSummaryDTO } from './LeagueOwnerSummaryDTO';
|
||||
import { LeagueAdminConfigDTO } from './LeagueAdminConfigDTO';
|
||||
import { LeagueAdminProtestsDTO } from './LeagueAdminProtestsDTO';
|
||||
import { LeagueSeasonSummaryDTO } from './LeagueSeasonSummaryDTO';
|
||||
|
||||
export class LeagueAdminDTO {
|
||||
@ApiProperty({ type: [LeagueJoinRequestDTO] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => LeagueJoinRequestDTO)
|
||||
joinRequests: LeagueJoinRequestDTO[];
|
||||
|
||||
@ApiProperty({ type: () => LeagueOwnerSummaryDTO, nullable: true })
|
||||
@IsOptional()
|
||||
@ValidateNested()
|
||||
@Type(() => LeagueOwnerSummaryDTO)
|
||||
ownerSummary: LeagueOwnerSummaryDTO | null;
|
||||
|
||||
@ApiProperty({ type: () => LeagueAdminConfigDTO })
|
||||
@ValidateNested()
|
||||
@Type(() => LeagueAdminConfigDTO)
|
||||
config: LeagueAdminConfigDTO;
|
||||
|
||||
@ApiProperty({ type: () => LeagueAdminProtestsDTO })
|
||||
@ValidateNested()
|
||||
@Type(() => LeagueAdminProtestsDTO)
|
||||
protests: LeagueAdminProtestsDTO;
|
||||
|
||||
@ApiProperty({ type: [LeagueSeasonSummaryDTO] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => LeagueSeasonSummaryDTO)
|
||||
seasons: LeagueSeasonSummaryDTO[];
|
||||
}
|
||||
12
apps/api/src/domain/league/dtos/LeagueAdminPermissionsDTO.ts
Normal file
12
apps/api/src/domain/league/dtos/LeagueAdminPermissionsDTO.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsBoolean } from 'class-validator';
|
||||
|
||||
export class LeagueAdminPermissionsDTO {
|
||||
@ApiProperty()
|
||||
@IsBoolean()
|
||||
canRemoveMember: boolean;
|
||||
|
||||
@ApiProperty()
|
||||
@IsBoolean()
|
||||
canUpdateRoles: boolean;
|
||||
}
|
||||
24
apps/api/src/domain/league/dtos/LeagueAdminProtestsDTO.ts
Normal file
24
apps/api/src/domain/league/dtos/LeagueAdminProtestsDTO.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsArray, ValidateNested } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { DriverDto } from '../../driver/dto/DriverDto';
|
||||
import { RaceDto } from '../../race/dto/RaceDto';
|
||||
import { ProtestDTO } from './ProtestDTO';
|
||||
|
||||
export class LeagueAdminProtestsDTO {
|
||||
@ApiProperty({ type: [ProtestDTO] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => ProtestDTO)
|
||||
protests: ProtestDTO[];
|
||||
|
||||
@ApiProperty({ type: () => RaceDto })
|
||||
@ValidateNested()
|
||||
@Type(() => RaceDto)
|
||||
racesById: { [raceId: string]: RaceDto };
|
||||
|
||||
@ApiProperty({ type: () => DriverDto })
|
||||
@ValidateNested()
|
||||
@Type(() => DriverDto)
|
||||
driversById: { [driverId: string]: DriverDto };
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsEnum } from 'class-validator';
|
||||
|
||||
export class LeagueConfigFormModelBasicsDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
name: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
description: string;
|
||||
|
||||
@ApiProperty({ enum: ['public', 'private'] })
|
||||
@IsEnum(['public', 'private'])
|
||||
visibility: 'public' | 'private';
|
||||
}
|
||||
49
apps/api/src/domain/league/dtos/LeagueConfigFormModelDTO.ts
Normal file
49
apps/api/src/domain/league/dtos/LeagueConfigFormModelDTO.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsArray, ValidateNested } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { LeagueConfigFormModelBasicsDTO } from './LeagueConfigFormModelBasicsDTO';
|
||||
import { LeagueConfigFormModelStructureDTO } from './LeagueConfigFormModelStructureDTO';
|
||||
import { LeagueConfigFormModelScoringDTO } from './LeagueConfigFormModelScoringDTO';
|
||||
import { LeagueConfigFormModelDropPolicyDTO } from './LeagueConfigFormModelDropPolicyDTO';
|
||||
import { LeagueConfigFormModelStewardingDTO } from './LeagueConfigFormModelStewardingDTO';
|
||||
import { LeagueConfigFormModelTimingsDTO } from './LeagueConfigFormModelTimingsDTO';
|
||||
|
||||
export class LeagueConfigFormModelDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
leagueId: string;
|
||||
|
||||
@ApiProperty({ type: LeagueConfigFormModelBasicsDTO })
|
||||
@ValidateNested()
|
||||
@Type(() => LeagueConfigFormModelBasicsDTO)
|
||||
basics: LeagueConfigFormModelBasicsDTO;
|
||||
|
||||
@ApiProperty({ type: LeagueConfigFormModelStructureDTO })
|
||||
@ValidateNested()
|
||||
@Type(() => LeagueConfigFormModelStructureDTO)
|
||||
structure: LeagueConfigFormModelStructureDTO;
|
||||
|
||||
@ApiProperty({ type: [Object] })
|
||||
@IsArray()
|
||||
championships: any[];
|
||||
|
||||
@ApiProperty({ type: LeagueConfigFormModelScoringDTO })
|
||||
@ValidateNested()
|
||||
@Type(() => LeagueConfigFormModelScoringDTO)
|
||||
scoring: LeagueConfigFormModelScoringDTO;
|
||||
|
||||
@ApiProperty({ type: LeagueConfigFormModelDropPolicyDTO })
|
||||
@ValidateNested()
|
||||
@Type(() => LeagueConfigFormModelDropPolicyDTO)
|
||||
dropPolicy: LeagueConfigFormModelDropPolicyDTO;
|
||||
|
||||
@ApiProperty({ type: LeagueConfigFormModelTimingsDTO })
|
||||
@ValidateNested()
|
||||
@Type(() => LeagueConfigFormModelTimingsDTO)
|
||||
timings: LeagueConfigFormModelTimingsDTO;
|
||||
|
||||
@ApiProperty({ type: LeagueConfigFormModelStewardingDTO })
|
||||
@ValidateNested()
|
||||
@Type(() => LeagueConfigFormModelStewardingDTO)
|
||||
stewarding: LeagueConfigFormModelStewardingDTO;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsNumber, IsOptional, IsEnum } from 'class-validator';
|
||||
|
||||
export class LeagueConfigFormModelDropPolicyDTO {
|
||||
@ApiProperty({ enum: ['none', 'worst_n'] })
|
||||
@IsEnum(['none', 'worst_n'])
|
||||
strategy: 'none' | 'worst_n';
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
n?: number;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsNumber } from 'class-validator';
|
||||
|
||||
export class LeagueConfigFormModelScoringDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
type: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
points: number;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsNumber, IsBoolean, IsOptional, IsEnum } from 'class-validator';
|
||||
|
||||
export class LeagueConfigFormModelStewardingDTO {
|
||||
@ApiProperty({ enum: ['single_steward', 'committee_vote'] })
|
||||
@IsEnum(['single_steward', 'committee_vote'])
|
||||
decisionMode: 'single_steward' | 'committee_vote';
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
requiredVotes?: number;
|
||||
|
||||
@ApiProperty()
|
||||
@IsBoolean()
|
||||
requireDefense: boolean;
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
defenseTimeLimit: number;
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
voteTimeLimit: number;
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
protestDeadlineHours: number;
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
stewardingClosesHours: number;
|
||||
|
||||
@ApiProperty()
|
||||
@IsBoolean()
|
||||
notifyAccusedOnProtest: boolean;
|
||||
|
||||
@ApiProperty()
|
||||
@IsBoolean()
|
||||
notifyOnVoteRequired: boolean;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsEnum } from 'class-validator';
|
||||
|
||||
export class LeagueConfigFormModelStructureDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
@IsEnum(['solo', 'team'])
|
||||
mode: 'solo' | 'team';
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsNumber } from 'class-validator';
|
||||
|
||||
export class LeagueConfigFormModelTimingsDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
raceDayOfWeek: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
raceTimeHour: number;
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
raceTimeMinute: number;
|
||||
}
|
||||
34
apps/api/src/domain/league/dtos/LeagueJoinRequestDTO.ts
Normal file
34
apps/api/src/domain/league/dtos/LeagueJoinRequestDTO.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsDate, IsOptional, ValidateNested } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { DriverDto } from '../../driver/dto/DriverDto';
|
||||
|
||||
export class LeagueJoinRequestDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
id: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
leagueId: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
driverId: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsDate()
|
||||
@Type(() => Date)
|
||||
requestedAt: Date;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
message?: string;
|
||||
|
||||
@ApiProperty({ type: () => DriverDto, required: false })
|
||||
@IsOptional()
|
||||
@ValidateNested()
|
||||
@Type(() => DriverDto)
|
||||
driver?: DriverDto;
|
||||
}
|
||||
24
apps/api/src/domain/league/dtos/LeagueMemberDTO.ts
Normal file
24
apps/api/src/domain/league/dtos/LeagueMemberDTO.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsDate, IsEnum, ValidateNested } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { DriverDto } from '../../driver/dto/DriverDto';
|
||||
|
||||
export class LeagueMemberDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
driverId: string;
|
||||
|
||||
@ApiProperty({ type: () => DriverDto })
|
||||
@ValidateNested()
|
||||
@Type(() => DriverDto)
|
||||
driver: DriverDto;
|
||||
|
||||
@ApiProperty({ enum: ['owner', 'manager', 'member'] })
|
||||
@IsEnum(['owner', 'manager', 'member'])
|
||||
role: 'owner' | 'manager' | 'member';
|
||||
|
||||
@ApiProperty()
|
||||
@IsDate()
|
||||
@Type(() => Date)
|
||||
joinedAt: Date;
|
||||
}
|
||||
12
apps/api/src/domain/league/dtos/LeagueMembershipsDTO.ts
Normal file
12
apps/api/src/domain/league/dtos/LeagueMembershipsDTO.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsArray, ValidateNested } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { LeagueMemberDTO } from './LeagueMemberDTO';
|
||||
|
||||
export class LeagueMembershipsDTO {
|
||||
@ApiProperty({ type: [LeagueMemberDTO] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => LeagueMemberDTO)
|
||||
members: LeagueMemberDTO[];
|
||||
}
|
||||
21
apps/api/src/domain/league/dtos/LeagueOwnerSummaryDTO.ts
Normal file
21
apps/api/src/domain/league/dtos/LeagueOwnerSummaryDTO.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsNumber, IsOptional, ValidateNested } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { DriverDto } from '../../driver/dto/DriverDto';
|
||||
|
||||
export class LeagueOwnerSummaryDTO {
|
||||
@ApiProperty({ type: () => DriverDto })
|
||||
@ValidateNested()
|
||||
@Type(() => DriverDto)
|
||||
driver: DriverDto;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
rating: number | null;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
rank: number | null;
|
||||
}
|
||||
12
apps/api/src/domain/league/dtos/LeagueScheduleDTO.ts
Normal file
12
apps/api/src/domain/league/dtos/LeagueScheduleDTO.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsArray, ValidateNested } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { RaceDto } from '../../race/dto/RaceDto';
|
||||
|
||||
export class LeagueScheduleDTO {
|
||||
@ApiProperty({ type: [RaceDto] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => RaceDto)
|
||||
races: RaceDto[];
|
||||
}
|
||||
37
apps/api/src/domain/league/dtos/LeagueSeasonSummaryDTO.ts
Normal file
37
apps/api/src/domain/league/dtos/LeagueSeasonSummaryDTO.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsBoolean, IsDate, IsOptional } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
|
||||
export class LeagueSeasonSummaryDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
seasonId: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
name: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
status: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@IsDate()
|
||||
@Type(() => Date)
|
||||
startDate?: Date;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@IsDate()
|
||||
@Type(() => Date)
|
||||
endDate?: Date;
|
||||
|
||||
@ApiProperty()
|
||||
@IsBoolean()
|
||||
isPrimary: boolean;
|
||||
|
||||
@ApiProperty()
|
||||
@IsBoolean()
|
||||
isParallelActive: boolean;
|
||||
}
|
||||
10
apps/api/src/domain/league/dtos/LeagueSettingsDTO.ts
Normal file
10
apps/api/src/domain/league/dtos/LeagueSettingsDTO.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsNumber, IsOptional } from 'class-validator';
|
||||
|
||||
export class LeagueSettingsDTO {
|
||||
@ApiProperty({ nullable: true })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
maxDrivers?: number;
|
||||
// Add other league settings properties as needed
|
||||
}
|
||||
23
apps/api/src/domain/league/dtos/LeagueStandingDTO.ts
Normal file
23
apps/api/src/domain/league/dtos/LeagueStandingDTO.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsNumber, ValidateNested } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { DriverDto } from '../../driver/dto/DriverDto';
|
||||
|
||||
export class LeagueStandingDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
driverId: string;
|
||||
|
||||
@ApiProperty({ type: () => DriverDto })
|
||||
@ValidateNested()
|
||||
@Type(() => DriverDto)
|
||||
driver: DriverDto;
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
points: number;
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
rank: number;
|
||||
}
|
||||
12
apps/api/src/domain/league/dtos/LeagueStandingsDTO.ts
Normal file
12
apps/api/src/domain/league/dtos/LeagueStandingsDTO.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsArray, ValidateNested } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { LeagueStandingDTO } from './LeagueStandingDTO';
|
||||
|
||||
export class LeagueStandingsDTO {
|
||||
@ApiProperty({ type: [LeagueStandingDTO] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => LeagueStandingDTO)
|
||||
standings: LeagueStandingDTO[];
|
||||
}
|
||||
16
apps/api/src/domain/league/dtos/LeagueStatsDTO.ts
Normal file
16
apps/api/src/domain/league/dtos/LeagueStatsDTO.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsNumber } from 'class-validator';
|
||||
|
||||
export class LeagueStatsDTO {
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
totalMembers: number;
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
totalRaces: number;
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
averageRating: number;
|
||||
}
|
||||
58
apps/api/src/domain/league/dtos/LeagueSummaryDTO.ts
Normal file
58
apps/api/src/domain/league/dtos/LeagueSummaryDTO.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsNumber, IsBoolean, IsOptional } from 'class-validator';
|
||||
|
||||
export class LeagueSummaryDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
id: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
name: string;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
logoUrl?: string;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
coverImage?: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
memberCount: number;
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
maxMembers: number;
|
||||
|
||||
@ApiProperty()
|
||||
@IsBoolean()
|
||||
isPublic: boolean;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
ownerId: string;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
ownerName?: string;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
scoringType?: string;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
status?: string;
|
||||
}
|
||||
45
apps/api/src/domain/league/dtos/LeagueWithCapacityDTO.ts
Normal file
45
apps/api/src/domain/league/dtos/LeagueWithCapacityDTO.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsNumber, IsOptional, ValidateNested } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { LeagueSettingsDTO } from './LeagueSettingsDTO';
|
||||
|
||||
export class LeagueWithCapacityDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
id: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
name: string;
|
||||
|
||||
// ... other properties of LeagueWithCapacityDTO
|
||||
@ApiProperty({ nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
ownerId: string;
|
||||
|
||||
@ApiProperty({ type: () => LeagueSettingsDTO })
|
||||
@ValidateNested()
|
||||
@Type(() => LeagueSettingsDTO)
|
||||
settings: LeagueSettingsDTO;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
createdAt: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
usedSlots: number;
|
||||
|
||||
@ApiProperty({ type: () => Object, nullable: true }) // Using Object for generic social links
|
||||
@IsOptional()
|
||||
socialLinks?: {
|
||||
discordUrl?: string;
|
||||
youtubeUrl?: string;
|
||||
websiteUrl?: string;
|
||||
};
|
||||
}
|
||||
36
apps/api/src/domain/league/dtos/ProtestDTO.ts
Normal file
36
apps/api/src/domain/league/dtos/ProtestDTO.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsDate, IsEnum } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
|
||||
// TODO: protests are filed at race level but also managed on league level
|
||||
|
||||
export class ProtestDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
id: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
raceId: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
protestingDriverId: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
accusedDriverId: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsDate()
|
||||
@Type(() => Date)
|
||||
submittedAt: Date;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
description: string;
|
||||
|
||||
@ApiProperty({ enum: ['pending', 'accepted', 'rejected'] })
|
||||
@IsEnum(['pending', 'accepted', 'rejected'])
|
||||
status: 'pending' | 'accepted' | 'rejected';
|
||||
}
|
||||
12
apps/api/src/domain/league/dtos/RejectJoinRequestInputDTO.ts
Normal file
12
apps/api/src/domain/league/dtos/RejectJoinRequestInputDTO.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString } from 'class-validator';
|
||||
|
||||
export class RejectJoinRequestInputDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
requestId: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
leagueId: string;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsBoolean } from 'class-validator';
|
||||
|
||||
export class RejectJoinRequestOutputDTO {
|
||||
@ApiProperty()
|
||||
@IsBoolean()
|
||||
success: boolean;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsString()
|
||||
message?: string;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString } from 'class-validator';
|
||||
|
||||
export class RemoveLeagueMemberInputDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
leagueId: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
performerDriverId: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
targetDriverId: string;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsBoolean } from 'class-validator';
|
||||
|
||||
export class RemoveLeagueMemberOutputDTO {
|
||||
@ApiProperty()
|
||||
@IsBoolean()
|
||||
success: boolean;
|
||||
}
|
||||
42
apps/api/src/domain/league/dtos/SeasonDTO.ts
Normal file
42
apps/api/src/domain/league/dtos/SeasonDTO.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsBoolean, IsDate, IsOptional, IsEnum } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
|
||||
export class SeasonDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
seasonId: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
name: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
leagueId: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@IsDate()
|
||||
@Type(() => Date)
|
||||
startDate?: Date;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@IsDate()
|
||||
@Type(() => Date)
|
||||
endDate?: Date;
|
||||
|
||||
@ApiProperty({ enum: ['planned', 'active', 'completed'] })
|
||||
@IsEnum(['planned', 'active', 'completed'])
|
||||
status: 'planned' | 'active' | 'completed';
|
||||
|
||||
@ApiProperty()
|
||||
@IsBoolean()
|
||||
isPrimary: boolean;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
seasonGroupId?: string;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsEnum } from 'class-validator';
|
||||
|
||||
export class UpdateLeagueMemberRoleInputDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
leagueId: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
performerDriverId: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
targetDriverId: string;
|
||||
|
||||
@ApiProperty({ enum: ['owner', 'manager', 'member'] })
|
||||
@IsEnum(['owner', 'manager', 'member'])
|
||||
newRole: 'owner' | 'manager' | 'member';
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsBoolean } from 'class-validator';
|
||||
|
||||
export class UpdateLeagueMemberRoleOutputDTO {
|
||||
@ApiProperty()
|
||||
@IsBoolean()
|
||||
success: boolean;
|
||||
}
|
||||
Reference in New Issue
Block a user