Fixed scan runner in response

ref #67
This commit is contained in:
2021-01-07 16:38:41 +01:00
parent 30502ec949
commit e67d1c5697
3 changed files with 10 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
import { IsBoolean, IsInt, IsPositive } from "class-validator";
import { IsBoolean, IsInt, IsNotEmpty, IsPositive } from "class-validator";
import { Scan } from '../entities/Scan';
import { ResponseRunner } from './ResponseRunner';
@@ -16,8 +16,8 @@ export class ResponseScan {
* The scan's associated runner.
* This is important to link ran distances to runners.
*/
// @IsNotEmpty()
runner?: ResponseRunner;
@IsNotEmpty()
runner: ResponseRunner;
/**
* Is the scan valid (for fraud reasons).
@@ -39,7 +39,7 @@ export class ResponseScan {
*/
public constructor(scan: Scan) {
this.id = scan.id;
this.runner = null;
this.runner = scan.runner.toResponse();
this.distance = scan.distance;
this.valid = scan.valid;
}