hrms-api-org/src/entities/ProfileAbility.ts
2024-03-12 17:52:22 +07:00

104 lines
2.1 KiB
TypeScript

import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileAbilityHistory } from "./ProfileAbilityHistory";
@Entity("profileAbility")
export class ProfileAbility extends EntityBase {
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง Profile",
default: null,
})
profileId: string;
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@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;
@OneToMany(() => ProfileAbilityHistory, (profileAbilityHistory) => profileAbilityHistory.histories)
profileAbilityHistorys: ProfileAbilityHistory[];
@ManyToOne(() => Profile, (profile) => profile.profileAbilities)
@JoinColumn({ name: "profileId" })
profile: Profile;
}
export class CreateProfileAbility {
@Column("uuid")
profileId: string | null;
@Column()
isActive: boolean;
@Column()
remark: string | null;
@Column()
detail: string | null;
@Column()
reference: string | null;
@Column()
dateStart: Date | null;
@Column()
dateEnd: Date | null;
@Column()
field: string | null;
}
export type UpdateProfileAbility = Partial<CreateProfileAbility>;