hrms-api-salary/src/entities/SalaryPeriod.ts
2024-02-27 08:58:22 +07:00

57 lines
1.2 KiB
TypeScript

import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { SalaryOrg } from "./SalaryOrg";
@Entity("salaryPeriod")
export class SalaryPeriod extends EntityBase {
@Column({
comment: "ประเภทผัง (SPECIAL->รอบพิเศษ,APR->รอบเมษายน,OCT->รอบตุลาคม)",
length: 255,
})
period: string;
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({
nullable: true,
type: "datetime",
comment: "วันที่มีผลบังคับใช้",
})
effectiveDate: Date;
@Column({
comment: "สถานะ",
length: 255,
default: "PENDING",
})
status?: string;
@OneToMany(() => SalaryOrg, (salaryOrg) => salaryOrg.salaryPeriod)
salaryOrgs: SalaryOrg[];
}
export class CreateSalaryPeriod {
@Column()
period: string;
@Column()
isActive: boolean;
@Column()
effectiveDate: Date;
}
export class UpdateSalaryPeriod {
@Column()
period: string;
@Column()
isActive: boolean;
@Column()
effectiveDate: Date;
}