From 8a29a374551b9b45a63f7f7e840b0be547c595af Mon Sep 17 00:00:00 2001 From: kittapath Date: Wed, 2 Oct 2024 14:08:40 +0700 Subject: [PATCH] no message --- src/controllers/CommandController.ts | 9 ++++-- src/entities/CommandRecive.ts | 32 +++++++++---------- ...727852313568-update_ProfileDevelopment3.ts | 20 ++++++++++++ 3 files changed, 43 insertions(+), 18 deletions(-) create mode 100644 src/migration/1727852313568-update_ProfileDevelopment3.ts diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index d316ec27..c6ea91a9 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -276,7 +276,10 @@ export class CommandController extends Controller { .map((x) => ({ id: x.id, citizenId: x.citizenId, - fullName: x.fullName, + prefix: x.prefix, + firstName: x.firstName, + lastName: x.lastName, + // profileId: x.profileId, order: x.order, remarkVertical: x.remarkVertical, remarkHorizontal: x.remarkHorizontal, @@ -989,7 +992,9 @@ export class CommandController extends Controller { persons: { refId: string; citizenId: string; - fullName: string; + prefix: string; + firstName: string; + lastName: string; }[]; }, @Request() request: RequestWithUser, diff --git a/src/entities/CommandRecive.ts b/src/entities/CommandRecive.ts index e0998802..3b25ad3d 100644 --- a/src/entities/CommandRecive.ts +++ b/src/entities/CommandRecive.ts @@ -14,27 +14,27 @@ export class CommandRecive extends EntityBase { @Column({ nullable: true, - comment: "ชื่อ-สกุล", + comment: "คำนำหน้า", length: 255, default: null, }) - fullName: string; + prefix: string; - // @Column({ - // nullable: true, - // comment: "ชื่อ", - // length: 255, - // default: null, - // }) - // firstName: string; + @Column({ + nullable: true, + comment: "ชื่อ", + length: 255, + default: null, + }) + firstName: string; - // @Column({ - // nullable: true, - // comment: "สกุล", - // length: 255, - // default: null, - // }) - // lastName: string; + @Column({ + nullable: true, + comment: "สกุล", + length: 255, + default: null, + }) + lastName: string; @Column({ nullable: true, diff --git a/src/migration/1727852313568-update_ProfileDevelopment3.ts b/src/migration/1727852313568-update_ProfileDevelopment3.ts new file mode 100644 index 00000000..3fc82083 --- /dev/null +++ b/src/migration/1727852313568-update_ProfileDevelopment3.ts @@ -0,0 +1,20 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateProfileDevelopment31727852313568 implements MigrationInterface { + name = 'UpdateProfileDevelopment31727852313568' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`fullName\``); + await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`prefix\` varchar(255) NULL COMMENT 'คำนำหน้า'`); + await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`firstName\` varchar(255) NULL COMMENT 'ชื่อ'`); + await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`lastName\` varchar(255) NULL COMMENT 'สกุล'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`lastName\``); + await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`firstName\``); + await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`prefix\``); + await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`fullName\` varchar(255) NULL COMMENT 'ชื่อ-สกุล'`); + } + +}