diff --git a/src/controllers/SalaryPeriodController.ts b/src/controllers/SalaryPeriodController.ts index cb6ea42..b3a47ac 100644 --- a/src/controllers/SalaryPeriodController.ts +++ b/src/controllers/SalaryPeriodController.ts @@ -668,10 +668,10 @@ export class SalaryPeriodController extends Controller { @Path() id: string, @Body() body: { - isPunish: boolean; - isSuspension: boolean; - isAbsent: boolean; - isLeave: boolean; + isPunish: any; + isSuspension: any; + isAbsent: any; + isLeave: any; }, @Request() request: { user: Record }, ) { diff --git a/src/entities/SalaryProfile.ts b/src/entities/SalaryProfile.ts index 28a52fa..75f23c4 100644 --- a/src/entities/SalaryProfile.ts +++ b/src/entities/SalaryProfile.ts @@ -248,28 +248,28 @@ export class SalaryProfile extends EntityBase { @Column({ nullable: true, comment: "การลงโทษทางวินัย", - default: false, + default: null, }) isPunish: boolean; @Column({ nullable: true, comment: "พักราชการ", - default: false, + default: null, }) isSuspension: boolean; @Column({ nullable: true, comment: "ขาดราชการ", - default: false, + default: null, }) isAbsent: boolean; @Column({ nullable: true, comment: "วันลา", - default: false, + default: null, }) isLeave: boolean; diff --git a/src/migration/1709802836209-update_table_salaryProfile_isPunish_nullable.ts b/src/migration/1709802836209-update_table_salaryProfile_isPunish_nullable.ts new file mode 100644 index 0000000..13f8240 --- /dev/null +++ b/src/migration/1709802836209-update_table_salaryProfile_isPunish_nullable.ts @@ -0,0 +1,20 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableSalaryProfileIsPunishNullable1709802836209 implements MigrationInterface { + name = 'UpdateTableSalaryProfileIsPunishNullable1709802836209' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`isPunish\` \`isPunish\` tinyint NULL COMMENT 'การลงโทษทางวินัย'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`isSuspension\` \`isSuspension\` tinyint NULL COMMENT 'พักราชการ'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`isAbsent\` \`isAbsent\` tinyint NULL COMMENT 'ขาดราชการ'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`isLeave\` \`isLeave\` tinyint NULL COMMENT 'วันลา'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`isLeave\` \`isLeave\` tinyint NULL COMMENT 'วันลา' DEFAULT '0'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`isAbsent\` \`isAbsent\` tinyint NULL COMMENT 'ขาดราชการ' DEFAULT '0'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`isSuspension\` \`isSuspension\` tinyint NULL COMMENT 'พักราชการ' DEFAULT '0'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`isPunish\` \`isPunish\` tinyint NULL COMMENT 'การลงโทษทางวินัย' DEFAULT '0'`); + } + +}