From e87e760075ae072507545b33db42e09fd7ab2d55 Mon Sep 17 00:00:00 2001 From: kittapath Date: Tue, 1 Oct 2024 00:41:09 +0700 Subject: [PATCH 1/5] comment --- src/controllers/DevelopmentController.ts | 91 +++++++++++++++++++++++- src/entities/DevelopmentHistory.ts | 7 +- src/interfaces/call-api.ts | 14 +--- 3 files changed, 97 insertions(+), 15 deletions(-) diff --git a/src/controllers/DevelopmentController.ts b/src/controllers/DevelopmentController.ts index 0a48802..1a37ea2 100644 --- a/src/controllers/DevelopmentController.ts +++ b/src/controllers/DevelopmentController.ts @@ -2344,6 +2344,7 @@ export class DevelopmentController extends Controller { relations: ["posLevel", "posType", "employeePosLevel", "employeePosType"], order: { isDone: "ASC", + isDoneIDP: "ASC", citizenId: "ASC", }, }); @@ -2380,6 +2381,7 @@ export class DevelopmentController extends Controller { dateStart: item.dateStart, dateEnd: item.dateEnd, isDone: item.isDone, + isDoneIDP: item.isDoneIDP, isProfile: item.isProfile, })); return new HttpSuccess(_getDevelopment); @@ -2461,6 +2463,90 @@ export class DevelopmentController extends Controller { return new HttpSuccess(getDevelopment); } + /** + * API รายละเอียดโครงการ/หลักสูตรการฝึกอบรม tab6 IDP ส่งบันทึกทะเบียนประวัติ + * + * @summary DEV_00 - รายละเอียดโครงการ/หลักสูตรการฝึกอบรมtab6 IDP ส่งบันทึกทะเบียนประวัติ # + * + * @param {string} id Id โครงการ + */ + @Get("tab6/done-idp/{id}") + async GetDevelopemtTab6IDPDoneById(@Path() id: string, @Request() request: RequestWithUser) { + const getDevelopment = await this.developmentHistoryRepository.find({ + where: { developmentId: id, isDoneIDP: false }, + relations: ["development"], + }); + await Promise.all( + getDevelopment.map(async (x) => { + const _data = Object.assign(new DevelopmentHistory(), x); + if (x.type == "OFFICER") { + await new CallAPI() + .PostData(request, "/org/profile/development", { + type: "DEVELOP", + profileId: x.profileId, + name: "", + target: "", + // achievement10: x.development.achievement10, + // achievement5: x.development.achievement5, + // achievement0: x.development.achievement0, + kpiDevelopmentId: x.development.id, + reasonDevelopment70: x.development.reasonActual70, + reasonDevelopment20: x.development.reasonActual20, + reasonDevelopment10: x.development.reasonActual10, + isDevelopment70: false, + isDevelopment20: false, + isDevelopment10: false, + // summary: x.development.summary, + // point: x.development.point, + }) + .then((x) => { + _data.isDoneIDP = true; + }) + .catch((x) => { + _data.isDoneIDP = false; + }); + } else if (x.type == "EMPLOYEE") { + await new CallAPI() + .PostData(request, "/org/profile-employee/development", { + type: "DEVELOP", + profileEmployeeId: x.profileId, + name: "", + target: "", + // achievement10: x.development.achievement10, + // achievement5: x.development.achievement5, + // achievement0: x.development.achievement0, + kpiDevelopmentId: x.development.id, + reasonDevelopment70: x.development.reasonActual70, + reasonDevelopment20: x.development.reasonActual20, + reasonDevelopment10: x.development.reasonActual10, + isDevelopment70: false, + isDevelopment20: false, + isDevelopment10: false, + // summary: x.development.summary, + // point: x.development.point, + }) + .then((x) => { + _data.isDoneIDP = true; + }) + .catch((x) => { + _data.isDoneIDP = false; + }); + } + + _data.lastUpdateUserId = request.user.sub; + _data.lastUpdateFullName = request.user.name; + _data.lastUpdatedAt = new Date(); + // addLogSequence(request, { + // action: "database", + // status: "success", + // description: "Store DevelopmentHistory.", + // }); + await this.developmentHistoryRepository.save(_data, { data: request }); + }), + ); + return new HttpSuccess(getDevelopment); + } + /** * API list หน่วยงาน * @@ -2634,7 +2720,10 @@ export class DevelopmentController extends Controller { }); } else if (item["ประเภท"] == "ลูกจ้างประจำ") { await new CallAPI() - .GetData(request, `/org/unauthorize/employee-prem/citizen/${item["รหัสประจำตัวประชาชน"]}`) + .GetData( + request, + `/org/unauthorize/employee-prem/citizen/${item["รหัสประจำตัวประชาชน"]}`, + ) .then(async (x: any) => { let development = Object.assign(new DevelopmentHistory(), x); development.dateStart = diff --git a/src/entities/DevelopmentHistory.ts b/src/entities/DevelopmentHistory.ts index f283e28..eeb61a1 100644 --- a/src/entities/DevelopmentHistory.ts +++ b/src/entities/DevelopmentHistory.ts @@ -216,6 +216,12 @@ export class DevelopmentHistory extends EntityBase { }) isDone: boolean; + @Column({ + comment: "บันทึก IDP ที่ทะเบียนประวัติ", + default: false, + }) + isDoneIDP: boolean; + @Column({ comment: "มีข้อมูลอยู่ในทะเบียนประวัติ", default: false, @@ -320,4 +326,3 @@ export class CreateDevelopmentHistoryOBO { @Column() dateEnd: Date | null; } - diff --git a/src/interfaces/call-api.ts b/src/interfaces/call-api.ts index f3d1b6f..711dc95 100644 --- a/src/interfaces/call-api.ts +++ b/src/interfaces/call-api.ts @@ -1,16 +1,4 @@ -import { - Controller, - Request, - Get, - Post, - Put, - Delete, - Patch, - Route, - Security, - Tags, - Path, -} from "tsoa"; +import { Path } from "tsoa"; import axios from "axios"; import { addLogSequence } from "./utils"; From 306902156897ef0cd954f16b30d5a32f5de903b8 Mon Sep 17 00:00:00 2001 From: kittapath Date: Tue, 1 Oct 2024 01:03:13 +0700 Subject: [PATCH 2/5] no message --- .../1723605750693-import0508241320.ts | 28 ------------------- ...429-update_developmentHis_add_isDoneIDP.ts | 14 ++++++++++ 2 files changed, 14 insertions(+), 28 deletions(-) delete mode 100644 src/migration/1723605750693-import0508241320.ts create mode 100644 src/migration/1727719189429-update_developmentHis_add_isDoneIDP.ts diff --git a/src/migration/1723605750693-import0508241320.ts b/src/migration/1723605750693-import0508241320.ts deleted file mode 100644 index 97a5c4b..0000000 --- a/src/migration/1723605750693-import0508241320.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class Import05082413201723605750693 implements MigrationInterface { - name = 'Import05082413201723605750693' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`CREATE TABLE \`developmentRisk\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`issues\` varchar(255) NULL COMMENT 'ประเด็นความเสี่ยง', \`chance\` int NULL COMMENT 'โอกาสที่จะเกิด', \`effects\` int NULL COMMENT 'ผลกระทบจากการเกิด', \`riskLevel\` varchar(255) NULL COMMENT 'ระดับความเสี่ยง', \`riskManagement\` varchar(255) NULL COMMENT 'เเนวทางการบริหารความเสี่ยง', \`developmentId\` varchar(255) NULL COMMENT 'คีย์นอก(FK)ของตาราง development', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); - await queryRunner.query(`CREATE TABLE \`developmentOther\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`topicAcademic\` varchar(255) NULL COMMENT 'หัวข้อ/ประเด็นการฝึกอบรม ศึกษาดูงาน', \`addressAcademic\` varchar(255) NULL COMMENT 'สถานที่ฝึกอบรม ศึกษาดูงาน', \`provinceActualId\` varchar(255) NULL COMMENT 'จังหวัด(ข้อมูลวิชาการ)', \`developmentId\` varchar(255) NULL COMMENT 'คีย์นอก(FK)ของตาราง development', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); - await queryRunner.query(`ALTER TABLE \`development\` ADD \`progressTracking\` longtext NULL COMMENT 'การติดตามความก้าวหน้า'`); - await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectEvaluation\` longtext NULL COMMENT 'การประเมินผลโครงการ'`); - await queryRunner.query(`ALTER TABLE \`development\` ADD \`obstacle\` longtext NULL COMMENT 'ปัญหาอุปสรรค'`); - await queryRunner.query(`ALTER TABLE \`development\` ADD \`suggestion\` longtext NULL COMMENT 'ข้อเสนอแนะ'`); - await queryRunner.query(`ALTER TABLE \`developmentRisk\` ADD CONSTRAINT \`FK_b1990ff92f534f65a4653ef1671\` FOREIGN KEY (\`developmentId\`) REFERENCES \`development\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`developmentOther\` ADD CONSTRAINT \`FK_d5dfdb7ca0d11c0cdf3b3a55e6f\` FOREIGN KEY (\`developmentId\`) REFERENCES \`development\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`developmentOther\` DROP FOREIGN KEY \`FK_d5dfdb7ca0d11c0cdf3b3a55e6f\``); - await queryRunner.query(`ALTER TABLE \`developmentRisk\` DROP FOREIGN KEY \`FK_b1990ff92f534f65a4653ef1671\``); - await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`suggestion\``); - await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`obstacle\``); - await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectEvaluation\``); - await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`progressTracking\``); - await queryRunner.query(`DROP TABLE \`developmentOther\``); - await queryRunner.query(`DROP TABLE \`developmentRisk\``); - } - -} diff --git a/src/migration/1727719189429-update_developmentHis_add_isDoneIDP.ts b/src/migration/1727719189429-update_developmentHis_add_isDoneIDP.ts new file mode 100644 index 0000000..c577bb8 --- /dev/null +++ b/src/migration/1727719189429-update_developmentHis_add_isDoneIDP.ts @@ -0,0 +1,14 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateDevelopmentHisAddIsDoneIDP1727719189429 implements MigrationInterface { + name = 'UpdateDevelopmentHisAddIsDoneIDP1727719189429' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`developmentHistory\` ADD \`isDoneIDP\` tinyint NOT NULL COMMENT 'บันทึก IDP ที่ทะเบียนประวัติ' DEFAULT 0`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`developmentHistory\` DROP COLUMN \`isDoneIDP\``); + } + +} From 2dce85a207793b6974ed4a60d96486a8c09ad504 Mon Sep 17 00:00:00 2001 From: kittapath Date: Tue, 1 Oct 2024 01:14:18 +0700 Subject: [PATCH 3/5] no message --- src/controllers/DevelopmentController.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/controllers/DevelopmentController.ts b/src/controllers/DevelopmentController.ts index 1a37ea2..c476bc3 100644 --- a/src/controllers/DevelopmentController.ts +++ b/src/controllers/DevelopmentController.ts @@ -2474,7 +2474,7 @@ export class DevelopmentController extends Controller { async GetDevelopemtTab6IDPDoneById(@Path() id: string, @Request() request: RequestWithUser) { const getDevelopment = await this.developmentHistoryRepository.find({ where: { developmentId: id, isDoneIDP: false }, - relations: ["development"], + relations: ["development", "development.developmentProjectTechniqueActuals"], }); await Promise.all( getDevelopment.map(async (x) => { @@ -2498,6 +2498,9 @@ export class DevelopmentController extends Controller { isDevelopment10: false, // summary: x.development.summary, // point: x.development.point, + developmentProjects: x.development.developmentProjectTechniqueActuals.map( + (x) => x.name, + ), }) .then((x) => { _data.isDoneIDP = true; @@ -2524,6 +2527,9 @@ export class DevelopmentController extends Controller { isDevelopment10: false, // summary: x.development.summary, // point: x.development.point, + developmentProjects: x.development.developmentProjectTechniqueActuals.map( + (x) => x.name, + ), }) .then((x) => { _data.isDoneIDP = true; From 1deee019b2b760edd070bbb622d490da6a7a98f2 Mon Sep 17 00:00:00 2001 From: kittapath Date: Tue, 1 Oct 2024 10:31:25 +0700 Subject: [PATCH 4/5] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B8=9F?= =?UTF-8?q?=E0=B8=B4=E0=B8=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/DevelopmentController.ts | 43 +++++++++------ src/entities/Development.ts | 55 ++++++++++++++++++- ...update_development_add_isReasonActual70.ts | 24 ++++++++ 3 files changed, 102 insertions(+), 20 deletions(-) create mode 100644 src/migration/1727753251629-update_development_add_isReasonActual70.ts diff --git a/src/controllers/DevelopmentController.ts b/src/controllers/DevelopmentController.ts index c476bc3..154e511 100644 --- a/src/controllers/DevelopmentController.ts +++ b/src/controllers/DevelopmentController.ts @@ -2189,9 +2189,15 @@ export class DevelopmentController extends Controller { reasonActual70: getDevelopment.reasonActual70, reasonActual20: getDevelopment.reasonActual20, reasonActual10: getDevelopment.reasonActual10, + isReasonActual70: getDevelopment.isReasonActual70, + isReasonActual20: getDevelopment.isReasonActual20, + isReasonActual10: getDevelopment.isReasonActual10, reasonPlanned70: getDevelopment.reasonPlanned70, reasonPlanned20: getDevelopment.reasonPlanned20, reasonPlanned10: getDevelopment.reasonPlanned10, + isReasonPlanned70: getDevelopment.isReasonPlanned70, + isReasonPlanned20: getDevelopment.isReasonPlanned20, + isReasonPlanned10: getDevelopment.isReasonPlanned10, developmentProjectTechniqueActuals: getDevelopment.developmentProjectTechniqueActuals .map((x) => x.name) .sort(), @@ -2244,6 +2250,9 @@ export class DevelopmentController extends Controller { reasonActual70: getDevelopment.reasonActual70, reasonActual20: getDevelopment.reasonActual20, reasonActual10: getDevelopment.reasonActual10, + isReasonActual70: getDevelopment.isReasonActual70, + isReasonActual20: getDevelopment.isReasonActual20, + isReasonActual10: getDevelopment.isReasonActual10, developmentProjectTechniqueActuals: getDevelopment.developmentProjectTechniqueActuals .map((x) => x.name) .sort(), @@ -2484,20 +2493,20 @@ export class DevelopmentController extends Controller { .PostData(request, "/org/profile/development", { type: "DEVELOP", profileId: x.profileId, - name: "", - target: "", - // achievement10: x.development.achievement10, - // achievement5: x.development.achievement5, - // achievement0: x.development.achievement0, + name: x.development.projectName, + achievement10: null, + achievement5: null, + achievement0: null, kpiDevelopmentId: x.development.id, reasonDevelopment70: x.development.reasonActual70, reasonDevelopment20: x.development.reasonActual20, reasonDevelopment10: x.development.reasonActual10, - isDevelopment70: false, - isDevelopment20: false, - isDevelopment10: false, - // summary: x.development.summary, - // point: x.development.point, + isDevelopment70: x.development.isReasonActual70, + isDevelopment20: x.development.isReasonActual20, + isDevelopment10: x.development.isReasonActual10, + developmentTarget: null, + developmentResults: null, + developmentReport: null, developmentProjects: x.development.developmentProjectTechniqueActuals.map( (x) => x.name, ), @@ -2513,11 +2522,10 @@ export class DevelopmentController extends Controller { .PostData(request, "/org/profile-employee/development", { type: "DEVELOP", profileEmployeeId: x.profileId, - name: "", - target: "", - // achievement10: x.development.achievement10, - // achievement5: x.development.achievement5, - // achievement0: x.development.achievement0, + name: x.development.projectName, + achievement10: null, + achievement5: null, + achievement0: null, kpiDevelopmentId: x.development.id, reasonDevelopment70: x.development.reasonActual70, reasonDevelopment20: x.development.reasonActual20, @@ -2525,8 +2533,9 @@ export class DevelopmentController extends Controller { isDevelopment70: false, isDevelopment20: false, isDevelopment10: false, - // summary: x.development.summary, - // point: x.development.point, + developmentTarget: null, + developmentResults: null, + developmentReport: null, developmentProjects: x.development.developmentProjectTechniqueActuals.map( (x) => x.name, ), diff --git a/src/entities/Development.ts b/src/entities/Development.ts index eb4b00e..0604367 100644 --- a/src/entities/Development.ts +++ b/src/entities/Development.ts @@ -294,6 +294,25 @@ export class Development extends EntityBase { }) reasonPlanned10: string; + @Column({ + comment: "รายละเอียดอื่นๆ 70 แผน", + default: false, + }) + isReasonPlanned70: boolean; + + @Column({ + comment: "รายละเอียดอื่นๆ 20 แผน", + default: false, + }) + isReasonPlanned20: boolean; + + @Column({ + nullable: true, + comment: "รายละเอียดอื่นๆ 10 แผน", + default: null, + }) + isReasonPlanned10: string; + @OneToMany( () => DevelopmentProjectTechniquePlanned, (developmentProjectTechniquePlanned: DevelopmentProjectTechniquePlanned) => @@ -322,6 +341,25 @@ export class Development extends EntityBase { }) reasonActual10: string; + @Column({ + comment: "รายละเอียดอื่นๆ 70 จริง", + default: false, + }) + isReasonActual70: boolean; + + @Column({ + comment: "รายละเอียดอื่นๆ 20 จริง", + default: false, + }) + isReasonActual20: boolean; + + @Column({ + nullable: true, + comment: "รายละเอียดอื่นๆ 10 จริง", + default: null, + }) + isReasonActual10: string; + @OneToMany( () => DevelopmentProjectTechniqueActual, (developmentProjectTechniqueActual: DevelopmentProjectTechniqueActual) => @@ -775,6 +813,12 @@ export class UpdateDevelopment3 { @Column() reasonPlanned10?: string; @Column() + isReasonPlanned70?: string; + @Column() + isReasonPlanned20?: string; + @Column() + isReasonPlanned10?: string; + @Column() isBackActual?: boolean | null; @Column() isHoldActual?: boolean | null; @@ -793,6 +837,12 @@ export class UpdateDevelopment3 { @Column() reasonActual10?: string; @Column() + isReasonActual70?: boolean; + @Column() + isReasonActual20?: boolean; + @Column() + isReasonActual10?: boolean; + @Column() strategyChildPlannedId?: string | null; @Column() strategyChildPlannedNode?: number | null; @@ -810,7 +860,6 @@ export class UpdateDevelopment4 { @Column() projectEvaluation: string | null; //end - } export class UpdateDevelopment5 { //new @@ -866,7 +915,7 @@ export class UpdateDevelopment8_1 { //end } -export class UpdateDevelopment8{ +export class UpdateDevelopment8 { @Column() expect: string | null; -} \ No newline at end of file +} diff --git a/src/migration/1727753251629-update_development_add_isReasonActual70.ts b/src/migration/1727753251629-update_development_add_isReasonActual70.ts new file mode 100644 index 0000000..32c8f84 --- /dev/null +++ b/src/migration/1727753251629-update_development_add_isReasonActual70.ts @@ -0,0 +1,24 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateDevelopmentAddIsReasonActual701727753251629 implements MigrationInterface { + name = 'UpdateDevelopmentAddIsReasonActual701727753251629' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`development\` ADD \`isReasonPlanned70\` tinyint NOT NULL COMMENT 'รายละเอียดอื่นๆ 70 แผน' DEFAULT 0`); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`isReasonPlanned20\` tinyint NOT NULL COMMENT 'รายละเอียดอื่นๆ 20 แผน' DEFAULT 0`); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`isReasonPlanned10\` varchar(255) NULL COMMENT 'รายละเอียดอื่นๆ 10 แผน'`); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`isReasonActual70\` tinyint NOT NULL COMMENT 'รายละเอียดอื่นๆ 70 จริง' DEFAULT 0`); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`isReasonActual20\` tinyint NOT NULL COMMENT 'รายละเอียดอื่นๆ 20 จริง' DEFAULT 0`); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`isReasonActual10\` varchar(255) NULL COMMENT 'รายละเอียดอื่นๆ 10 จริง'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`isReasonActual10\``); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`isReasonActual20\``); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`isReasonActual70\``); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`isReasonPlanned10\``); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`isReasonPlanned20\``); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`isReasonPlanned70\``); + } + +} From 2b1b5f25668c768c73186c621c141268f5228747 Mon Sep 17 00:00:00 2001 From: kittapath Date: Tue, 1 Oct 2024 10:59:49 +0700 Subject: [PATCH 5/5] no message --- src/entities/Development.ts | 10 ++++------ ...update_development_add_isReasonActual10.ts | 20 +++++++++++++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 src/migration/1727755044851-update_development_add_isReasonActual10.ts diff --git a/src/entities/Development.ts b/src/entities/Development.ts index 0604367..b807734 100644 --- a/src/entities/Development.ts +++ b/src/entities/Development.ts @@ -307,11 +307,10 @@ export class Development extends EntityBase { isReasonPlanned20: boolean; @Column({ - nullable: true, comment: "รายละเอียดอื่นๆ 10 แผน", - default: null, + default: false, }) - isReasonPlanned10: string; + isReasonPlanned10: boolean; @OneToMany( () => DevelopmentProjectTechniquePlanned, @@ -354,11 +353,10 @@ export class Development extends EntityBase { isReasonActual20: boolean; @Column({ - nullable: true, comment: "รายละเอียดอื่นๆ 10 จริง", - default: null, + default: false, }) - isReasonActual10: string; + isReasonActual10: boolean; @OneToMany( () => DevelopmentProjectTechniqueActual, diff --git a/src/migration/1727755044851-update_development_add_isReasonActual10.ts b/src/migration/1727755044851-update_development_add_isReasonActual10.ts new file mode 100644 index 0000000..a5a0c33 --- /dev/null +++ b/src/migration/1727755044851-update_development_add_isReasonActual10.ts @@ -0,0 +1,20 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateDevelopmentAddIsReasonActual101727755044851 implements MigrationInterface { + name = 'UpdateDevelopmentAddIsReasonActual101727755044851' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`isReasonPlanned10\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`isReasonPlanned10\` tinyint NOT NULL COMMENT 'รายละเอียดอื่นๆ 10 แผน' DEFAULT 0`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`isReasonActual10\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`isReasonActual10\` tinyint NOT NULL COMMENT 'รายละเอียดอื่นๆ 10 จริง' DEFAULT 0`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`isReasonActual10\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`isReasonActual10\` varchar(255) NULL COMMENT 'รายละเอียดอื่นๆ 10 จริง'`); + await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`isReasonPlanned10\``); + await queryRunner.query(`ALTER TABLE \`development\` ADD \`isReasonPlanned10\` varchar(255) NULL COMMENT 'รายละเอียดอื่นๆ 10 แผน'`); + } + +}