Added mail including validation to Customers

This commit is contained in:
Nicolai Ort 2020-11-04 21:30:35 +01:00
parent fcd84014a0
commit 782b3dfd00
2 changed files with 5 additions and 2 deletions

View File

@ -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"

View File

@ -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;
}