Laptime is now a part of the response

ref #151
This commit is contained in:
Nicolai Ort 2021-03-01 16:59:36 +01:00
parent aa833736d3
commit a2c97a11a3
1 changed files with 9 additions and 1 deletions

View File

@ -1,4 +1,4 @@
import { IsDateString, IsNotEmpty } from "class-validator";
import { IsDateString, IsNotEmpty, IsNumber } from "class-validator";
import { TrackScan } from '../entities/TrackScan';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
@ -42,6 +42,13 @@ export class ResponseTrackScan extends ResponseScan implements IResponse {
@IsNotEmpty()
timestamp: number;
/**
* The scan's lap time.
* This simply get's calculated from the last lap time;
*/
@IsNumber()
lapTime: number;
/**
* Creates a ResponseTrackScan object from a scan.
* @param scan The trackSscan the response shall be build for.
@ -53,5 +60,6 @@ export class ResponseTrackScan extends ResponseScan implements IResponse {
if (scan.station) { scan.station.toResponse(); }
this.timestamp = scan.timestamp;
this.distance = scan.distance;
this.lapTime = scan.lapTime;
}
}