Moved to a "cleaner" directory structure

ref #11
This commit is contained in:
2020-12-03 20:38:47 +01:00
parent 3a04bb54bd
commit e8727ca922
27 changed files with 145 additions and 145 deletions

View File

@@ -0,0 +1,52 @@
import { Entity, PrimaryGeneratedColumn, Column, OneToMany } from "typeorm";
import {
IsInt,
IsNotEmpty,
IsOptional,
IsPositive,
IsString,
} from "class-validator";
import { ScanStation } from "./ScanStation";
import { TrackScan } from "./TrackScan";
/**
* Defines a track of given length.
*/
@Entity()
export class Track {
/**
* Autogenerated unique id (primary key).
*/
@PrimaryGeneratedColumn()
@IsOptional()
@IsInt()
id: number;;
/**
* The track's name.
*/
@Column()
@IsString()
@IsNotEmpty()
name: string;
/**
* The track's length/distance in meters.
*/
@Column()
@IsInt()
@IsPositive()
distance: number;
/**
* Used to link scan stations to track.
*/
@OneToMany(() => ScanStation, station => station.track, { nullable: true })
stations: ScanStation[];
/**
* Used to link track scans to a track.
*/
@OneToMany(() => TrackScan, scan => scan.track, { nullable: true })
scans: TrackScan[];
}