Added mail including validation to Customers
This commit is contained in:
parent
fcd84014a0
commit
782b3dfd00
|
@ -17,6 +17,7 @@
|
||||||
"author": "ODIT.Services",
|
"author": "ODIT.Services",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"class-validator": "^0.12.2",
|
||||||
"pg": "^8.4.2",
|
"pg": "^8.4.2",
|
||||||
"reflect-metadata": "^0.1.10",
|
"reflect-metadata": "^0.1.10",
|
||||||
"typeorm": "0.2.29"
|
"typeorm": "0.2.29"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import {Entity, PrimaryGeneratedColumn, Column, JoinColumn, OneToOne} from "typeorm";
|
import {Entity, PrimaryGeneratedColumn, Column, JoinColumn, OneToOne} from "typeorm";
|
||||||
|
import {IsEmail} from "class-validator";
|
||||||
import {Address} from "./Address";
|
import {Address} from "./Address";
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
|
@ -11,9 +12,10 @@ export class Customer {
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
lastName: string;
|
@IsEmail()
|
||||||
|
email: string;
|
||||||
|
|
||||||
@OneToOne(() => Address)
|
@OneToOne(() => Address)
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
invoiceAddress: Address;
|
address: Address;
|
||||||
}
|
}
|
Reference in New Issue