import { Entity , Column , PrimaryGeneratedColumn , ManyToOne } from 'typeorm' ; import { Customer } from '../Customer/Customer.entity' ; import { User } from '../HumanResource/User/User.entity' ; import { Task } from '../Task/Task.entity' ; @ Entity ( ) export class DailyRate { @ PrimaryGeneratedColumn ( 'uuid' ) private id : string ; @ Column ( { type : 'integer' , nullable : false , comment : 'Stored in base 100' } ) private amount : number ; @ Column ( { type : 'timestamp' , default : ( ) => 'CURRENT_TIMESTAMP' } ) private createdAt : Date ; @ ManyToOne ( type => User , { nullable : false , onDelete : 'CASCADE' } ) private user : User ; @ ManyToOne ( type => Customer , { nullable : false , onDelete : 'CASCADE' } ) private customer : Customer ; @ ManyToOne ( type => Task , { nullable : false , onDelete : 'CASCADE' } ) private task : Task ; constructor ( amount , user , customer , task ) { this . amount = amount ; this . user = user ; this . customer = customer ; this . task = task ; } public getId ( ) { return this . id ; } public getAmount ( ) { return this . amount ; } public getUser ( ) { return this . user ; } public getTask ( ) { return this . task ; } public getCustomer ( ) { return this . customer ; } public update ( amount , user , customer , task ) { this . amount = amount ; this . user = user ; this . customer = customer ; this . task = task ; } }