Code + comment cleanup for the entities

ref #39
This commit is contained in:
2020-12-21 15:29:32 +01:00
parent a03f1a438d
commit d20d738218
21 changed files with 156 additions and 87 deletions

View File

@@ -12,26 +12,30 @@ import { ScanStation } from "./ScanStation";
import { Track } from "./Track";
/**
* Defines the scan interface.
* Defines the TrackScan entity.
* A track scan usaually get's generated by a scan station.
*/
@ChildEntity()
export class TrackScan extends Scan {
/**
* The associated track.
* The scan's associated track.
* This is used to determine the scan's distance.
*/
@IsNotEmpty()
@ManyToOne(() => Track, track => track.scans, { nullable: true })
track: Track;
/**
* The associated card.
* The runnerCard associated with the scan.
* This get's saved for documentation and management purposes.
*/
@IsNotEmpty()
@ManyToOne(() => RunnerCard, card => card.scans, { nullable: true })
card: RunnerCard;
/**
* The scanning station.
* The scanning station that created the scan.
* Mainly used for logging and traceing back scans (or errors)
*/
@IsNotEmpty()
@ManyToOne(() => ScanStation, station => station.scans, { nullable: true })
@@ -39,6 +43,7 @@ export class TrackScan extends Scan {
/**
* The scan's distance in meters.
* This just get's loaded from it's track.
*/
@IsInt()
@IsPositive()
@@ -48,6 +53,7 @@ export class TrackScan extends Scan {
/**
* The scan's creation timestamp.
* Will be used to implement fraud detection.
*/
@Column()
@IsDateString()