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"; @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({ nullable: true, comment: "สถานะ", default: null, }) status: string; @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: string | null; } export class CreateProfileActpositionEmployee { profileEmployeeId: string | null; dateStart: Date | null; dateEnd: Date | null; posNo: string | null; position: string | null; status: string | null; } export type UpdateProfileActposition = { dateStart?: Date | null; dateEnd?: Date | null; posNo?: string | null; position?: string | null; status?: string | null; };