hrms-api-org/src/entities/ProfileAbility.ts

115 lines
2.6 KiB
TypeScript

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 {
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง Profile",
default: null,
})
profileId: string;
@Column({
nullable: true,
comment: "หมายเหตุ",
type: "text",
default: null,
})
remark: string;
@Column({
nullable: true,
comment: "รายละเอียด",
type: "text",
default: null,
})
detail: string;
@Column({
nullable: true,
comment: "เอกสารอ้างอิง",
type: "text",
default: null,
})
reference: string;
@Column({
nullable: true,
type: "datetime",
comment: "วันที่เริ่มต้น",
default: null,
})
dateStart: Date;
@Column({
nullable: true,
type: "datetime",
comment: "วันที่สิ้นสุด",
default: null,
})
dateEnd: Date;
@Column({
nullable: true,
comment: "ด้าน",
type: "text",
default: null,
})
field: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
@OneToMany(
() => ProfileAbilityHistory,
(profileAbilityHistory) => profileAbilityHistory.histories,
)
profileAbilityHistorys: ProfileAbilityHistory[];
@ManyToOne(() => Profile, (profile) => profile.profileAbilities)
@JoinColumn({ name: "profileId" })
profile: Profile;
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileAbilities)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
}
export class CreateProfileAbility {
profileId: string | null;
remark: string | null;
detail: string | null;
reference: string | null;
dateStart: Date | null;
dateEnd: Date | null;
field: string | null;
}
export class CreateProfileAbilityEmployee {
profileEmployeeId: string | null;
remark: string | null;
detail: string | null;
reference: string | null;
dateStart: Date | null;
dateEnd: Date | null;
field: string | null;
}
export type UpdateProfileAbility = {
remark?: string | null;
detail?: string | null;
reference?: string | null;
dateStart?: Date | null;
dateEnd?: Date | null;
field?: string | null;
};