127 lines
3 KiB
TypeScript
127 lines
3 KiB
TypeScript
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
|
|
import { EntityBase } from "./base/Base";
|
|
import { Profile } from "./Profile";
|
|
import { ProfileEmployee } from "./ProfileEmployee";
|
|
import { ProfileDutyHistory } from "./ProfileDutyHistory";
|
|
|
|
@Entity("profileDuty")
|
|
export class ProfileDuty extends EntityBase {
|
|
@Column({
|
|
nullable: true,
|
|
length: 40,
|
|
comment: "คีย์นอก(FK)ของตาราง Profile",
|
|
default: null,
|
|
})
|
|
profileId: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
length: 40,
|
|
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
|
|
default: null,
|
|
})
|
|
profileEmployeeId: 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,
|
|
})
|
|
detail: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "เอกสารอ้างอิง",
|
|
type: "text",
|
|
default: null,
|
|
})
|
|
reference: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
type: "datetime",
|
|
comment: "เอกสารอ้างอิง (ลงวันที่)",
|
|
default: null,
|
|
})
|
|
refCommandDate: Date;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "เอกสารอ้างอิง (เลขที่คำสั่ง)",
|
|
type: "text",
|
|
default: null,
|
|
})
|
|
refCommandNo: string;
|
|
|
|
@Column({
|
|
comment: "แนบไฟล์เอกสาร",
|
|
default: false,
|
|
})
|
|
isUpload: boolean;
|
|
|
|
@Column({
|
|
comment: "ข้อมูลจาก Entry",
|
|
default: false,
|
|
})
|
|
isEntry: boolean;
|
|
|
|
@OneToMany(() => ProfileDutyHistory, (profileDutyHistory) => profileDutyHistory.histories)
|
|
profileDutyHistories: ProfileDutyHistory[];
|
|
|
|
@ManyToOne(() => Profile, (profile) => profile.profileDutys)
|
|
@JoinColumn({ name: "profileId" })
|
|
profile: Profile;
|
|
|
|
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileDutys)
|
|
@JoinColumn({ name: "profileEmployeeId" })
|
|
profileEmployee: ProfileEmployee;
|
|
}
|
|
|
|
export class CreateProfileDuty {
|
|
profileId: string | null;
|
|
dateStart: Date | null;
|
|
dateEnd: Date | null;
|
|
detail: string | null;
|
|
reference: string | null;
|
|
refCommandDate: Date | null;
|
|
refCommandNo: string | null;
|
|
isUpload?: boolean | null;
|
|
}
|
|
|
|
export class CreateProfileEmployeeDuty {
|
|
profileEmployeeId: string | null;
|
|
dateStart: Date | null;
|
|
dateEnd: Date | null;
|
|
detail: string | null;
|
|
reference: string | null;
|
|
refCommandDate: Date | null;
|
|
refCommandNo: string | null;
|
|
isUpload?: boolean | null;
|
|
}
|
|
|
|
export type UpdateProfileDuty = {
|
|
dateStart?: Date | null;
|
|
dateEnd?: Date | null;
|
|
detail?: string | null;
|
|
reference?: string | null;
|
|
refCommandDate?: Date | null;
|
|
refCommandNo?: string | null;
|
|
isUpload?: boolean | null;
|
|
};
|