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 { Entity, PrimaryGeneratedColumn, Column, ManyToOne, OneToMany } from "typeorm";
import {
IsBoolean,
IsInt,
IsNotEmpty,
IsOptional,
IsString,
IsString
} from "class-validator";
import { Column, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { Track } from "./Track";
import { TrackScan } from "./TrackScan";
@@ -18,14 +18,13 @@ export class ScanStation {
* Autogenerated unique id (primary key).
*/
@PrimaryGeneratedColumn()
@IsOptional()
@IsInt()
id: number;
/**
* The station's description.
*/
@Column({nullable: true})
@Column({ nullable: true })
@IsOptional()
@IsString()
description?: string;
@@ -34,7 +33,7 @@ export class ScanStation {
* The track this station is associated with.
*/
@IsNotEmpty()
@ManyToOne(() => Track, track => track.stations, { nullable: true })
@ManyToOne(() => Track, track => track.stations, { nullable: false })
track: Track;
/**