From 05c38b8d8e06d78bc2d7c2ada0846d10ce74b55e Mon Sep 17 00:00:00 2001 From: Harid Promsri <52228846+Harid-999@users.noreply.github.com> Date: Mon, 27 Oct 2025 16:40:15 +0700 Subject: [PATCH 1/3] =?UTF-8?q?=E0=B8=97=E0=B8=B5=E0=B9=88=E0=B8=95?= =?UTF-8?q?=E0=B8=B3=E0=B9=81=E0=B8=AB=E0=B8=99=E0=B9=88=E0=B8=87=E0=B9=81?= =?UTF-8?q?=E0=B8=AA=E0=B8=94=E0=B8=87=E0=B9=84=E0=B8=A1=E0=B9=88=E0=B8=95?= =?UTF-8?q?=E0=B8=A3=E0=B8=87=E0=B8=81=E0=B8=B1=E0=B8=9A=E0=B8=97=E0=B8=B0?= =?UTF-8?q?=E0=B9=80=E0=B8=9A=E0=B8=B5=E0=B8=A2=E0=B8=99=E0=B8=9B=E0=B8=A3?= =?UTF-8?q?=E0=B8=B0=E0=B8=A7=E0=B8=B1=E0=B8=95=E0=B8=B4=20#1899=20(#204)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: harid --- src/controllers/ProfileController.ts | 28 +++++++++++++------- src/controllers/ProfileEmployeeController.ts | 13 ++++++--- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index aebd8fa6..e32494c0 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -7365,40 +7365,45 @@ export class ProfileController extends Controller { nodeDnaId: null, type: profile.employeeClass, salary: profile.amount, - posNo: - root?.orgRootShortName && posMaster?.posMasterNo - ? `${root?.orgRootShortName} ${posMaster?.posMasterNo}` - : "", + posNo: null + // root?.orgRootShortName && posMaster?.posMasterNo + // ? `${root?.orgRootShortName} ${posMaster?.posMasterNo}` + // : "", }; if (_profile.child4Id != null) { _profile.node = 4; _profile.nodeId = _profile.child4Id; _profile.nodeDnaId = _profile.child4DnaId; _profile.nodeShortName = _profile.child4ShortName; + _profile.posNo = `${_profile.child4ShortName} ${_profile.posMasterNo}`; } else if (_profile.child3Id != null) { _profile.node = 3; _profile.nodeId = _profile.child3Id; _profile.nodeDnaId = _profile.child3DnaId; _profile.nodeShortName = _profile.child3ShortName; + _profile.posNo = `${_profile.child3ShortName} ${_profile.posMasterNo}`; } else if (_profile.child2Id != null) { _profile.node = 2; _profile.nodeId = _profile.child2Id; _profile.nodeDnaId = _profile.child2DnaId; _profile.nodeShortName = _profile.child2ShortName; + _profile.posNo = `${_profile.child2ShortName} ${_profile.posMasterNo}`; } else if (_profile.child1Id != null) { _profile.node = 1; _profile.nodeId = _profile.child1Id; _profile.nodeDnaId = _profile.child1DnaId; _profile.nodeShortName = _profile.child1ShortName; + _profile.posNo = `${_profile.child1ShortName} ${_profile.posMasterNo}`; } else if (_profile.rootId != null) { _profile.node = 0; _profile.nodeId = _profile.rootId; _profile.nodeDnaId = _profile.rootDnaId; _profile.nodeShortName = _profile.rootShortName; + _profile.posNo = `${_profile.rootShortName} ${_profile.posMasterNo}`; } return new HttpSuccess(_profile); } - + // ขรก. let orgRevisionPublish: any = await this.orgRevisionRepo .createQueryBuilder("orgRevision") .where("orgRevision.orgRevisionIsDraft = false") @@ -7529,10 +7534,10 @@ export class ProfileController extends Controller { nodeDnaId: null, salary: profile ? profile.amount : null, amountSpecial: profile ? profile.amountSpecial : null, - posNo: - root?.orgRootShortName && posMaster?.posMasterNo - ? `${root?.orgRootShortName} ${posMaster?.posMasterNo}` - : "", + posNo: null + // root?.orgRootShortName && posMaster?.posMasterNo + // ? `${root?.orgRootShortName} ${posMaster?.posMasterNo}` + // : "", }; if (_profile.child4Id != null) { @@ -7540,26 +7545,31 @@ export class ProfileController extends Controller { _profile.nodeId = _profile.child4Id; _profile.nodeDnaId = _profile.child4DnaId; _profile.nodeShortName = _profile.child4ShortName; + _profile.posNo = `${_profile.child4ShortName} ${posMaster?.posMasterNo}`; } else if (_profile.child3Id != null) { _profile.node = 3; _profile.nodeId = _profile.child3Id; _profile.nodeDnaId = _profile.child3DnaId; _profile.nodeShortName = _profile.child3ShortName; + _profile.posNo = `${_profile.child3ShortName} ${posMaster?.posMasterNo}`; } else if (_profile.child2Id != null) { _profile.node = 2; _profile.nodeId = _profile.child2Id; _profile.nodeDnaId = _profile.child2DnaId; _profile.nodeShortName = _profile.child2ShortName; + _profile.posNo = `${_profile.child2ShortName} ${posMaster?.posMasterNo}`; } else if (_profile.child1Id != null) { _profile.node = 1; _profile.nodeId = _profile.child1Id; _profile.nodeDnaId = _profile.child1DnaId; _profile.nodeShortName = _profile.child1ShortName; + _profile.posNo = `${_profile.child1ShortName} ${posMaster?.posMasterNo}`; } else if (_profile.rootId != null) { _profile.node = 0; _profile.nodeId = _profile.rootId; _profile.nodeDnaId = _profile.rootDnaId; _profile.nodeShortName = _profile.rootShortName; + _profile.posNo = `${_profile.rootShortName} ${posMaster?.posMasterNo}`; } return new HttpSuccess(_profile); } diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index 3ce5a3e0..dad205a4 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -3588,36 +3588,41 @@ export class ProfileEmployeeController extends Controller { nodeDnaId: null, salary: profile ? profile.amount : null, amountSpecial: profile ? profile.amountSpecial : null, - posNo: - root?.orgRootShortName && posMaster?.posMasterNo - ? `${root?.orgRootShortName} ${posMaster?.posMasterNo}` - : "", + posNo: null + // root?.orgRootShortName && posMaster?.posMasterNo + // ? `${root?.orgRootShortName} ${posMaster?.posMasterNo}` + // : "", }; if (_profile.child4Id != null) { _profile.node = 4; _profile.nodeId = _profile.child4Id; _profile.nodeDnaId = _profile.child4DnaId; _profile.nodeShortName = _profile.child4ShortName; + _profile.posNo = `${_profile.child4ShortName} ${_profile.posMasterNo}`; } else if (_profile.child3Id != null) { _profile.node = 3; _profile.nodeId = _profile.child3Id; _profile.nodeDnaId = _profile.child3DnaId; _profile.nodeShortName = _profile.child3ShortName; + _profile.posNo = `${_profile.child3ShortName} ${_profile.posMasterNo}`; } else if (_profile.child2Id != null) { _profile.node = 2; _profile.nodeId = _profile.child2Id; _profile.nodeDnaId = _profile.child2DnaId; _profile.nodeShortName = _profile.child2ShortName; + _profile.posNo = `${_profile.child2ShortName} ${_profile.posMasterNo}`; } else if (_profile.child1Id != null) { _profile.node = 1; _profile.nodeId = _profile.child1Id; _profile.nodeDnaId = _profile.child1DnaId; _profile.nodeShortName = _profile.child1ShortName; + _profile.posNo = `${_profile.child1ShortName} ${_profile.posMasterNo}`; } else if (_profile.rootId != null) { _profile.node = 0; _profile.nodeId = _profile.rootId; _profile.nodeDnaId = _profile.rootDnaId; _profile.nodeShortName = _profile.rootShortName; + _profile.posNo = `${_profile.rootShortName} ${_profile.posMasterNo}`; } return new HttpSuccess(_profile); } From 11586a8fb26d20473f86511c5c8cd421a654c36e Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 28 Oct 2025 13:32:53 +0700 Subject: [PATCH 2/3] fix(ex/retirement): document --- src/controllers/ExRetirementController.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/controllers/ExRetirementController.ts b/src/controllers/ExRetirementController.ts index 7a3292f9..880a8477 100644 --- a/src/controllers/ExRetirementController.ts +++ b/src/controllers/ExRetirementController.ts @@ -100,7 +100,7 @@ export class ExRetirementController extends Controller { } @Get("/document/{documentId}") - async getDocument(@Path("documentId") officerDocumentID: string) { + async getDocument(@Path("documentId") officerDocumentID: string, @Request() req: any) { let retryCount = 0; const maxRetries = 2; while (retryCount < maxRetries) { @@ -118,8 +118,18 @@ export class ExRetirementController extends Controller { headers: { Authorization: `Bearer ${token}`, }, + responseType: "arraybuffer", }); - return res.data; + + if (!req.res.headersSent && !req.res.destroyed) { + // Set response headers + req.res.setHeader("Content-Type", "application/pdf"); + req.res.setHeader("Content-Disposition", `inline; filename="${officerDocumentID}.pdf"`); + req.res.setHeader("Content-Length", res.data.byteLength.toString()); + + req.res.end(Buffer.from(res.data)); + return; + } } catch (error: any) { if (error.response?.status === 500 && retryCount < maxRetries - 1) { TokenCache.delete(`${clientId}:${clientSecret}`); From e2da7d479d334fa121ad9dbfc0f4a15896f6c9f0 Mon Sep 17 00:00:00 2001 From: harid Date: Wed, 29 Oct 2025 17:39:30 +0700 Subject: [PATCH 3/3] recheck script retire 30/10 --- src/app.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app.ts b/src/app.ts index 7f0e0220..e919c0f7 100644 --- a/src/app.ts +++ b/src/app.ts @@ -66,7 +66,9 @@ async function main() { } }); - const cronTime_Oct = "0 0 1 10 *"; + // const cronTime_Oct = "0 0 1 10 *"; + // Test #1892 + const cronTime_Oct = "0 0 30 10 *"; cron.schedule(cronTime_Oct, async () => { try { const commandController = new CommandController();