added trackscan update tests
All checks were successful
continuous-integration/drone/pr Build is passing
All checks were successful
continuous-integration/drone/pr Build is passing
ref #78
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { IsBoolean, IsInt, IsOptional, IsPositive } from 'class-validator';
|
||||
import { IsBoolean, IsInt, IsOptional } from 'class-validator';
|
||||
import { getConnection } from 'typeorm';
|
||||
import { RunnerNotFoundError } from '../../errors/RunnerErrors';
|
||||
import { ScanStationNotFoundError } from '../../errors/ScanStationErrors';
|
||||
@@ -22,8 +22,8 @@ export abstract class UpdateTrackScan {
|
||||
* This is important to link ran distances to runners.
|
||||
*/
|
||||
@IsInt()
|
||||
@IsPositive()
|
||||
runner: number;
|
||||
@IsOptional()
|
||||
runner?: number;
|
||||
|
||||
/**
|
||||
* Is the updated scan valid (for fraud reasons).
|
||||
@@ -46,7 +46,9 @@ export abstract class UpdateTrackScan {
|
||||
*/
|
||||
public async updateScan(scan: TrackScan): Promise<TrackScan> {
|
||||
scan.valid = this.valid;
|
||||
scan.runner = await this.getRunner();
|
||||
if (this.runner) {
|
||||
scan.runner = await this.getRunner();
|
||||
}
|
||||
if (this.station) {
|
||||
scan.station = await this.getStation();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user