Cleaned up a load of relations and optional stuff

ref #11
This commit is contained in:
2020-12-05 10:43:28 +01:00
parent 109e145a19
commit a1105f06ab
18 changed files with 50 additions and 80 deletions

View File

@@ -1,11 +1,11 @@
import { PrimaryGeneratedColumn, Column, ManyToOne, Entity, TableInheritance } from "typeorm";
import {
IsBoolean,
IsInt,
IsNotEmpty,
IsOptional,
IsPositive,
IsPositive
} from "class-validator";
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn, TableInheritance } from "typeorm";
import { Runner } from "./Runner";
/**
@@ -18,7 +18,6 @@ export abstract class Scan {
* Autogenerated unique id (primary key).
*/
@PrimaryGeneratedColumn()
@IsOptional()
@IsInt()
id: number;
@@ -26,7 +25,7 @@ export abstract class Scan {
* The associated runner.
*/
@IsNotEmpty()
@ManyToOne(() => Runner, runner => runner.scans, { nullable: true })
@ManyToOne(() => Runner, runner => runner.scans, { nullable: false })
runner: Runner;
/**
@@ -43,12 +42,4 @@ export abstract class Scan {
@Column()
@IsBoolean()
valid: boolean = true;
/**
* seconds since last scan
*/
@IsInt()
@IsOptional()
secondsSinceLastScan: number;
}
}