| @@ -1,4 +1,4 @@ | ||||
| import { IsInt, IsNotEmpty, IsPositive, IsString } from 'class-validator'; | ||||
| import { IsInt, IsNotEmpty, IsOptional, IsPositive, IsString } from 'class-validator'; | ||||
| import { Track } from '../entities/Track'; | ||||
|  | ||||
| /** | ||||
| @@ -19,6 +19,15 @@ export class CreateTrack { | ||||
|     @IsPositive() | ||||
|     distance: number; | ||||
|  | ||||
|     /** | ||||
|      * The minimum time a runner should take to run a lap on this track. | ||||
|      * Will be used for fraud detection. | ||||
|      */ | ||||
|     @IsInt() | ||||
|     @IsOptional() | ||||
|     @IsPositive() | ||||
|     minimumLapTime?: number; | ||||
|  | ||||
|     /** | ||||
|      * Creates a new Track entity from this. | ||||
|      */ | ||||
| @@ -27,6 +36,7 @@ export class CreateTrack { | ||||
|  | ||||
|         newTrack.name = this.name; | ||||
|         newTrack.distance = this.distance; | ||||
|         newTrack.minimumLapTime = this.minimumLapTime; | ||||
|  | ||||
|         return newTrack; | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user