hrms-api-org/src/entities/ProfileSalary.ts

251 lines
5.9 KiB
TypeScript

import { Entity, Column, OneToMany, JoinColumn, ManyToOne, Double } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileEmployee } from "./ProfileEmployee";
import { ProfileSalaryHistory } from "./ProfileSalaryHistory";
import { Command } from "./Command";
@Entity("profileSalary")
export class ProfileSalary extends EntityBase {
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง profile",
type: "uuid",
default: null,
})
profileId: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
@Column({
comment: "วันที่",
type: "datetime",
nullable: true,
})
date: Date;
@Column({
nullable: true,
length: 40,
comment: "เลขที่ตำแหน่ง",
default: null,
})
posNo: string;
@Column({
nullable: true,
length: 255,
comment: "ตำแหน่ง",
default: null,
})
position: string;
@Column({
nullable: true,
length: 255,
comment: "สายงาน",
default: null,
})
positionLine: string;
@Column({
nullable: true,
length: 255,
comment: "ด้าน/สาขา",
default: null,
})
positionPathSide: string;
@Column({
nullable: true,
length: 255,
comment: "ตำแหน่งทางการบริหาร",
default: null,
})
positionExecutive: string;
@Column({
nullable: true,
length: 255,
comment: "ประเภทตำแหน่ง",
default: null,
})
positionType: string;
@Column({
nullable: true,
length: 255,
comment: "ระดับตำแหน่ง",
default: null,
})
positionLevel: string;
@Column({
comment: "เงินเดือนฐาน",
default: 0,
nullable: true,
type: "double",
})
amount: Double;
@Column({
comment: "เงินประจำตำแหน่ง",
default: 0,
nullable: true,
type: "double",
})
positionSalaryAmount: Double;
@Column({
comment: "เงินค่าตอบแทนรายเดือน",
default: 0,
nullable: true,
type: "double",
})
mouthSalaryAmount: Double;
// @Column({
// nullable: true,
// comment: "ประเภทคำสั่ง",
// type: "text",
// default: null,
// })
// commandType: string;
@Column({
nullable: true,
comment: "เลขที่คำสั่ง",
type: "text",
default: null,
})
refCommandNo: string;
@Column({
nullable: true,
comment: "เอกสารอ้างอิง",
type: "text",
default: null,
})
templateDoc: string;
@Column({
nullable: true,
comment: "ลำดับตำแหน่ง",
default: null,
})
order: number;
@Column({
comment: "วันที่",
type: "datetime",
nullable: true,
})
dateGovernment: Date;
@Column({
nullable: true,
comment: "เข้ารับราชการ",
default: null,
})
isGovernment: boolean;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง command",
default: null,
})
commandId: string;
@ManyToOne(() => Command, (command) => command.profileSalarys)
@JoinColumn({ name: "commandId" })
command: Command;
@OneToMany(() => ProfileSalaryHistory, (profileSalaryHistory) => profileSalaryHistory.histories)
profileSalaryHistories: ProfileSalaryHistory[];
@ManyToOne(() => Profile, (profile) => profile.profileSalary)
@JoinColumn({ name: "profileId" })
profile: Profile;
@ManyToOne(() => ProfileEmployee, (profileEmployee) => profileEmployee.profileSalarys)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
}
export class CreateProfileSalary {
profileId: string;
date?: Date | null;
amount?: Double | null;
positionSalaryAmount?: Double | null;
mouthSalaryAmount?: Double | null;
posNo: string | null;
position: string | null;
positionLine: string | null;
positionPathSide: string | null;
positionExecutive: string | null;
positionType: string | null;
positionLevel: string | null;
refCommandNo: string | null;
commandId: string | null;
// commandType?: string | null;
templateDoc: string | null;
isGovernment?: boolean | null;
}
export class CreateProfileSalaryEmployee {
profileEmployeeId: string | null;
date?: Date | null;
amount?: Double | null;
commandId: string | null;
positionSalaryAmount?: Double | null;
mouthSalaryAmount?: Double | null;
posNo: string | null;
position: string | null;
// positionLine: string | null;
// positionPathSide: string | null;
// positionExecutive: string | null;
positionType: string | null;
positionLevel: string | null;
refCommandNo: string | null;
templateDoc: string | null;
}
export class UpdateProfileSalaryEmployee {
date?: Date | null;
amount?: Double | null;
positionSalaryAmount?: Double | null;
mouthSalaryAmount?: Double | null;
posNo: string | null;
position: string | null;
// positionLine: string | null;
// positionPathSide: string | null;
// positionExecutive: string | null;
positionType: string | null;
positionLevel: string | null;
refCommandNo: string | null;
templateDoc: string | null;
}
export type UpdateProfileSalary = {
date?: Date | null;
amount?: Double | null;
positionSalaryAmount?: Double | null;
mouthSalaryAmount?: Double | null;
posNo?: string | null;
position?: string | null;
positionLine?: string | null;
positionPathSide?: string | null;
positionExecutive?: string | null;
positionType?: string | null;
positionLevel?: string | null;
refCommandNo?: string | null;
templateDoc?: string | null;
};