import { Entity , Column , PrimaryGeneratedColumn , ManyToOne } from 'typeorm' ; import { Address } from './Address.entity' ; @ Entity ( ) export class Customer { @ PrimaryGeneratedColumn ( 'uuid' ) private id : string ; @ Column ( { type : 'varchar' , nullable : false } ) private name : string ; @ Column ( { type : 'timestamp' , default : ( ) => 'CURRENT_TIMESTAMP' } ) private createdAt : Date ; @ ManyToOne ( type => Address , { nullable : true , onDelete : 'SET NULL' } ) private address : Address ; constructor ( name , address ) { this . name = name ; this . address = address ; } public getId ( ) { return this . id ; } public getName ( ) { return this . name ; } public getCreatedAt ( ) { return this . createdAt ; } public getAddress ( ) { return this . address ; } public updateName ( name ) { this . name = name ; } }