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

66 lines
1.4 KiB
TypeScript

import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { SalaryPeriod } from "./SalaryPeriod";
import { SalaryProfile } from "./SalaryProfile";
@Entity("salaryOrg")
export class SalaryOrg extends EntityBase {
@Column({
comment: "",
length: 40,
})
salaryPeriodId: string;
@Column({
comment: "สถานะ",
})
status: string;
@Column({
comment: "id หน่วยงาน",
length: 40,
})
rootId: string;
@Column({
comment: "จำนวนคนทั้งหมด",
})
total: number;
@Column({
comment: "15%ของจำนวนคน",
})
fifteenPercent: number;
@Column({
comment: "กลุ่ม GROUP1->กลุ่ม1 GROUP2->กลุ่ม2",
length: 10,
})
group: string;
@ManyToOne(() => SalaryPeriod, (salaryPeriod) => salaryPeriod.salaryOrgs)
@JoinColumn({ name: "salaryPeriodId" })
salaryPeriod: SalaryPeriod;
@OneToMany(() => SalaryProfile, (salaryProfile) => salaryProfile.salaryOrg)
salaryProfiles: SalaryProfile[];
}
export class CreateSalaryOrg {
@Column("uuid")
salaryPeriodId: string;
@Column()
status: string;
@Column("uuid")
rootId: string;
@Column()
total: number;
@Column()
fifteenPercent: number;
}
export type UpdateSalaryOrg = Partial<CreateSalaryOrg>;