128 lines
3 KiB
TypeScript
128 lines
3 KiB
TypeScript
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
|
|
import { EntityBase } from "./base/Base";
|
|
import { Profile } from "./Profile";
|
|
import { ProfileActpositionHistory } from "./ProfileActpositionHistory";
|
|
import { ProfileEmployee } from "./ProfileEmployee";
|
|
import { Command } from "./Command";
|
|
|
|
@Entity("profileActposition")
|
|
export class ProfileActposition extends EntityBase {
|
|
@Column({
|
|
nullable: true,
|
|
length: 40,
|
|
comment: "คีย์นอก(FK)ของตาราง Profile",
|
|
default: null,
|
|
})
|
|
profileId: 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: "ตำแหน่งเลขที่",
|
|
default: null,
|
|
})
|
|
posNo: string;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "ตำแหน่ง",
|
|
default: null,
|
|
})
|
|
position: string;
|
|
|
|
@Column({
|
|
comment: "สถานะ",
|
|
default: false,
|
|
})
|
|
status: boolean;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
comment: "เลขที่คำสั่ง",
|
|
type: "text",
|
|
default: null,
|
|
})
|
|
refCommandNo: string;
|
|
|
|
@Column({
|
|
comment: "วันที่ออกคำสั่ง",
|
|
type: "datetime",
|
|
nullable: true,
|
|
})
|
|
refCommandDate: Date;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
length: 40,
|
|
comment: "คีย์นอก(FK)ของตาราง command",
|
|
default: null,
|
|
})
|
|
commandId: string;
|
|
|
|
@ManyToOne(() => Command, (command) => command.profileSalarys)
|
|
@JoinColumn({ name: "commandId" })
|
|
command: Command;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
length: 40,
|
|
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
|
|
default: null,
|
|
})
|
|
profileEmployeeId: string;
|
|
|
|
@OneToMany(
|
|
() => ProfileActpositionHistory,
|
|
(profileActpositionHistory) => profileActpositionHistory.histories,
|
|
)
|
|
profileActpositionHistorys: ProfileActpositionHistory[];
|
|
|
|
@ManyToOne(() => Profile, (profile) => profile.profileAbilities)
|
|
@JoinColumn({ name: "profileId" })
|
|
profile: Profile;
|
|
|
|
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileAbilities)
|
|
@JoinColumn({ name: "profileEmployeeId" })
|
|
profileEmployee: ProfileEmployee;
|
|
}
|
|
|
|
export class CreateProfileActposition {
|
|
profileId: string | null;
|
|
dateStart: Date | null;
|
|
dateEnd: Date | null;
|
|
posNo: string | null;
|
|
position: string | null;
|
|
status: boolean;
|
|
}
|
|
|
|
export class CreateProfileActpositionEmployee {
|
|
profileEmployeeId: string | null;
|
|
dateStart: Date | null;
|
|
dateEnd: Date | null;
|
|
posNo: string | null;
|
|
position: string | null;
|
|
status: boolean;
|
|
}
|
|
|
|
export type UpdateProfileActposition = {
|
|
dateStart?: Date | null;
|
|
dateEnd?: Date | null;
|
|
posNo?: string | null;
|
|
position?: string | null;
|
|
status: boolean;
|
|
};
|