Switched from implementing the "interfaces" as interface to abstract classes

ref #11
This was done to take advantage of typeorm and class validator
This commit is contained in:
Nicolai Ort 2020-12-01 17:16:50 +01:00
parent abb7f7f894
commit a2cf8d1f2c

View File

@ -1,19 +1,35 @@
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm";
import {
IsInt,
IsNotEmpty,
IsOptional,
IsPositive,
} from "class-validator";
/** /**
* Defines the scan interface. * Defines the scan interface.
*/ */
export interface IScan { export abstract class IScan {
/** /**
* Autogenerated unique id (primary key). * Autogenerated unique id (primary key).
*/ */
@PrimaryGeneratedColumn()
@IsOptional()
@IsInt()
id: number; id: number;
/** /**
* The associated runner. * The associated runner.
*/ */
@Column()
@IsNotEmpty()
runner: Runner; runner: Runner;
/** /**
* The scan's distance in meters. * The scan's distance in meters.
*/ */
@Column()
@IsInt()
@IsPositive()
distance: number; distance: number;
} }