diff --git a/src/models/RunnerCard.ts b/src/models/RunnerCard.ts new file mode 100644 index 0000000..09b3746 --- /dev/null +++ b/src/models/RunnerCard.ts @@ -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; +}