From f7beebce3f5dc39f6b5e8ae34a1010ebf25058e1 Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Tue, 1 Dec 2020 18:39:33 +0100 Subject: [PATCH] Added scanstation class ref #11 --- src/models/ScanStation.ts | 54 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/models/ScanStation.ts diff --git a/src/models/ScanStation.ts b/src/models/ScanStation.ts new file mode 100644 index 0000000..2989be0 --- /dev/null +++ b/src/models/ScanStation.ts @@ -0,0 +1,54 @@ +import { Entity, PrimaryGeneratedColumn, Column } from "typeorm"; +import { + IsBoolean, + IsInt, + IsNotEmpty, + IsOptional, + IsString, +} from "class-validator"; +import { Track } from "./Track"; + +/** + * ScannerStations have the ability to create scans for specific tracks. +*/ +@Entity() +export class ScanStation { + /** + * Autogenerated unique id (primary key). + */ + @PrimaryGeneratedColumn() + @IsOptional() + @IsInt() + id: number; + + /** + * The station's description. + */ + @Column() + @IsNotEmpty() + @IsString() + description: string; + + /** + * The track this station is associated with. + */ + @Column() + @IsNotEmpty() + //TODO: Relation + track: Track; + + /** + * The station's api key. + */ + @Column() + @IsNotEmpty() + @IsString() + key: string; + + /** + * Is the station enabled (for fraud reasons)? + */ + @Column() + @IsBoolean() + enabled = true; +}