import { IsBoolean, IsInt, IsNotEmpty, IsPositive } from "class-validator"; import { Column, Entity, ManyToOne, PrimaryGeneratedColumn, TableInheritance } from "typeorm"; import { Runner } from "./Runner"; /** * Defines the scan interface. */ @Entity() @TableInheritance({ column: { name: "type", type: "varchar" } }) export abstract class Scan { /** * Autogenerated unique id (primary key). */ @PrimaryGeneratedColumn() @IsInt() id: number; /** * The associated runner. */ @IsNotEmpty() @ManyToOne(() => Runner, runner => runner.scans, { nullable: false }) runner: Runner; /** * The scan's distance in meters. */ @IsInt() @IsPositive() abstract distance: number; /** * Is the scan valid (for fraud reasons). * Default: true */ @Column() @IsBoolean() valid: boolean = true; }