@@ -1,7 +1,6 @@
|
||||
import {
|
||||
IsInt,
|
||||
IsNotEmpty,
|
||||
|
||||
IsPositive,
|
||||
IsString
|
||||
} from "class-validator";
|
||||
@@ -10,7 +9,7 @@ import { ScanStation } from "./ScanStation";
|
||||
import { TrackScan } from "./TrackScan";
|
||||
|
||||
/**
|
||||
* Defines a track of given length.
|
||||
* Defines the Track entity.
|
||||
*/
|
||||
@Entity()
|
||||
export class Track {
|
||||
@@ -23,6 +22,7 @@ export class Track {
|
||||
|
||||
/**
|
||||
* The track's name.
|
||||
* Mainly here for UX.
|
||||
*/
|
||||
@Column()
|
||||
@IsString()
|
||||
@@ -31,6 +31,7 @@ export class Track {
|
||||
|
||||
/**
|
||||
* The track's length/distance in meters.
|
||||
* Will be used to calculate runner's ran distances.
|
||||
*/
|
||||
@Column()
|
||||
@IsInt()
|
||||
@@ -38,13 +39,15 @@ export class Track {
|
||||
distance: number;
|
||||
|
||||
/**
|
||||
* Used to link scan stations to track.
|
||||
* Used to link scan stations to a certain track.
|
||||
* This makes the configuration of the scan stations easier.
|
||||
*/
|
||||
@OneToMany(() => ScanStation, station => station.track, { nullable: true })
|
||||
stations: ScanStation[];
|
||||
|
||||
/**
|
||||
* Used to link track scans to a track.
|
||||
* The scan will derive it's distance from the track's distance.
|
||||
*/
|
||||
@OneToMany(() => TrackScan, scan => scan.track, { nullable: true })
|
||||
scans: TrackScan[];
|
||||
|
||||
Reference in New Issue
Block a user