relation profileEmployee

This commit is contained in:
AnandaTon 2024-05-13 16:37:51 +07:00
parent 9a7adc4eb5
commit b1c6f5fead
5 changed files with 76 additions and 7 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 { ProfileDisciplineHistory } from "./ProfileDisciplineHistory";
@Entity("profileDiscipline")
@ -20,6 +21,14 @@ export class ProfileDiscipline extends EntityBase {
})
profileId: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
@Column({
nullable: true,
comment: "ระดับความผิด",
@ -69,12 +78,16 @@ export class ProfileDiscipline extends EntityBase {
@ManyToOne(() => Profile, (profile) => profile.profileDiscipline)
@JoinColumn({ name: "profileId" })
profile: Profile;
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileDisciplines)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
}
export class CreateProfileDiscipline {
date: Date | null;
profileId: string;
profileId?: string;
profileEmployeeId?: string | null;
level: string | null;
detail: string | null;
refCommandDate: Date | null;