Added scanstation class

ref #11
This commit is contained in:
Nicolai Ort 2020-12-01 18:39:33 +01:00
parent fbbb5df64f
commit f7beebce3f
1 changed files with 54 additions and 0 deletions

54
src/models/ScanStation.ts Normal file
View File

@ -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;
}