From 782b3dfd004b24908eb13528af2f84d439eb2982 Mon Sep 17 00:00:00 2001 From: Niggl Date: Wed, 4 Nov 2020 21:30:35 +0100 Subject: [PATCH] Added mail including validation to Customers --- package.json | 1 + src/entity/Customer.ts | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 411fc68..ad8da89 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "author": "ODIT.Services", "license": "MIT", "dependencies": { + "class-validator": "^0.12.2", "pg": "^8.4.2", "reflect-metadata": "^0.1.10", "typeorm": "0.2.29" diff --git a/src/entity/Customer.ts b/src/entity/Customer.ts index bad50fc..630043a 100644 --- a/src/entity/Customer.ts +++ b/src/entity/Customer.ts @@ -1,4 +1,5 @@ import {Entity, PrimaryGeneratedColumn, Column, JoinColumn, OneToOne} from "typeorm"; +import {IsEmail} from "class-validator"; import {Address} from "./Address"; @Entity() @@ -11,9 +12,10 @@ export class Customer { name: string; @Column() - lastName: string; + @IsEmail() + email: string; @OneToOne(() => Address) @JoinColumn() - invoiceAddress: Address; + address: Address; } \ No newline at end of file