diff --git a/src/models/RunnerCard.ts b/src/models/RunnerCard.ts index 8b0e05b..0ba0428 100644 --- a/src/models/RunnerCard.ts +++ b/src/models/RunnerCard.ts @@ -1,6 +1,7 @@ import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, OneToMany } from "typeorm"; import { IsBoolean, + IsEAN, IsInt, IsNotEmpty, IsOptional, @@ -32,12 +33,12 @@ export class RunnerCard { /** * The card's code. * This has to be able to being converted to something barcode compatible. - * Probably gonna be autogenerated. + * could theoretically be autogenerated */ @Column() + @IsEAN() @IsString() @IsNotEmpty() - //TODO: Generate this code: string; /** diff --git a/src/models/Scan.ts b/src/models/Scan.ts index 3fd64ed..5e8cbf9 100644 --- a/src/models/Scan.ts +++ b/src/models/Scan.ts @@ -35,11 +35,19 @@ export abstract class Scan { @IsPositive() abstract distance: number; - /** - * Is the scan valid (for fraud reasons). - * Default: true - */ + /** + * Is the scan valid (for fraud reasons). + * Default: true + */ @Column() @IsBoolean() valid: boolean = true; + + /** + * seconds since last scan + */ + @IsInt() + @IsOptional() + secondsSinceLastScan: number; + } diff --git a/src/models/User.ts b/src/models/User.ts index 4ba57f8..94d770e 100644 --- a/src/models/User.ts +++ b/src/models/User.ts @@ -1,5 +1,5 @@ import { Entity, Column, OneToMany, ManyToOne, PrimaryGeneratedColumn, Generated, Unique, JoinTable, ManyToMany } from "typeorm"; -import { IsBoolean, IsEmail, IsInt, IsNotEmpty, IsOptional, IsString, isUUID, } from "class-validator"; +import { IsBoolean, IsEmail, IsInt, IsNotEmpty, IsOptional, IsPhoneNumber, IsString, isUUID, } from "class-validator"; import { UserGroup } from './UserGroup'; import { Permission } from './Permission'; import { UserAction } from './UserAction'; @@ -31,6 +31,13 @@ export class User { @IsEmail() email: string; + /** + * user phone + */ + @IsPhoneNumber("ZZ") + @IsOptional() + phone: string; + /** * username */