move static data
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsNotEmpty, IsOptional, IsNumber, IsEnum } from 'class-validator';
|
||||
import { PENALTY_TYPE_VALUES } from '@core/racing/domain/entities/penalty/PenaltyType';
|
||||
|
||||
export class ApplyPenaltyCommandDTO {
|
||||
@ApiProperty()
|
||||
@@ -17,30 +18,8 @@ export class ApplyPenaltyCommandDTO {
|
||||
@IsNotEmpty()
|
||||
stewardId!: string;
|
||||
|
||||
@ApiProperty({
|
||||
enum: [
|
||||
'time_penalty',
|
||||
'grid_penalty',
|
||||
'points_deduction',
|
||||
'disqualification',
|
||||
'warning',
|
||||
'license_points',
|
||||
'probation',
|
||||
'fine',
|
||||
'race_ban',
|
||||
],
|
||||
})
|
||||
@IsEnum([
|
||||
'time_penalty',
|
||||
'grid_penalty',
|
||||
'points_deduction',
|
||||
'disqualification',
|
||||
'warning',
|
||||
'license_points',
|
||||
'probation',
|
||||
'fine',
|
||||
'race_ban',
|
||||
])
|
||||
@ApiProperty({ enum: PENALTY_TYPE_VALUES })
|
||||
@IsEnum(PENALTY_TYPE_VALUES)
|
||||
type!: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
|
||||
40
apps/api/src/domain/race/dtos/PenaltyTypesReferenceDTO.ts
Normal file
40
apps/api/src/domain/race/dtos/PenaltyTypesReferenceDTO.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsBoolean, IsEnum, IsString } from 'class-validator';
|
||||
import {
|
||||
PENALTY_TYPE_VALUES,
|
||||
type PenaltyTypeValue,
|
||||
} from '@core/racing/domain/entities/penalty/PenaltyType';
|
||||
|
||||
export type PenaltyValueKindDTO = 'seconds' | 'grid_positions' | 'points' | 'races' | 'none';
|
||||
|
||||
export class PenaltyTypeReferenceDTO {
|
||||
@ApiProperty({ enum: PENALTY_TYPE_VALUES })
|
||||
@IsEnum(PENALTY_TYPE_VALUES)
|
||||
type!: PenaltyTypeValue;
|
||||
|
||||
@ApiProperty()
|
||||
@IsBoolean()
|
||||
requiresValue!: boolean;
|
||||
|
||||
@ApiProperty({ enum: ['seconds', 'grid_positions', 'points', 'races', 'none'] })
|
||||
@IsString()
|
||||
valueKind!: PenaltyValueKindDTO;
|
||||
}
|
||||
|
||||
export class PenaltyDefaultReasonsDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
upheld!: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
dismissed!: string;
|
||||
}
|
||||
|
||||
export class PenaltyTypesReferenceDTO {
|
||||
@ApiProperty({ type: [PenaltyTypeReferenceDTO] })
|
||||
penaltyTypes!: PenaltyTypeReferenceDTO[];
|
||||
|
||||
@ApiProperty({ type: PenaltyDefaultReasonsDTO })
|
||||
defaultReasons!: PenaltyDefaultReasonsDTO;
|
||||
}
|
||||
Reference in New Issue
Block a user