import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm"; import { EntityBase } from "./base/Base"; import { SalaryRanks } from "./SalaryRanks"; import { PosType } from "./PosType"; import { PosLevel } from "./PosLevel"; @Entity("salarys") export class Salarys extends EntityBase { @Column({ comment: "ประเภทผัง", length: 255, }) salaryType: string; @Column({ length: 40, comment: "Id ประเภทของตำแหน่ง", }) posTypeId: string; @Column({ length: 40, comment: "Id ระดับของตำแหน่ง", }) posLevelId: string; @Column({ comment: "สถานะการใช้งาน", }) isActive: boolean; @Column({ nullable: true, type: "datetime", comment: "ให้ไว้ ณ วันที่", default: null, }) date: Date; @Column({ nullable: true, type: "datetime", comment: "วันที่มีผลบังคับใช้", default: null, }) startDate: Date; @Column({ nullable: true, type: "datetime", comment: "วันที่สิ้นสุดบังคับใช้", default: null, }) endDate: Date; @Column({ nullable: true, comment: "คำอธิบาย", length: 255, default: null, }) details: string; @OneToMany(() => SalaryRanks, (salaryRanks) => salaryRanks.salarys_) salaryRanks_: SalaryRanks[]; @ManyToOne(() => PosType, (posType) => posType.salarys_) @JoinColumn({ name: "posTypeId" }) posType_: PosType; @ManyToOne(() => PosLevel, (posLevel) => posLevel.salarys_) @JoinColumn({ name: "posLevelId" }) posLevel_: PosLevel; } export class CreateSalary { @Column() salaryType: string; @Column("uuid") posTypeId: string; @Column("uuid") posLevelId: string; @Column() isActive: boolean; @Column() date?: Date; @Column() startDate?: Date; @Column() endDate?: Date; @Column() detail?: string; } export type UpdateSalary = Partial ;