Added mail including validation to Customers
This commit is contained in:
parent
fcd84014a0
commit
782b3dfd00
|
@ -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"
|
||||
|
|
|
@ -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;
|
||||
}
|
Reference in New Issue