From 751341a11cb44503cb5521a7bca73284f5aa2dd5 Mon Sep 17 00:00:00 2001 From: Kittapath Date: Wed, 19 Jun 2024 11:30:56 +0700 Subject: [PATCH 1/2] =?UTF-8?q?=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=A5?= =?UTF-8?q?=E0=B8=B0=E0=B9=80=E0=B8=AD=E0=B8=B5=E0=B8=A2=E0=B8=94=E0=B8=AA?= =?UTF-8?q?=E0=B8=A1=E0=B8=96=E0=B8=99=E0=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/KpiUserCapacityController.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/controllers/KpiUserCapacityController.ts b/src/controllers/KpiUserCapacityController.ts index 4f762b6..1a4f312 100644 --- a/src/controllers/KpiUserCapacityController.ts +++ b/src/controllers/KpiUserCapacityController.ts @@ -202,6 +202,7 @@ export class KpiUserCapacityController extends Controller { const [kpiUserCapacity, total] = await AppDataSource.getRepository(KpiUserCapacity) .createQueryBuilder("kpiUserCapacity") .leftJoinAndSelect("kpiUserCapacity.kpiCapacity", "kpiCapacity") + .leftJoinAndSelect("kpiCapacity.kpiCapacityDetails", "kpiCapacityDetails") .andWhere("kpiUserCapacity.kpiUserEvaluationId = :id", { id: id }) .andWhere(type ? "kpiCapacity.type LIKE :type" : "1=1", { type: type.toLocaleUpperCase() }) .orderBy("kpiUserCapacity.createdAt", "ASC") @@ -214,6 +215,7 @@ export class KpiUserCapacityController extends Controller { point: item.point, weight: item.weight, summary: item.summary, + achievement: item.kpiCapacity.kpiCapacityDetails, })); return new HttpSuccess({ data: mapData, total }); From 3d0f2c324563a2c12f9b906c3f49f4d944189813 Mon Sep 17 00:00:00 2001 From: Kittapath Date: Wed, 19 Jun 2024 13:57:24 +0700 Subject: [PATCH 2/2] =?UTF-8?q?=E0=B8=84=E0=B8=AD=E0=B8=B1=E0=B8=9E?= =?UTF-8?q?=E0=B9=80=E0=B8=94=E0=B8=97=E0=B8=84=E0=B8=B0=E0=B9=81=E0=B8=99?= =?UTF-8?q?=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entities/kpiUserEvaluation.ts | 34 ++++++++++++++++--- ...718780152397-update_table_kpi_add_point.ts | 22 ++++++++++++ 2 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 src/migration/1718780152397-update_table_kpi_add_point.ts diff --git a/src/entities/kpiUserEvaluation.ts b/src/entities/kpiUserEvaluation.ts index 3507875..bf2c490 100644 --- a/src/entities/kpiUserEvaluation.ts +++ b/src/entities/kpiUserEvaluation.ts @@ -156,13 +156,37 @@ export class KpiUserEvaluation extends EntityBase { }) capacityPoint: number; + @Column({ + type: "double", + nullable: true, + default: null, + comment: "คะแนนประเมินองค์ประกอบที่ 1", + }) + totalPoint1: number; + + @Column({ + type: "double", + nullable: true, + default: null, + comment: "คะแนนประเมินองค์ประกอบที่ 2.1", + }) + totalPoint2_1: number; + + @Column({ + type: "double", + nullable: true, + default: null, + comment: "คะแนนประเมินองค์ประกอบที่ 2.2", + }) + totalPoint2_2: number; + @Column({ type: "double", nullable: true, default: null, comment: "คะแนนประเมิน", }) - totalPoint: number; + summaryPoint: number; @Column({ nullable: true, @@ -251,13 +275,13 @@ export class updateKpiUserCheckEvaluation { export class updateKpiUserPointEvaluation { @Column() - plannedPoint: number | null; + totalPoint1?: number | null; @Column() - rolePoint: number | null; + totalPoint2_1?: number | null; @Column() - specialPoint: number | null; + totalPoint2_2?: number | null; @Column() - capacityPoint: number | null; + summaryPoint?: number | null; } export class updateKpiUserReqEditEvaluation { diff --git a/src/migration/1718780152397-update_table_kpi_add_point.ts b/src/migration/1718780152397-update_table_kpi_add_point.ts new file mode 100644 index 0000000..9244ef6 --- /dev/null +++ b/src/migration/1718780152397-update_table_kpi_add_point.ts @@ -0,0 +1,22 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableKpiAddPoint1718780152397 implements MigrationInterface { + name = 'UpdateTableKpiAddPoint1718780152397' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`totalPoint\``); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`totalPoint1\` double NULL COMMENT 'คะแนนประเมินองค์ประกอบที่ 1'`); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`totalPoint2_1\` double NULL COMMENT 'คะแนนประเมินองค์ประกอบที่ 2.1'`); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`totalPoint2_2\` double NULL COMMENT 'คะแนนประเมินองค์ประกอบที่ 2.2'`); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`summaryPoint\` double NULL COMMENT 'คะแนนประเมิน'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`summaryPoint\``); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`totalPoint2_2\``); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`totalPoint2_1\``); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`totalPoint1\``); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`totalPoint\` double NULL COMMENT 'คะแนนประเมิน'`); + } + +}