relation profileEmployee

This commit is contained in:
Bright 2024-05-13 15:06:52 +07:00
parent a2d3e95641
commit 59607aafd1
6 changed files with 85 additions and 1 deletions

View file

@ -1,6 +1,7 @@
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileEmployee } from "./ProfileEmployee";
import { ProfileAssessmentHistory } from "./ProfileAssessmentHistory";
@Entity("profileAssessment")
@ -13,6 +14,14 @@ export class ProfileAssessment extends EntityBase {
})
profileId: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
@Column({
nullable: true,
comment: "ชื่อแบบประเมิน",
@ -86,6 +95,10 @@ export class ProfileAssessment extends EntityBase {
@ManyToOne(() => Profile, (profile) => profile.profileAssessments)
@JoinColumn({ name: "profileId" })
profile: Profile;
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileAssessments)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
}
export class CreateProfileAssessment {

View file

@ -1,6 +1,7 @@
import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileEmployee } from "./ProfileEmployee";
import { ProfileCertificateHistory } from "./ProfileCertificateHistory";
@Entity("profileCertificate")
@ -13,6 +14,14 @@ export class ProfileCertificate extends EntityBase {
})
profileId: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
@Column({
nullable: true,
type: "datetime",
@ -62,6 +71,10 @@ export class ProfileCertificate extends EntityBase {
@ManyToOne(() => Profile, (profile) => profile.profileCertificates)
@JoinColumn({ name: "profileId" })
profile: Profile;
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileCertificates)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
}
export class CreateProfileCertificate {

View file

@ -5,7 +5,11 @@ import { EmployeePosType } from "./EmployeePosType";
import { EmployeePosMaster } from "./EmployeePosMaster";
import { ProfileSalaryEmployee } from "./ProfileSalaryEmployee";
import { ProfileDisciplineEmployee } from "./ProfileDisciplineEmployee";
import { ProfileCertificate } from "./ProfileCertificate";
import { ProfileTraining } from "./ProfileTraining";
import { ProfileInsignia } from "./ProfileInsignia";
import { ProfileHonor } from "./ProfileHonor";
import { ProfileAssessment } from "./ProfileAssessment";
@Entity("profileEmployee")
export class ProfileEmployee extends EntityBase {
@Column({
@ -197,6 +201,21 @@ export class ProfileEmployee extends EntityBase {
@OneToMany(() => ProfileDisciplineEmployee, (v) => v.profile)
profileDiscipline: ProfileDisciplineEmployee[];
@OneToMany(() => ProfileCertificate, (v) => v.profileEmployee)
profileCertificates: ProfileCertificate[];
@OneToMany(() => ProfileTraining, (v) => v.profileEmployee)
profileTrainings: ProfileTraining[];
@OneToMany(() => ProfileInsignia, (v) => v.profileEmployee)
profileInsignias: ProfileInsignia[];
@OneToMany(() => ProfileHonor, (v) => v.profileEmployee)
profileHonors: ProfileHonor[];
@OneToMany(() => ProfileAssessment, (v) => v.profileEmployee)
profileAssessments: ProfileAssessment[];
@ManyToOne(() => EmployeePosLevel, (v) => v.profiles)
posLevel: EmployeePosLevel;

View file

@ -1,6 +1,7 @@
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileEmployee } from "./ProfileEmployee";
import { ProfileHonorHistory } from "./ProfileHonorHistory";
@Entity("profileHonor")
@ -13,6 +14,14 @@ export class ProfileHonor extends EntityBase {
})
profileId: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
@Column({
nullable: true,
length: 2000,
@ -66,6 +75,10 @@ export class ProfileHonor extends EntityBase {
@ManyToOne(() => Profile, (profile) => profile.profileHonors)
@JoinColumn({ name: "profileId" })
profile: Profile;
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileHonors)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
}
export class CreateProfileHonor {

View file

@ -1,6 +1,7 @@
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileEmployee } from "./ProfileEmployee";
import { ProfileInsigniaHistory } from "./ProfileInsigniaHistory";
import { Insignia } from "./Insignia";
@ -14,6 +15,14 @@ export class ProfileInsignia extends EntityBase {
})
profileId: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
@Column({
comment: "ปีที่ยื่นขอ",
})
@ -126,6 +135,10 @@ export class ProfileInsignia extends EntityBase {
@ManyToOne(() => Profile, (profile) => profile.profileInsignias)
@JoinColumn({ name: "profileId" })
profile: Profile;
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileInsignias)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
}
export class CreateProfileInsignia {

View file

@ -1,6 +1,7 @@
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileEmployee } from "./ProfileEmployee";
import { ProfileTrainingHistory } from "./ProfileTrainingHistory";
@Entity("profileTraining")
@ -13,6 +14,14 @@ export class ProfileTraining extends EntityBase {
})
profileId: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
@Column({
nullable: true,
type: "datetime",
@ -108,6 +117,10 @@ export class ProfileTraining extends EntityBase {
@ManyToOne(() => Profile, (profile) => profile.profileTrainings)
@JoinColumn({ name: "profileId" })
profile: Profile;
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileTrainings)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
}
export class CreateProfileTraining {