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

118 lines
No EOL
2.3 KiB
TypeScript

import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { KpiUserEvaluation } from "./kpiUserEvaluation";
import { KpiRole } from "./kpiRole";
import { Double } from "typeorm/browser";
@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;
}
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;
}
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;
}