From 087098f8b265b15c28d7480de03ecb5db43341ab Mon Sep 17 00:00:00 2001 From: kittapath Date: Tue, 28 Jan 2025 12:35:06 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B9=80=E0=B8=A0?= =?UTF-8?q?=E0=B8=97=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B8=81=E0=B8=B2=E0=B8=A3?= =?UTF-8?q?=E0=B9=80=E0=B8=81=E0=B8=B5=E0=B8=A2=E0=B8=A3=E0=B8=95=E0=B8=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/InsigniaTypeController.ts | 3 ++- src/entities/ProfileHonor.ts | 11 +++++++++++ src/entities/ProfileHonorHistory.ts | 8 ++++++++ .../1738042376574-UpdateprofileHonoraddtype.ts | 16 ++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 src/migration/1738042376574-UpdateprofileHonoraddtype.ts diff --git a/src/controllers/InsigniaTypeController.ts b/src/controllers/InsigniaTypeController.ts index f3c6d076..ef23829d 100644 --- a/src/controllers/InsigniaTypeController.ts +++ b/src/controllers/InsigniaTypeController.ts @@ -146,7 +146,8 @@ export class InsigniaTypeController extends Controller { const insigniaType_Active = await this.insigniaTypeRepository.find({ select: ["id", "name", "createdAt", "lastUpdatedAt", "lastUpdateFullName", "isActive"], where: { isActive: true }, - order: { name: "ASC" }, + order: { name: "ASC", insignias: { level: "ASC" } }, + relations: ["insignias"], }); return new HttpSuccess(insigniaType_Active); } diff --git a/src/entities/ProfileHonor.ts b/src/entities/ProfileHonor.ts index cba41733..12643779 100644 --- a/src/entities/ProfileHonor.ts +++ b/src/entities/ProfileHonor.ts @@ -46,6 +46,14 @@ export class ProfileHonor extends EntityBase { }) issuer: string; + @Column({ + nullable: true, + length: 200, + comment: "ประเภท", + default: null, + }) + type: string; + @Column({ nullable: true, type: "datetime", @@ -88,6 +96,7 @@ export class CreateProfileHonor { issuer: string | null; refCommandDate: Date | null; refCommandNo: string | null; + type: string | null; isDate: boolean | null; } @@ -98,6 +107,7 @@ export class CreateProfileEmployeeHonor { issuer: string | null; refCommandDate: Date | null; refCommandNo: string | null; + type: string | null; isDate: boolean | null; } @@ -107,5 +117,6 @@ export type UpdateProfileHonor = { issuer?: string | null; refCommandDate?: Date | null; refCommandNo?: string | null; + type?: string | null; isDate: boolean | null; }; diff --git a/src/entities/ProfileHonorHistory.ts b/src/entities/ProfileHonorHistory.ts index c2a45581..b99e16b8 100644 --- a/src/entities/ProfileHonorHistory.ts +++ b/src/entities/ProfileHonorHistory.ts @@ -28,6 +28,14 @@ export class ProfileHonorHistory extends EntityBase { }) issuer: string; + @Column({ + nullable: true, + length: 200, + comment: "ประเภท", + default: null, + }) + type: string; + @Column({ nullable: true, type: "datetime", diff --git a/src/migration/1738042376574-UpdateprofileHonoraddtype.ts b/src/migration/1738042376574-UpdateprofileHonoraddtype.ts new file mode 100644 index 00000000..798a0e41 --- /dev/null +++ b/src/migration/1738042376574-UpdateprofileHonoraddtype.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateprofileHonoraddtype1738042376574 implements MigrationInterface { + name = 'UpdateprofileHonoraddtype1738042376574' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileHonorHistory\` ADD \`type\` varchar(200) NULL COMMENT 'ประเภท'`); + await queryRunner.query(`ALTER TABLE \`profileHonor\` ADD \`type\` varchar(200) NULL COMMENT 'ประเภท'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileHonor\` DROP COLUMN \`type\``); + await queryRunner.query(`ALTER TABLE \`profileHonorHistory\` DROP COLUMN \`type\``); + } + +}