parent
4d593eb840
commit
c1242b2a2a
|
@ -1,4 +1,4 @@
|
|||
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne } from "typeorm";
|
||||
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, OneToMany } from "typeorm";
|
||||
import {
|
||||
IsBoolean,
|
||||
IsInt,
|
||||
|
@ -7,6 +7,7 @@ import {
|
|||
IsString,
|
||||
} from "class-validator";
|
||||
import { Runner } from "./Runner";
|
||||
import { TrackScan } from "./TrackScan";
|
||||
|
||||
/**
|
||||
* Defines a card that can be scanned via a scanner station.
|
||||
|
@ -46,4 +47,10 @@ export class RunnerCard {
|
|||
@Column()
|
||||
@IsBoolean()
|
||||
enabled = true;
|
||||
|
||||
/**
|
||||
* Used to link cards to a track scans.
|
||||
*/
|
||||
@OneToMany(() => TrackScan, scan => scan.track)
|
||||
scans: TrackScan[];
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne } from "typeorm";
|
||||
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, OneToMany } from "typeorm";
|
||||
import {
|
||||
IsBoolean,
|
||||
IsInt,
|
||||
|
@ -7,6 +7,7 @@ import {
|
|||
IsString,
|
||||
} from "class-validator";
|
||||
import { Track } from "./Track";
|
||||
import { TrackScan } from "./TrackScan";
|
||||
|
||||
/**
|
||||
* ScannerStations have the ability to create scans for specific tracks.
|
||||
|
@ -51,4 +52,10 @@ export class ScanStation {
|
|||
@Column()
|
||||
@IsBoolean()
|
||||
enabled = true;
|
||||
|
||||
/**
|
||||
* Used to link track scans to a scan station.
|
||||
*/
|
||||
@OneToMany(() => TrackScan, scan => scan.track)
|
||||
scans: TrackScan[];
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import {
|
|||
IsString,
|
||||
} from "class-validator";
|
||||
import { ScanStation } from "./ScanStation";
|
||||
import { TrackScan } from "./TrackScan";
|
||||
|
||||
/**
|
||||
* Defines a track of given length.
|
||||
|
@ -42,4 +43,10 @@ export class Track {
|
|||
*/
|
||||
@OneToMany(() => ScanStation, station => station.track)
|
||||
stations: ScanStation[];
|
||||
|
||||
/**
|
||||
* Used to link track scans to a track.
|
||||
*/
|
||||
@OneToMany(() => TrackScan, scan => scan.track)
|
||||
scans: TrackScan[];
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ export class TrackScan extends Scan {
|
|||
*/
|
||||
@Column()
|
||||
@IsNotEmpty()
|
||||
//TODO: Relationship
|
||||
@ManyToOne(() => Track, track => track.scans)
|
||||
track: Track;
|
||||
|
||||
/**
|
||||
|
@ -38,7 +38,7 @@ export class TrackScan extends Scan {
|
|||
*/
|
||||
@Column()
|
||||
@IsNotEmpty()
|
||||
//TODO: Relationship
|
||||
@ManyToOne(() => RunnerCard, card => card.scans)
|
||||
card: RunnerCard;
|
||||
|
||||
/**
|
||||
|
@ -46,7 +46,7 @@ export class TrackScan extends Scan {
|
|||
*/
|
||||
@Column()
|
||||
@IsNotEmpty()
|
||||
//TODO: Relationship
|
||||
@ManyToOne(() => ScanStation, station => station.scans)
|
||||
station: ScanStation;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue