From cd419686b0d8f25a58583deb42527af2f67517b5 Mon Sep 17 00:00:00 2001 From: kittapath Date: Fri, 14 Mar 2025 13:36:26 +0700 Subject: [PATCH] api update isdirector --- src/controllers/ImportDataController.ts | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/controllers/ImportDataController.ts b/src/controllers/ImportDataController.ts index da833b71..8c428641 100644 --- a/src/controllers/ImportDataController.ts +++ b/src/controllers/ImportDataController.ts @@ -2481,7 +2481,6 @@ export class ImportDataController extends Controller { .createQueryBuilder("profile") .select(["profile.citizenId", "profile.id"]) .orderBy("profile.citizenId", "ASC") - .where("profile.citizenId = '3101501190150'") // .skip(0) // .take(1000) .getManyAndCount(); @@ -2498,9 +2497,7 @@ export class ImportDataController extends Controller { }); // await Promise.all( // profiles.map(async (_item) => { - console.log("XXXXXXXXXXXXXXX"); for await (const _item of profiles) { - console.log("zzzzzzzzzzzzz"); const existingProfile = await this.ProfileSalariesRepo.find({ where: { posNo: _item.citizenId }, order: { @@ -2511,7 +2508,6 @@ export class ImportDataController extends Controller { // await Promise.all( // existingProfile.map(async (item) => { for await (const item of existingProfile) { - console.log("zzzzzzz4zzzzzz"); rowCount++; const profileSalary: any = new ProfileSalary(); profileSalary.profileId = _item.id; @@ -2540,7 +2536,6 @@ export class ImportDataController extends Controller { profileSalary.positionCee = this.canConvertToInt(item.PositionLevelName) ? item.PositionLevelName : _null; - //xxxxxxxxxxxxxxxxx profileSalary.positionType = item.PositionTypeName; profileSalary.isEntry = true; @@ -2577,4 +2572,23 @@ export class ImportDataController extends Controller { return null; } } + + /** + * @summary เงินเดือน ข้าราชการ + */ + @Post("mark-director") + async UpdateMarkDirector(@Request() request: { user: Record }) { + let rowCount = 0; + const posMaster = await this.posMasterRepo.find({ + where: { positions: { posExecutiveId: Not(IsNull()) } }, + }); + + for await (const _item of posMaster) { + rowCount++; + _item.isDirector = true; + await this.posMasterRepo.save(_item); + console.log(rowCount); + } + return new HttpSuccess(); + } }