เพิ่มฟิว entity
This commit is contained in:
parent
29660a43ae
commit
784ec51ac1
5 changed files with 106 additions and 6 deletions
|
|
@ -176,6 +176,15 @@ export class KpiUserPlannedController extends Controller {
|
|||
includingName: item.kpiPlan.includingName,
|
||||
target: item.target,
|
||||
weight: item.weight,
|
||||
unit: item.unit,
|
||||
meaning: item.meaning,
|
||||
formula: item.formula,
|
||||
point: item.point,
|
||||
achievement: item.point === 1 ? "ระดับ 1" :
|
||||
item.point === 2 ? "ระดับ 2" :
|
||||
item.point === 3 ? "ระดับ 3" :
|
||||
item.point === 3 ? "ระดับ 4" :
|
||||
item.point === 3 ? "ระดับ 5" : null,
|
||||
achievement1: item.kpiPlan.achievement1,
|
||||
achievement2: item.kpiPlan.achievement2,
|
||||
achievement3: item.kpiPlan.achievement3,
|
||||
|
|
|
|||
|
|
@ -94,6 +94,19 @@ export class KpiUserRoleController extends Controller {
|
|||
if (!kpiUserRole) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลงานตามหน้าที่ความรับผิดชอบหลักนี้");
|
||||
}
|
||||
const chkUserEvaluation = await this.kpiUserEvaluationRepository.findOne({
|
||||
where:{id:requestBody.kpiUserEvaluationId},
|
||||
})
|
||||
if (!chkUserEvaluation) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมินผู้ใช้งาน");
|
||||
}
|
||||
|
||||
const chkKpiRole = await this.kpiRoleRepository.findOne({
|
||||
where:{id:requestBody.kpiRoleId},
|
||||
})
|
||||
if (!chkKpiRole) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมินตามหน้าที่ความรับผิดชอบหลัก");
|
||||
}
|
||||
|
||||
kpiUserRole.lastUpdateUserId = request.user.sub;
|
||||
kpiUserRole.lastUpdateFullName = request.user.name;
|
||||
|
|
@ -161,8 +174,13 @@ export class KpiUserRoleController extends Controller {
|
|||
*
|
||||
*/
|
||||
@Get()
|
||||
async GetKpiUserRole() {
|
||||
async GetKpiUserRole(
|
||||
@Query("id") id: string ,
|
||||
) {
|
||||
const kpiUserRole = await this.kpiUserRoleRepository.find({
|
||||
where:{
|
||||
kpiUserEvaluationId:id
|
||||
},
|
||||
relations: ["kpiRole","kpiUserEvaluation"],
|
||||
order: { createdAt: "ASC" },
|
||||
});
|
||||
|
|
@ -172,10 +190,20 @@ export class KpiUserRoleController extends Controller {
|
|||
const mapKpiUserRole = kpiUserRole.map((item) => ({
|
||||
id: item.id,
|
||||
evaluationId: item.kpiUserEvaluation.id,
|
||||
indicatorId: item.kpiRole.id,
|
||||
kpiRoleId: item.kpiRole.id,
|
||||
including: item.kpiRole.including,
|
||||
includingName: item.kpiRole.includingName,
|
||||
target: item.target,
|
||||
weight: item.weight,
|
||||
unit: item.unit,
|
||||
meaning: item.meaning,
|
||||
formula: item.formula,
|
||||
point: item.point,
|
||||
achievement: item.point === 1 ? "ระดับ 1" :
|
||||
item.point === 2 ? "ระดับ 2" :
|
||||
item.point === 3 ? "ระดับ 3" :
|
||||
item.point === 3 ? "ระดับ 4" :
|
||||
item.point === 3 ? "ระดับ 5" : null,
|
||||
achievement1: item.kpiRole.achievement1,
|
||||
achievement2: item.kpiRole.achievement2,
|
||||
achievement3: item.kpiRole.achievement3,
|
||||
|
|
|
|||
|
|
@ -40,6 +40,36 @@ export class KpiCapacity extends EntityBase {
|
|||
})
|
||||
description: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ระดับที่คาดหวัง",
|
||||
default: null,
|
||||
})
|
||||
level: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "น้ำหนัก",
|
||||
default: null,
|
||||
})
|
||||
weight: number;
|
||||
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ระดับคะแนน",
|
||||
default: null,
|
||||
})
|
||||
point: number;
|
||||
|
||||
@Column({
|
||||
type: "double",
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "ผลการประเมิน"
|
||||
})
|
||||
summary: number;
|
||||
|
||||
@OneToMany(() => KpiCapacityDetail, (kpiCapacityDetail) => kpiCapacityDetail.kpiCapacity)
|
||||
kpiCapacityDetails: KpiCapacityDetail[];
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,21 @@ export class KpiUserPlanned extends EntityBase {
|
|||
@ManyToOne(() => KpiPlan, (kpiPlan) => kpiPlan.kpiUserPlanneds)
|
||||
@JoinColumn({ name: "kpiPlanId" })
|
||||
kpiPlan: KpiPlan;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ระดับคะแนน",
|
||||
default: null,
|
||||
})
|
||||
point: number;
|
||||
|
||||
@Column({
|
||||
type: "double",
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "ผลการประเมิน"
|
||||
})
|
||||
summary: number;
|
||||
}
|
||||
|
||||
export class CreateKpiUserPlanned {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ 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 {
|
||||
|
|
@ -63,6 +64,23 @@ export class KpiUserRole extends EntityBase {
|
|||
@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 {
|
||||
|
|
@ -93,8 +111,8 @@ export class UpdateKpiUserRole {
|
|||
meaning: string;
|
||||
@Column()
|
||||
formula: string;
|
||||
// @Column("uuid")
|
||||
// kpiUserEvaluationId: string;
|
||||
// @Column("uuid")
|
||||
// kpiPlanId: string;
|
||||
@Column("uuid")
|
||||
kpiUserEvaluationId: string;
|
||||
@Column("uuid")
|
||||
kpiRoleId: string;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue