diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index 0a6a053e..ba9e970b 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -110,6 +110,7 @@ export class CommandController extends Controller { : `${commandTypeId}`, }, ) + .orderBy("commandSalary.createdAt", "ASC") .skip((page - 1) * pageSize) .take(pageSize) .getManyAndCount(); @@ -196,6 +197,8 @@ export class CommandController extends Controller { detailHeader: command.detailHeader, detailBody: command.detailBody, detailFooter: command.detailFooter, + isBangkok: command.isBangkok, + isAttachment: command.isAttachment, commandAffectDate: command.commandAffectDate, commandExcecuteDate: command.commandExcecuteDate, commandTypeName: command.commandType?.name || null, @@ -224,6 +227,7 @@ export class CommandController extends Controller { detailFooter: string | null; commandAffectDate: Date | null; commandExcecuteDate: Date | null; + isBangkok: boolean | null; }, @Request() request: RequestWithUser, ) { @@ -268,7 +272,7 @@ export class CommandController extends Controller { id: x.id, citizenId: x.citizenId, prefix: x.prefix, - fristName: x.fristName, + firstName: x.firstName, lastName: x.lastName, profileId: x.profileId, order: x.order, @@ -320,7 +324,7 @@ export class CommandController extends Controller { return new HttpSuccess(); } - @Get("tap2/swap/{direction}/{commandReciveId}") + @Get("tab2/swap/{direction}/{commandReciveId}") public async swapSalary( @Path() direction: string, commandReciveId: string, @@ -448,7 +452,7 @@ export class CommandController extends Controller { id: item.id, citizenId: item.citizenId, prefix: item.prefix, - fristName: item.fristName, + firstName: item.firstName, lastName: item.lastName, position: item.position, org: item.org, @@ -501,7 +505,7 @@ export class CommandController extends Controller { commandSend.citizenId = profile.citizenId; commandSend.prefix = profile.rank != null && profile.rank != "" ? profile.rank : profile.prefix; - commandSend.fristName = profile.firstName; + commandSend.firstName = profile.firstName; commandSend.lastName = profile.lastName; commandSend.position = profile.position; commandSend.org = diff --git a/src/entities/Command.ts b/src/entities/Command.ts index f0d31665..2819176d 100644 --- a/src/entities/Command.ts +++ b/src/entities/Command.ts @@ -92,6 +92,14 @@ export class Command extends EntityBase { }) positionDetail: string; + @Column({ + nullable: true, + default: null, + type: "boolean", + comment: "คำสั่งกรุงเทพมหานคร", + }) + isBangkok: boolean; + @Column({ comment: "สถานะบัญชีแนบท้าย", default: true, diff --git a/src/entities/CommandRecive.ts b/src/entities/CommandRecive.ts index 59a53f03..b017f82e 100644 --- a/src/entities/CommandRecive.ts +++ b/src/entities/CommandRecive.ts @@ -27,7 +27,7 @@ export class CommandRecive extends EntityBase { length: 255, default: null, }) - fristName: string; + firstName: string; @Column({ nullable: true, diff --git a/src/entities/CommandSend.ts b/src/entities/CommandSend.ts index 8e100bda..10c8469b 100644 --- a/src/entities/CommandSend.ts +++ b/src/entities/CommandSend.ts @@ -28,7 +28,7 @@ export class CommandSend extends EntityBase { length: 255, default: null, }) - fristName: string; + firstName: string; @Column({ nullable: true, diff --git a/src/migration/1727260590227-update_commandRecive_add_salary1.ts b/src/migration/1727260590227-update_commandRecive_add_salary1.ts new file mode 100644 index 00000000..c65c2420 --- /dev/null +++ b/src/migration/1727260590227-update_commandRecive_add_salary1.ts @@ -0,0 +1,24 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateCommandReciveAddSalary11727260590227 implements MigrationInterface { + name = 'UpdateCommandReciveAddSalary11727260590227' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`commandRecive\` CHANGE \`fristName\` \`firstName\` varchar(255) NULL COMMENT 'ชื่อ'`); + await queryRunner.query(`ALTER TABLE \`commandSend\` CHANGE \`fristName\` \`firstName\` varchar(255) NULL COMMENT 'ชื่อ'`); + await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`firstName\``); + await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`firstName\` varchar(255) NULL COMMENT 'ชื่อ'`); + await queryRunner.query(`ALTER TABLE \`commandSend\` DROP COLUMN \`firstName\``); + await queryRunner.query(`ALTER TABLE \`commandSend\` ADD \`firstName\` varchar(255) NULL COMMENT 'ชื่อ'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`commandSend\` DROP COLUMN \`firstName\``); + await queryRunner.query(`ALTER TABLE \`commandSend\` ADD \`firstName\` varchar(255) NULL COMMENT 'ชื่อ'`); + await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`firstName\``); + await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`firstName\` varchar(255) NULL COMMENT 'ชื่อ'`); + await queryRunner.query(`ALTER TABLE \`commandSend\` CHANGE \`firstName\` \`fristName\` varchar(255) NULL COMMENT 'ชื่อ'`); + await queryRunner.query(`ALTER TABLE \`commandRecive\` CHANGE \`firstName\` \`fristName\` varchar(255) NULL COMMENT 'ชื่อ'`); + } + +} diff --git a/src/migration/1727272904603-update_commandRecive_add_isbangkok.ts b/src/migration/1727272904603-update_commandRecive_add_isbangkok.ts new file mode 100644 index 00000000..c335a140 --- /dev/null +++ b/src/migration/1727272904603-update_commandRecive_add_isbangkok.ts @@ -0,0 +1,14 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateCommandReciveAddIsbangkok1727272904603 implements MigrationInterface { + name = 'UpdateCommandReciveAddIsbangkok1727272904603' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`command\` ADD \`isBangkok\` tinyint NULL COMMENT 'คำสั่งกรุงเทพมหานคร'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`command\` DROP COLUMN \`isBangkok\``); + } + +}