From 297d567fade8cbd0a82f83484b219e7ae75c6eb3 Mon Sep 17 00:00:00 2001 From: Kittapath Date: Mon, 18 Mar 2024 13:50:53 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=E0=B8=82=E0=B8=B1=E0=B9=89=E0=B8=99=E0=B9=80=E0=B8=87=E0=B8=B4?= =?UTF-8?q?=E0=B8=99=E0=B9=80=E0=B8=94=E0=B8=B7=E0=B8=AD=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/SalaryPeriodController.ts | 7 +++---- src/entities/SalaryProfileEmployee.ts | 8 ++++++++ ...98-update_table_salayprofile_add_salarylevel.ts | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 src/migration/1710744556698-update_table_salayprofile_add_salarylevel.ts diff --git a/src/controllers/SalaryPeriodController.ts b/src/controllers/SalaryPeriodController.ts index f788db0..fc6253c 100644 --- a/src/controllers/SalaryPeriodController.ts +++ b/src/controllers/SalaryPeriodController.ts @@ -1643,7 +1643,7 @@ export class SalaryPeriodController extends Controller { }), ); await Promise.all( - orgProfiles.map(async (profile: any) => { + orgProfileEmployees.map(async (profile: any) => { const salaryOrgNew = await this.salaryOrgEmployeeRepository.findOne({ where: { salaryPeriodId: salaryPeriod.id, @@ -1979,7 +1979,6 @@ export class SalaryPeriodController extends Controller { } } total = 1000; - let orgProfileEmployees: any; let _orgProfileEmployees = await new CallAPI().PostData( request, "org/unauthorize/profile/salary/employee/gen", @@ -1991,7 +1990,7 @@ export class SalaryPeriodController extends Controller { period: salaryPeriod.period, }, ); - orgProfileEmployees = _orgProfileEmployees.data; + let orgProfileEmployees = _orgProfileEmployees.data; total = _orgProfileEmployees.total; if (total > 1000) { const page = Math.ceil(total / 1000); @@ -2113,7 +2112,7 @@ export class SalaryPeriodController extends Controller { }), ); await Promise.all( - orgProfiles.map(async (profile: any) => { + orgProfileEmployees.map(async (profile: any) => { const salaryOrgNew = await this.salaryOrgEmployeeRepository.findOne({ where: { salaryPeriodId: salaryPeriod.id, diff --git a/src/entities/SalaryProfileEmployee.ts b/src/entities/SalaryProfileEmployee.ts index 8e1ee76..797840f 100644 --- a/src/entities/SalaryProfileEmployee.ts +++ b/src/entities/SalaryProfileEmployee.ts @@ -10,6 +10,14 @@ export class SalaryProfileEmployee extends EntityBase { }) salaryOrgId: string; + @Column({ + type: "double", + nullable: true, + comment: "ขั้นเงินเดือน", + default: null, + }) + salaryLevel: number | null; + @Column({ nullable: true, comment: "คำนำหน้า", diff --git a/src/migration/1710744556698-update_table_salayprofile_add_salarylevel.ts b/src/migration/1710744556698-update_table_salayprofile_add_salarylevel.ts new file mode 100644 index 0000000..c64ef4a --- /dev/null +++ b/src/migration/1710744556698-update_table_salayprofile_add_salarylevel.ts @@ -0,0 +1,14 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableSalayprofileAddSalarylevel1710744556698 implements MigrationInterface { + name = 'UpdateTableSalayprofileAddSalarylevel1710744556698' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` ADD \`salaryLevel\` double NULL COMMENT 'ขั้นเงินเดือน'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` DROP COLUMN \`salaryLevel\``); + } + +}