From 2ab00322362c2be5c31d872027b868d96cb94f9a Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Wed, 20 Mar 2024 09:19:34 +0700 Subject: [PATCH] fix: error undefined on extends class --- src/entities/ProfileInformation.ts | 19 +++++++++++++++++-- src/entities/ProfileInformationHistory.ts | 18 ------------------ 2 files changed, 17 insertions(+), 20 deletions(-) delete mode 100644 src/entities/ProfileInformationHistory.ts diff --git a/src/entities/ProfileInformation.ts b/src/entities/ProfileInformation.ts index 6ee1490a..e6157a5e 100644 --- a/src/entities/ProfileInformation.ts +++ b/src/entities/ProfileInformation.ts @@ -2,11 +2,11 @@ import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm"; import { EntityBase } from "./base/Base"; import { Profile } from "./Profile"; -import { ProfileInformationHistory } from "./ProfileInformationHistory"; import { BloodGroup } from "./BloodGroup"; import { Relationship } from "./Relationship"; import { Gender } from "./Gender"; -@Entity("profileinformation") + +@Entity("profileInformation") export class ProfileInformation extends EntityBase { @Column({ nullable: true, @@ -152,3 +152,18 @@ export type UpdateProfileInformation = { relationshipId?: string | null; bloodGroupId?: string | null; }; + +@Entity("profileInformationHistory") +export class ProfileInformationHistory extends ProfileInformation { + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง ProfileInformation", + default: null, + }) + profileInformationId: string; + + @ManyToOne(() => ProfileInformation, (v) => v.profileInformationHistory, { onDelete: "CASCADE" }) + @JoinColumn({ name: "profileInformationId" }) + profileInformation: ProfileInformation; +} diff --git a/src/entities/ProfileInformationHistory.ts b/src/entities/ProfileInformationHistory.ts deleted file mode 100644 index c7c04b27..00000000 --- a/src/entities/ProfileInformationHistory.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm"; - -import { ProfileInformation } from "./ProfileInformation"; - -@Entity("profileinformationHistory") -export class ProfileInformationHistory extends ProfileInformation { - @Column({ - nullable: true, - length: 40, - comment: "คีย์นอก(FK)ของตาราง ProfileInformation", - default: null, - }) - profileInformationId: string; - - @ManyToOne(() => ProfileInformation, (v) => v.profileInformationHistory, { onDelete: "CASCADE" }) - @JoinColumn({ name: "profileInformationId" }) - profileInformation: ProfileInformation; -}