hrms-api-salary/src/entities/SalaryRankEmployees.ts

65 lines
1.4 KiB
TypeScript

import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { SalaryEmployees } from "./SalaryEmployees";
@Entity("salaryRankEmployees")
export class SalaryRankEmployees extends EntityBase {
@Column({
length: 40,
comment: "คีย์นอก(FK)ของตาราง salaryEmployee",
})
salaryEmployeeId: string;
@Column({
type: "double",
comment: "ลำดับขั้น",
})
step: number;
@Column({
nullable: true,
type: "double",
comment: "ค่าจ้างรายเดือน",
default: null,
})
salaryMonth: number | null;
@Column({
nullable: true,
type: "double",
comment: "ค่าจ้างรายวัน",
default: null,
})
salaryDay: number | null;
@ManyToOne(() => SalaryEmployees, (salaryEmployees) => salaryEmployees.salaryRankEmployees_)
@JoinColumn({ name: "salaryEmployeeId" })
salaryEmployees_: SalaryEmployees;
}
export class CreateSalaryRankEmployee {
@Column("uuid")
salaryEmployeeId: string;
@Column()
step: number;
@Column()
salaryMonth?: number | null;
@Column()
salaryDay?: number | null;
}
export class UpdateSalaryRankEmployee {
@Column()
step: number;
@Column()
salaryMonth?: number | null;
@Column()
salaryDay?: number | null;
}
// export type UpdateSalaryRank = Partial<Pick<CreateSalaryRank, Exclude<keyof CreateSalaryRank, 'salaryId'>>>;