From 33d159dbcf49b6dd0e87e85d0a98042e7d5f34a8 Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Thu, 3 Dec 2020 17:26:54 +0100 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=9A=A7=20RunnerCard=20EAN?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/RunnerCard.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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; /** From 9395813f5aafb282a50b8e2313a3022737e7decc Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Thu, 3 Dec 2020 17:55:27 +0100 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=9A=A7=20Scan.ts=20-=20secondsSinceLa?= =?UTF-8?q?stScan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/Scan.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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; + } From 8d1dd78194be42c837934f0804287624ff7079b9 Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Thu, 3 Dec 2020 18:25:52 +0100 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=9A=A7=20User.ts=20-=20optional=20pho?= =?UTF-8?q?ne=20number?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/User.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 */