Added runnerCard class

ref #11
This commit is contained in:
Nicolai Ort 2020-12-01 18:16:17 +01:00
parent 96d70d5048
commit fbbb5df64f
1 changed files with 49 additions and 0 deletions

49
src/models/RunnerCard.ts Normal file
View File

@ -0,0 +1,49 @@
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm";
import {
IsBoolean,
IsInt,
IsNotEmpty,
IsOptional,
IsString,
} from "class-validator";
import { Runner } from "./Runner";
/**
* Defines a card that can be scanned via a scanner station.
*/
@Entity()
export class RunnerCard {
/**
* Autogenerated unique id (primary key).
*/
@PrimaryGeneratedColumn()
@IsOptional()
@IsInt()
id: number;
/**
* The runner that is currently associated with this card.
*/
@Column()
@IsOptional()
//TODO: Relation
runner: Runner;
/**
* The card's code.
* This has to be able to being converted to something barcode compatible.
* Probably gonna be autogenerated.
*/
@Column()
@IsString()
@IsNotEmpty()
//TODO: Generate this
code: string;
/**
* Is the card enabled (for fraud reasons)?
*/
@Column()
@IsBoolean()
enabled = true;
}