@@ -1,35 +1,28 @@
|
||||
import { IsNotEmpty } from 'class-validator';
|
||||
import { IsInt, IsPositive } from 'class-validator';
|
||||
import { getConnection } from 'typeorm';
|
||||
import { RunnerNotFoundError } from '../../errors/RunnerErrors';
|
||||
import { RunnerCard } from '../entities/RunnerCard';
|
||||
import { ScanStation } from '../entities/ScanStation';
|
||||
import { TrackScan } from '../entities/TrackScan';
|
||||
import { CreateScan } from './CreateScan';
|
||||
|
||||
/**
|
||||
* This classed is used to create a new Scan entity from a json body (post request).
|
||||
*/
|
||||
export class CreateTrackScan extends CreateScan {
|
||||
|
||||
/**
|
||||
* The scan's associated track.
|
||||
* This is used to determine the scan's distance.
|
||||
*/
|
||||
@IsNotEmpty()
|
||||
track: number;
|
||||
|
||||
export class CreateTrackScan {
|
||||
/**
|
||||
* The runnerCard associated with the scan.
|
||||
* This get's saved for documentation and management purposes.
|
||||
*/
|
||||
@IsNotEmpty()
|
||||
@IsInt()
|
||||
@IsPositive()
|
||||
card: number;
|
||||
|
||||
/**
|
||||
* The scanning station that created the scan.
|
||||
* Mainly used for logging and traceing back scans (or errors)
|
||||
*/
|
||||
@IsNotEmpty()
|
||||
@IsInt()
|
||||
@IsPositive()
|
||||
station: number;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { IsDateString, IsNotEmpty } from "class-validator";
|
||||
import { RunnerCard } from '../entities/RunnerCard';
|
||||
import { ScanStation } from '../entities/ScanStation';
|
||||
import { TrackScan } from '../entities/TrackScan';
|
||||
import { ResponseRunnerCard } from './ResponseRunnerCard';
|
||||
import { ResponseScan } from './ResponseScan';
|
||||
import { ResponseScanStation } from './ResponseScanStation';
|
||||
import { ResponseTrack } from './ResponseTrack';
|
||||
|
||||
/**
|
||||
@@ -19,13 +19,13 @@ export class ResponseTrackScan extends ResponseScan {
|
||||
* The runnerCard associated with the scan.
|
||||
*/
|
||||
@IsNotEmpty()
|
||||
card: RunnerCard;
|
||||
card: ResponseRunnerCard;
|
||||
|
||||
/**
|
||||
* The scanning station that created the scan.
|
||||
*/
|
||||
@IsNotEmpty()
|
||||
station: ScanStation;
|
||||
station: ResponseScanStation;
|
||||
|
||||
/**
|
||||
* The scan's creation timestamp.
|
||||
@@ -41,8 +41,9 @@ export class ResponseTrackScan extends ResponseScan {
|
||||
public constructor(scan: TrackScan) {
|
||||
super(scan);
|
||||
this.track = new ResponseTrack(scan.track);
|
||||
this.card = scan.card;
|
||||
this.station = scan.station;
|
||||
this.card = scan.card.toResponse();
|
||||
this.station = scan.station.toResponse();
|
||||
this.timestamp = scan.timestamp;
|
||||
this.distance = scan.distance;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user