hrms-api-kpi/src/entities/kpiUserRole.ts

218 lines
4.5 KiB
TypeScript

import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { KpiUserEvaluation } from "./kpiUserEvaluation";
import { KpiRole } from "./kpiRole";
import { Double } from "typeorm/browser";
import { KpiUserEvaluationReasonRole } from "./kpiUserEvaluationReasonRole";
@Entity("kpiUserRole")
export class KpiUserRole extends EntityBase {
@Column({
nullable: true,
comment: "ค่าเป้าหมาย",
default: null,
})
target: string;
@Column({
nullable: true,
comment: "หน่วยนับ",
default: null,
})
unit: number;
@Column({
nullable: true,
comment: "น้ำหนัก",
default: null,
})
weight: number;
@Column({
nullable: true,
comment: "นิยามหรือความหมาย",
default: null,
})
meaning: string;
@Column({
nullable: true,
comment: "สูตรคำนวณ",
default: null,
})
formula: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง kpiUserEvaluation",
default: null,
})
kpiUserEvaluationId: string;
@ManyToOne(() => KpiUserEvaluation, (kpiUserEvaluation) => kpiUserEvaluation.kpiUserRoles)
@JoinColumn({ name: "kpiUserEvaluationId" })
kpiUserEvaluation: KpiUserEvaluation;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง kpiRole",
default: null,
})
kpiRoleId: string;
@ManyToOne(() => KpiRole, (kpiRole) => kpiRole.kpiUserRoles)
@JoinColumn({ name: "kpiRoleId" })
kpiRole: KpiRole;
@Column({
nullable: true,
comment: "ระดับคะแนน",
default: null,
})
point: number;
@Column({
type: "double",
nullable: true,
default: null,
comment: "ผลการประเมิน",
})
summary: number;
@Column({
nullable: true,
comment: "ข้อมูลเอกสารหลักฐาน",
default: null,
})
documentInfoEvidence: string;
@Column({
nullable: true,
type: "datetime",
comment: "ช่วงเวลาเริ่มเก็บข้อมูล",
default: null,
})
startDate: Date;
@Column({
nullable: true,
type: "datetime",
comment: "ช่วงเวลาสิ้นสุดเก็บข้อมูล",
default: null,
})
endDate: Date;
@Column({
nullable: true,
comment: "ผลสำเร็จของงาน 1",
default: null,
})
achievement1: string;
@Column({
nullable: true,
comment: "ผลสำเร็จของงาน 2",
default: null,
})
achievement2: string;
@Column({
nullable: true,
comment: "ผลสำเร็จของงาน 3",
default: null,
})
achievement3: string;
@Column({
nullable: true,
comment: "ผลสำเร็จของงาน 4",
default: null,
})
achievement4: string;
@Column({
nullable: true,
comment: "ผลสำเร็จของงาน 5",
default: null,
})
achievement5: string;
@OneToMany(
() => KpiUserEvaluationReasonRole,
(kpiUserEvaluationReasonRole) => kpiUserEvaluationReasonRole.kpiUserRole,
)
kpiUserEvaluationReasonRoles: KpiUserEvaluationReasonRole[];
}
export class CreateKpiUserRole {
@Column()
target: string;
@Column()
unit: number;
@Column()
weight: number;
@Column()
meaning: string;
@Column()
formula: string;
@Column("uuid")
kpiUserEvaluationId: string;
@Column("uuid")
kpiRoleId: string;
@Column()
documentInfoEvidence: string;
@Column({ nullable: true })
startDate?: Date;
@Column({ nullable: true })
endDate?: Date;
@Column()
achievement1: string;
@Column()
achievement2: string;
@Column()
achievement3: string;
@Column()
achievement4: string;
@Column()
achievement5: string;
}
export class UpdateKpiUserRole {
@Column()
target: string;
@Column()
unit: number;
@Column()
weight: number;
@Column()
meaning: string;
@Column()
formula: string;
@Column("uuid")
kpiUserEvaluationId: string;
@Column("uuid")
kpiRoleId: string;
@Column()
documentInfoEvidence: string;
@Column({ nullable: true })
startDate?: Date;
@Column({ nullable: true })
endDate?: Date;
@Column()
achievement1: string;
@Column()
achievement2: string;
@Column()
achievement3: string;
@Column()
achievement4: string;
@Column()
achievement5: string;
}
export class KpiUserRoleDataPoint {
id: string;
point: number;
}