Ajusted the way scan distances are implemented
This commit is contained in:
parent
72b5ca4153
commit
d6a41d5a82
@ -15,7 +15,7 @@ import { Runner } from "./Runner";
|
|||||||
*/
|
*/
|
||||||
@Entity()
|
@Entity()
|
||||||
@TableInheritance({ column: { name: "type", type: "varchar" } })
|
@TableInheritance({ column: { name: "type", type: "varchar" } })
|
||||||
export abstract class Scan {
|
export class Scan {
|
||||||
/**
|
/**
|
||||||
* Autogenerated unique id (primary key).
|
* Autogenerated unique id (primary key).
|
||||||
*/
|
*/
|
||||||
@ -31,14 +31,6 @@ export abstract class Scan {
|
|||||||
@ManyToOne(() => Runner, runner => runner.scans, { nullable: false })
|
@ManyToOne(() => Runner, runner => runner.scans, { nullable: false })
|
||||||
runner: Runner;
|
runner: Runner;
|
||||||
|
|
||||||
/**
|
|
||||||
* The scan's distance in meters.
|
|
||||||
* Can be set manually or derived from another object.
|
|
||||||
*/
|
|
||||||
@IsInt()
|
|
||||||
@IsPositive()
|
|
||||||
abstract distance: number;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the scan valid (for fraud reasons).
|
* Is the scan valid (for fraud reasons).
|
||||||
* The determination of validity will work differently for every child class.
|
* The determination of validity will work differently for every child class.
|
||||||
@ -48,6 +40,24 @@ export abstract class Scan {
|
|||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
valid: boolean = true;
|
valid: boolean = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The scan's distance in meters.
|
||||||
|
* Can be set manually or derived from another object.
|
||||||
|
*/
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@IsInt()
|
||||||
|
private _distance?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The scan's distance in meters.
|
||||||
|
* Can be set manually or derived from another object.
|
||||||
|
*/
|
||||||
|
@IsInt()
|
||||||
|
@IsPositive()
|
||||||
|
public get distance(): number {
|
||||||
|
return this._distance;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turns this entity into it's response class.
|
* Turns this entity into it's response class.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user