parent
df3715d8d6
commit
8b2d6840a8
83
src/models/TrackScan.ts
Normal file
83
src/models/TrackScan.ts
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
import { PrimaryGeneratedColumn, Column } from "typeorm";
|
||||||
|
import {
|
||||||
|
IsBoolean,
|
||||||
|
IsDateString,
|
||||||
|
IsInt,
|
||||||
|
IsNotEmpty,
|
||||||
|
IsOptional,
|
||||||
|
IsPositive,
|
||||||
|
} from "class-validator";
|
||||||
|
import { Scan } from "./Scan";
|
||||||
|
import { Runner } from "./Runner";
|
||||||
|
import { Track } from "./Track";
|
||||||
|
import { RunnerCard } from "./RunnerCard";
|
||||||
|
import { ScanStation } from "./ScanStation";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines the scan interface.
|
||||||
|
*/
|
||||||
|
export class TrackScan extends Scan {
|
||||||
|
/**
|
||||||
|
* Autogenerated unique id (primary key).
|
||||||
|
*/
|
||||||
|
@PrimaryGeneratedColumn()
|
||||||
|
@IsOptional()
|
||||||
|
@IsInt()
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The associated runner.
|
||||||
|
*/
|
||||||
|
@Column()
|
||||||
|
@IsNotEmpty()
|
||||||
|
//TODO: Relationship
|
||||||
|
runner: Runner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The associated track.
|
||||||
|
*/
|
||||||
|
@Column()
|
||||||
|
@IsNotEmpty()
|
||||||
|
//TODO: Relationship
|
||||||
|
track: Track;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The associated card.
|
||||||
|
*/
|
||||||
|
@Column()
|
||||||
|
@IsNotEmpty()
|
||||||
|
//TODO: Relationship
|
||||||
|
card: RunnerCard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The scanning station.
|
||||||
|
*/
|
||||||
|
@Column()
|
||||||
|
@IsNotEmpty()
|
||||||
|
//TODO: Relationship
|
||||||
|
station: ScanStation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The scan's distance in meters.
|
||||||
|
*/
|
||||||
|
@IsInt()
|
||||||
|
@IsPositive()
|
||||||
|
public get distance(): number {
|
||||||
|
return this.track.distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The scan's creation timestamp.
|
||||||
|
*/
|
||||||
|
@Column()
|
||||||
|
@IsDateString()
|
||||||
|
@IsNotEmpty()
|
||||||
|
timestamp: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the scan valid (for fraud reasons).
|
||||||
|
*/
|
||||||
|
@Column()
|
||||||
|
@IsBoolean()
|
||||||
|
valid = true;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user