From 0d292ee22b8db059a80b4fc95d37abb3d560c918 Mon Sep 17 00:00:00 2001 From: Kittapath Date: Wed, 15 May 2024 20:17:34 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=E0=B8=9F=E0=B8=B4=E0=B8=A7=E0=B8=95=E0=B8=B3=E0=B9=81=E0=B8=AB?= =?UTF-8?q?=E0=B8=99=E0=B9=88=E0=B8=87=E0=B9=83=E0=B8=99=E0=B9=81=E0=B8=9A?= =?UTF-8?q?=E0=B8=9A=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B9=80=E0=B8=A1=E0=B8=B4?= =?UTF-8?q?=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../KpiUserEvaluationController.ts | 10 +++- src/entities/kpiUserEvaluation.ts | 48 +++++++++++++++++++ ..._KpiUserEvaluation_add_posExecutiveName.ts | 20 ++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 src/migration/1715778412203-update_table_KpiUserEvaluation_add_posExecutiveName.ts diff --git a/src/controllers/KpiUserEvaluationController.ts b/src/controllers/KpiUserEvaluationController.ts index e9fb26b..e6528b8 100644 --- a/src/controllers/KpiUserEvaluationController.ts +++ b/src/controllers/KpiUserEvaluationController.ts @@ -204,6 +204,10 @@ export class KpiUserEvaluationController extends Controller { kpiUserEvaluation.prefix = x.prefix; kpiUserEvaluation.firstName = x.firstName; kpiUserEvaluation.lastName = x.lastName; + kpiUserEvaluation.position = x.position; + kpiUserEvaluation.posLevelName = x.posLevelName; + kpiUserEvaluation.posTypeName = x.posTypeName; + kpiUserEvaluation.posExecutiveName = x.posExecutiveName; }) .catch((x) => {}); kpiUserEvaluation.evaluationStatus = "NEW"; @@ -309,7 +313,7 @@ export class KpiUserEvaluationController extends Controller { kpiUserEvaluation.lastUpdateUserId = request.user.sub; kpiUserEvaluation.lastUpdateFullName = request.user.name; - this.kpiUserEvalutionRepository.merge(kpiUserEvaluation, requestBody); + Object.assign(kpiUserEvaluation, requestBody); await this.kpiUserEvalutionRepository.save(kpiUserEvaluation); return new HttpSuccess(kpiUserEvaluation.id); } @@ -426,6 +430,10 @@ export class KpiUserEvaluationController extends Controller { prefix: kpiUserEvaluation.prefix, firstName: kpiUserEvaluation.firstName, lastName: kpiUserEvaluation.lastName, + position: kpiUserEvaluation.position, + posLevelName: kpiUserEvaluation.posLevelName, + posTypeName: kpiUserEvaluation.posTypeName, + posExecutiveName: kpiUserEvaluation.posExecutiveName, evaluationStatus: kpiUserEvaluation.evaluationStatus, evaluationResults: kpiUserEvaluation.evaluationResults, evaluationReqEdit: kpiUserEvaluation.evaluationReqEdit, diff --git a/src/entities/kpiUserEvaluation.ts b/src/entities/kpiUserEvaluation.ts index 3bae4c8..04d1b9d 100644 --- a/src/entities/kpiUserEvaluation.ts +++ b/src/entities/kpiUserEvaluation.ts @@ -32,6 +32,38 @@ export class KpiUserEvaluation extends EntityBase { }) lastName: string; + @Column({ + nullable: true, + comment: "ตำแหน่ง", + length: 255, + default: null, + }) + position: string; + + @Column({ + nullable: true, + comment: "ประเภทตำแหน่ง", + length: 100, + default: null, + }) + posTypeName: string; + + @Column({ + nullable: true, + comment: "ระดับตำแหน่ง", + length: 100, + default: null, + }) + posLevelName: string; + + @Column({ + nullable: true, + comment: "ตำแหน่งทางการบริหาร", + length: 255, + default: null, + }) + posExecutiveName: string; + @Column({ nullable: true, length: 40, @@ -160,6 +192,14 @@ export class createKpiUserEvaluation { @Column() lastName: string; @Column() + position: string | null; + @Column() + posTypeName: string | null; + @Column() + posLevelName: string | null; + @Column() + posExecutiveName: string | null; + @Column() kpiPeriodId: string; @Column() profileId: string; @@ -179,6 +219,14 @@ export class updateKpiUserEvaluation { @Column() lastName: string; @Column() + position: string | null; + @Column() + posTypeName: string | null; + @Column() + posLevelName: string | null; + @Column() + posExecutiveName: string | null; + @Column() kpiPeriodId: string; @Column() profileId: string; diff --git a/src/migration/1715778412203-update_table_KpiUserEvaluation_add_posExecutiveName.ts b/src/migration/1715778412203-update_table_KpiUserEvaluation_add_posExecutiveName.ts new file mode 100644 index 0000000..8c6c935 --- /dev/null +++ b/src/migration/1715778412203-update_table_KpiUserEvaluation_add_posExecutiveName.ts @@ -0,0 +1,20 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableKpiUserEvaluationAddPosExecutiveName1715778412203 implements MigrationInterface { + name = 'UpdateTableKpiUserEvaluationAddPosExecutiveName1715778412203' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`position\` varchar(255) NULL COMMENT 'ตำแหน่ง'`); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`posTypeName\` varchar(100) NULL COMMENT 'ประเภทตำแหน่ง'`); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`posLevelName\` varchar(100) NULL COMMENT 'ระดับตำแหน่ง'`); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`posExecutiveName\` varchar(255) NULL COMMENT 'ตำแหน่งทางการบริหาร'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`posExecutiveName\``); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`posLevelName\``); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`posTypeName\``); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`position\``); + } + +}