fix and relation emp
This commit is contained in:
parent
497db161c4
commit
c441df3dc9
5 changed files with 72 additions and 4 deletions
|
|
@ -2,6 +2,7 @@ import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
|
|||
import { EntityBase } from "./base/Base";
|
||||
import { Profile } from "./Profile";
|
||||
import { ProfileAbilityHistory } from "./ProfileAbilityHistory";
|
||||
import { ProfileEmployee } from "./ProfileEmployee";
|
||||
|
||||
@Entity("profileAbility")
|
||||
export class ProfileAbility extends EntityBase {
|
||||
|
|
@ -61,6 +62,14 @@ export class ProfileAbility extends EntityBase {
|
|||
})
|
||||
field: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
|
||||
default: null,
|
||||
})
|
||||
profileEmployeeId: string;
|
||||
|
||||
@OneToMany(
|
||||
() => ProfileAbilityHistory,
|
||||
(profileAbilityHistory) => profileAbilityHistory.histories,
|
||||
|
|
@ -70,6 +79,10 @@ export class ProfileAbility extends EntityBase {
|
|||
@ManyToOne(() => Profile, (profile) => profile.profileAbilities)
|
||||
@JoinColumn({ name: "profileId" })
|
||||
profile: Profile;
|
||||
|
||||
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileAbilities)
|
||||
@JoinColumn({ name: "profileEmployeeId" })
|
||||
profileEmployee: ProfileEmployee;
|
||||
}
|
||||
|
||||
export class CreateProfileAbility {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
|
|||
import { EntityBase } from "./base/Base";
|
||||
import { Profile } from "./Profile";
|
||||
import { ProfileChangeNameHistory } from "./ProfileChangeNameHistory";
|
||||
import { ProfileEmployee } from "./ProfileEmployee";
|
||||
// import { ProfileChangeNameHistory } from "./ProfileChangeNameHistory";
|
||||
|
||||
@Entity("profileChangeName")
|
||||
|
|
@ -62,15 +63,23 @@ export class ProfileChangeName extends EntityBase {
|
|||
})
|
||||
documentId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
|
||||
default: null,
|
||||
})
|
||||
profileEmployeeId: string;
|
||||
|
||||
@OneToMany(
|
||||
() => ProfileChangeNameHistory,
|
||||
(profileChangeNameHistory) => profileChangeNameHistory.histories,
|
||||
)
|
||||
profileChangeNameHistories: ProfileChangeNameHistory[];
|
||||
|
||||
// @ManyToOne(() => Profile, (profile) => profile.profileChangeName)
|
||||
// @JoinColumn({ name: "profileId" })
|
||||
// profile: Profile;
|
||||
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileChangeNames)
|
||||
@JoinColumn({ name: "profileEmployeeId" })
|
||||
profileEmployee: ProfileEmployee;
|
||||
}
|
||||
|
||||
export class CreateProfileChangeName {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
|
|||
import { EntityBase } from "./base/Base";
|
||||
import { Profile } from "./Profile";
|
||||
import { ProfileEducationHistory } from "./ProfileEducationHistory";
|
||||
import { ProfileEmployee } from "./ProfileEmployee";
|
||||
|
||||
@Entity("profileEducation")
|
||||
export class ProfileEducation extends EntityBase {
|
||||
|
|
@ -159,6 +160,14 @@ export class ProfileEducation extends EntityBase {
|
|||
})
|
||||
isEducation: boolean;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
|
||||
default: null,
|
||||
})
|
||||
profileEmployeeId: string;
|
||||
|
||||
@OneToMany(
|
||||
() => ProfileEducationHistory,
|
||||
(profileEducationHistory) => profileEducationHistory.histories,
|
||||
|
|
@ -168,6 +177,10 @@ export class ProfileEducation extends EntityBase {
|
|||
@ManyToOne(() => Profile, (profile) => profile.profileEducations)
|
||||
@JoinColumn({ name: "profileId" })
|
||||
profile: Profile;
|
||||
|
||||
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileEducations)
|
||||
@JoinColumn({ name: "profileEmployeeId" })
|
||||
profileEmployee: ProfileEmployee;
|
||||
}
|
||||
|
||||
export class CreateProfileEducation {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@ import { ProfileLeave } from "./ProfileLeave";
|
|||
import { ProfileDuty } from "./ProfileDuty";
|
||||
import { ProfileNopaid } from "./ProfileNopaid";
|
||||
import { ProfileDiscipline } from "./ProfileDiscipline";
|
||||
import { ProfileChangeName } from "./ProfileChangeName";
|
||||
import { ProfileFamilyHistory } from "./ProfileFamily";
|
||||
import { ProfileEducation } from "./ProfileEducation";
|
||||
import { ProfileAbility } from "./ProfileAbility";
|
||||
@Entity("profileEmployee")
|
||||
export class ProfileEmployee extends EntityBase {
|
||||
@Column({
|
||||
|
|
@ -232,6 +236,18 @@ export class ProfileEmployee extends EntityBase {
|
|||
@OneToMany(() => ProfileDiscipline, (v) => v.profileEmployee)
|
||||
profileDisciplines: ProfileNopaid[];
|
||||
|
||||
@OneToMany(() => ProfileChangeName, (v) => v.profileEmployee)
|
||||
profileChangeNames: ProfileChangeName[];
|
||||
|
||||
@OneToMany(() => ProfileFamilyHistory, (v) => v.profileEmployee)
|
||||
profileFamilys: ProfileFamilyHistory[];
|
||||
|
||||
@OneToMany(() => ProfileEducation, (v) => v.profileEmployee)
|
||||
profileEducations: ProfileEducation[];
|
||||
|
||||
@OneToMany(() => ProfileAbility, (v) => v.profileEmployee)
|
||||
profileAbilities: ProfileAbility[];
|
||||
|
||||
@ManyToOne(() => EmployeePosLevel, (v) => v.profiles)
|
||||
posLevel: EmployeePosLevel;
|
||||
|
||||
|
|
@ -275,6 +291,8 @@ export class CreateProfileEmployee {
|
|||
gender: string | null;
|
||||
relationship: string | null;
|
||||
bloodGroup: string | null;
|
||||
email: string | null ;
|
||||
phone: string | null;
|
||||
}
|
||||
|
||||
export type UpdateProfileEmployee = {
|
||||
|
|
@ -296,4 +314,6 @@ export type UpdateProfileEmployee = {
|
|||
gender?: string | null;
|
||||
relationship?: string | null;
|
||||
bloodGroup?: string | null;
|
||||
email: string | null;
|
||||
phone: string | null;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { Column, Entity, ManyToOne, OneToMany } from "typeorm";
|
||||
import { Column, Entity, ManyToOne, OneToMany, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Profile } from "./Profile";
|
||||
import { ProfileEmployee } from "./ProfileEmployee";
|
||||
|
||||
@Entity("profileFamilyHistory")
|
||||
export class ProfileFamilyHistory extends EntityBase {
|
||||
|
|
@ -155,11 +156,23 @@ export class ProfileFamilyHistory extends EntityBase {
|
|||
})
|
||||
profileId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
|
||||
default: null,
|
||||
})
|
||||
profileEmployeeId: string;
|
||||
|
||||
@ManyToOne(() => Profile, (v) => v.profileFamily)
|
||||
profile: Profile;
|
||||
|
||||
@OneToMany(() => ProfileChildrenHistory, (v) => v.profileFamilyHistory)
|
||||
profileChildrenHistories: ProfileChildrenHistory[];
|
||||
|
||||
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileFamilys)
|
||||
@JoinColumn({ name: "profileEmployeeId" })
|
||||
profileEmployee: ProfileEmployee;
|
||||
}
|
||||
|
||||
@Entity("profileChildren")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue