import { Column , Entity , CreateDateColumn , PrimaryColumn , OneToOne , JoinColumn , UpdateDateColumn , ManyToOne , RelationId , } from 'typeorm' ; import { HelpRequest } from '../helpRequests/help-request.entity' ; import { User } from '../users/user.entity' ; import { ApiHideProperty , ApiProperty } from '@nestjs/swagger' ; @ Entity ( { name : 'calls' , } ) export class Call { @ PrimaryColumn ( ) sid ! : string ; @ CreateDateColumn ( ) createdAt ! : Date ; @ Column ( ) @ UpdateDateColumn ( ) updatedAt ! : Date ; @ Column ( { nullable : true } ) recordingUrl ? : string ; @ ApiProperty ( { type : 'integer' , format : 'int64' , } ) @ RelationId ( ( call ) => call . convertedHelpRequest ) convertedHelpRequestId ? : number ; @ ApiHideProperty ( ) @ OneToOne ( type => HelpRequest , convertedHelpRequest => convertedHelpRequest . call , { cascade : true } ) convertedHelpRequest ? : HelpRequest ; @ Column ( { nullable : true , } ) phoneNumber ? : string ; @ Column ( { nullable : true , } ) country ? : string ; @ Column ( { nullable : true , } ) zip ? : string ; @ Column ( { nullable : true , } ) city ? : string ; @ Column ( { nullable : true } ) converterId ? : string ; @ ManyToOne ( type => User ) @ JoinColumn ( { name : 'converterId' } ) converter ? : User ; }