hrms-api-salary/src/entities/Salarys.ts
2024-02-22 11:51:22 +07:00

142 lines
No EOL
2.5 KiB
TypeScript

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;
@Column({
comment: "ฉ",
default: false,
})
isSpecial: boolean;
@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()
details?: string | null;
@Column()
isSpecial: boolean;
}
export class UpdateSalary {
@Column()
salaryType: string;
@Column("uuid")
posTypeId: string;
@Column("uuid")
posLevelId: string;
@Column()
isActive: boolean;
@Column()
date?: Date;
@Column()
startDate?: Date;
@Column()
endDate?: Date;
@Column()
details?: string;
@Column()
isSpecial: boolean;
}
// export type UpdateSalary = Partial<CreateSalary> ;