Marked property as optional

ref #71
This commit is contained in:
Nicolai Ort 2021-01-03 17:04:09 +01:00
parent 63b1ca9b56
commit 02f7ddbb37
1 changed files with 11 additions and 1 deletions

View File

@ -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'; import { Track } from '../entities/Track';
/** /**
@ -19,6 +19,15 @@ export class CreateTrack {
@IsPositive() @IsPositive()
distance: number; 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. * Creates a new Track entity from this.
*/ */
@ -27,6 +36,7 @@ export class CreateTrack {
newTrack.name = this.name; newTrack.name = this.name;
newTrack.distance = this.distance; newTrack.distance = this.distance;
newTrack.minimumLapTime = this.minimumLapTime;
return newTrack; return newTrack;
} }