import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany, Double } 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({ nullable: true, comment: "id revision", length: 40, }) revisionId: string; @Column({ comment: "รอบการ Snapshot", length: 20, default: "SNAP1", }) snapshot: string; @Column({ default: 0, comment: "จำนวนคนทั้งหมด", }) total: number; @Column({ default: 0, comment: "15%ของจำนวนคน(จำนวนเต็ม)", }) fifteenPercent: number; @Column({ comment: "15%ของจำนวนคน(จุดทศนิยม)", type: "double", default: 0, }) fifteenPoint: 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;