import { Entity , Column , PrimaryGeneratedColumn , ManyToOne } from 'typeorm' ; import { Quote } from './Quote.entity' ; @ Entity ( ) export class QuoteItem { @ PrimaryGeneratedColumn ( 'uuid' ) private id : string ; @ Column ( { type : 'varchar' , nullable : false } ) private title : string ; @ Column ( { type : 'integer' , nullable : false , comment : 'Stored in base 100' } ) private quantity : number ; @ Column ( { type : 'integer' , nullable : false , comment : 'Stored in base 100' } ) private dailyRate : number ; @ ManyToOne ( type => Quote , quote => quote . items , { nullable : false , onDelete : 'CASCADE' } ) quote : Quote ; constructor ( title , quantity , dailyRate , quote ) { this . title = title ; this . quantity = quantity ; this . dailyRate = dailyRate ; this . quote = quote ; } public getTitle ( ) { return this . title ; } public getDailyRate ( ) { return this . dailyRate ; } public getQuantity ( ) { return this . quantity ; } }