@@ -1,10 +1,9 @@
|
||||
import {
|
||||
IsBoolean,
|
||||
IsEAN,
|
||||
|
||||
IsInt,
|
||||
IsNotEmpty,
|
||||
IsOptional,
|
||||
IsString
|
||||
|
||||
IsOptional
|
||||
} from "class-validator";
|
||||
import { Column, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { ResponseRunnerCard } from '../responses/ResponseRunnerCard';
|
||||
@@ -33,17 +32,6 @@ export class RunnerCard {
|
||||
@ManyToOne(() => Runner, runner => runner.cards, { nullable: true })
|
||||
runner: Runner;
|
||||
|
||||
/**
|
||||
* The card's code.
|
||||
* This has to be able to being converted to something barcode compatible.
|
||||
* Will get automaticlly generated (not implemented yet).
|
||||
*/
|
||||
@Column()
|
||||
@IsEAN()
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
code: string;
|
||||
|
||||
/**
|
||||
* Is the card enabled (for fraud reasons)?
|
||||
* Default: true
|
||||
@@ -59,6 +47,14 @@ export class RunnerCard {
|
||||
@OneToMany(() => TrackScan, scan => scan.track, { nullable: true })
|
||||
scans: TrackScan[];
|
||||
|
||||
/**
|
||||
* Generates a ean-13 compliant string for barcode generation.
|
||||
*/
|
||||
public get code(): string {
|
||||
//TODO: Implement the real deal
|
||||
return '0000000000000'
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns this entity into it's response class.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user