hrms-api-kpi/src/entities/kpiUserEvaluation.ts
2024-05-08 16:44:55 +07:00

210 lines
5.7 KiB
TypeScript

import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { KpiPeriod } from "./kpiPeriod";
import { KpiUserSpecial } from "./kpiUserSpecial";
import { KpiUserRole } from "./kpiUserRole";
import { KpiUserPlanned } from "./kpiUserPlanned";
import { KpiUserCapacity } from "./kpiUserCapacity";
import { KpiUserEvaluationReason } from "./kpiUserEvaluationReason";
import { KpiUserDevelopment } from "./kpiUserDevelopment";
@Entity("kpiUserEvaluation")
export class KpiUserEvaluation extends EntityBase {
@Column({
nullable: true,
comment: "คำนำหน้า",
length: 255,
default: null,
})
prefix: string;
@Column({
nullable: true,
comment: "ชื่อ",
length: 255,
default: null,
})
firstName: string;
@Column({
nullable: true,
comment: "สกุล",
length: 255,
default: null,
})
lastName: string;
@Column({
nullable: true,
length: 40,
comment: "ไอดีโปรไฟล์",
default: null,
})
profileId: string;
@Column({
nullable: true,
length: 40,
comment: "ไอดีผู้ประเมิน",
default: null,
})
evaluatorId: string;
@Column({
nullable: true,
length: 40,
comment: "ไอดีผู้บังคับบัญชาเหนือขึ้นไป",
default: null,
})
commanderId: string;
@Column({
nullable: true,
length: 40,
comment: "ไอดีผู้บังคับบัญชาเหนือขึ้นไปอีกชั้นหนึ่ง",
default: null,
})
commanderHighId: string;
@Column({
// "สถานะการประเมินผล ดังนี้ PENDING = รอดำเนินการ, INPROGRESS = กําลังดำเนินการ, DONE = ประเมินเสร็จสิ้น",
nullable: true,
length: 40,
comment:
"สถานะการประเมินผล ดังนี้ NEW = รอดำเนินการ, INPROGRESS = กําลังดำเนินการ, DONE = ประเมินเสร็จสิ้น",
default: "NEW",
})
evaluationStatus: string;
@Column({
// "ผลการประเมิน ดังนี้ PENDING = รอดำเนินการ, PASSED = ผ่านการประเมิน, NOTPASSED = ไม่ผ่านการประเมิน",
nullable: true,
length: 40,
comment:
"ผลการประเมิน ดังนี้ PENDING = รอดำเนินการ, PASSED = ผ่านการประเมิน, NOTPASSED = ไม่ผ่านการประเมิน",
default: null,
})
evaluationResults: string;
@Column({
comment: "คำขอแก้ไข",
default: false,
})
isReqEdit: boolean;
@Column({
type: "double",
nullable: true,
default: null,
comment: "งานตามแผนปฏิบัติราชการประจำปี ร้อยละ",
})
plannedPoint: number;
@Column({
type: "double",
nullable: true,
default: null,
comment: "งานตามหน้าที่ความรับผิดชอบหลัก ร้อยละ",
})
rolePoint: number;
@Column({
type: "double",
nullable: true,
default: null,
comment: "งานที่ได้รับมอบหมายพิเศษ ร้อยละ",
})
specialPoint: number;
@Column({
type: "double",
nullable: true,
default: null,
comment: "สมรรถนะ ร้อยละ",
})
capacityPoint: number;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง kpiPeriodId",
default: null,
})
kpiPeriodId: string;
@ManyToOne(() => KpiPeriod, (kpiPeriod) => kpiPeriod.kpiUserEvaluations)
@JoinColumn({ name: "kpiPeriodId" })
kpiPeriod: KpiPeriod;
@OneToMany(() => KpiUserCapacity, (kpiUserCapacity) => kpiUserCapacity.kpiUserEvaluation)
kpiUserCapacitys: KpiUserCapacity[];
@OneToMany(() => KpiUserPlanned, (kpiUserPlanned) => kpiUserPlanned.kpiUserEvaluation)
kpiUserPlanneds: KpiUserPlanned[];
@OneToMany(() => KpiUserRole, (kpiUserRole) => kpiUserRole.kpiUserEvaluation)
kpiUserRoles: KpiUserRole[];
@OneToMany(() => KpiUserSpecial, (kpiUserSpecial) => kpiUserSpecial.kpiUserEvaluation)
kpiUserSpecials: KpiUserSpecial[];
@OneToMany(() => KpiUserDevelopment, (kpiUserDevelopment) => kpiUserDevelopment.kpiUserEvaluation)
kpiUserDevelopments: KpiUserDevelopment[];
@OneToMany(
() => KpiUserEvaluationReason,
(kpiUserEvaluationReason) => kpiUserEvaluationReason.kpiUserEvaluation,
)
kpiUserEvaluationReasons: KpiUserEvaluationReason[];
}
export class createKpiUserEvaluation {
@Column()
prefix: string;
@Column()
firstName: string;
@Column()
lastName: string;
@Column()
kpiPeriodId: string;
@Column()
profileId: string;
@Column()
evaluatorId: string | null;
@Column()
commanderId: string | null;
@Column()
commanderHighId: string | null;
}
export class updateKpiUserEvaluation {
@Column()
prefix: string;
@Column()
firstName: string;
@Column()
lastName: string;
@Column()
kpiPeriodId: string;
@Column()
profileId: string;
}
export class updateKpiUserCheckEvaluation {
@Column()
evaluatorId: string | null;
@Column()
commanderId: string | null;
@Column()
commanderHighId: string | null;
}
export class updateKpiUserPointEvaluation {
@Column()
plannedPoint: number | null;
@Column()
rolePoint: number | null;
@Column()
specialPoint: number | null;
@Column()
capacityPoint: number | null;
}