From 6a4f032b0120470fddb673a7063fb01e090422a6 Mon Sep 17 00:00:00 2001 From: mamoss <> Date: Thu, 27 Mar 2025 01:05:38 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=A5=E0=B8=82=E0=B8=97=E0=B8=B5?= =?UTF-8?q?=E0=B9=88=E0=B8=95=E0=B8=B3=E0=B9=81=E0=B8=AB=E0=B8=99=E0=B9=88?= =?UTF-8?q?=E0=B8=87=20=E0=B8=A5=E0=B8=B9=E0=B8=81=E0=B8=88=E0=B9=89?= =?UTF-8?q?=E0=B8=B2=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yaml | 72 ++++++++-------- src/controllers/ProfileEmployeeController.ts | 87 +++++++++++++------- 2 files changed, 93 insertions(+), 66 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c4b02bcc..21dc9ba3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -67,40 +67,40 @@ jobs: docker compose pull docker compose up -d echo "${{ steps.gen_ver.outputs.image_ver }}"> success - - name: Notify Discord Success - if: success() - run: | - curl -H "Content-Type: application/json" \ - -X POST \ - -d '{ - "embeds": [{ - "title": "✅ Deployment Success!", - "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`", - "color": 3066993, - "footer": { - "text": "Release Notification", - "icon_url": "https://example.com/success-icon.png" - }, - "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'" - }] - }' \ - ${{ secrets.DISCORD_WEBHOOK }} + # - name: Notify Discord Success + # if: success() + # run: | + # curl -H "Content-Type: application/json" \ + # -X POST \ + # -d '{ + # "embeds": [{ + # "title": "✅ Deployment Success!", + # "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`", + # "color": 3066993, + # "footer": { + # "text": "Release Notification", + # "icon_url": "https://example.com/success-icon.png" + # }, + # "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'" + # }] + # }' \ + # ${{ secrets.DISCORD_WEBHOOK }} - - name: Notify Discord Failure - if: failure() - run: | - curl -H "Content-Type: application/json" \ - -X POST \ - -d '{ - "embeds": [{ - "title": "❌ Deployment Failed!", - "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`", - "color": 15158332, - "footer": { - "text": "Release Notification", - "icon_url": "https://example.com/failure-icon.png" - }, - "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'" - }] - }' \ - ${{ secrets.DISCORD_WEBHOOK }} + # - name: Notify Discord Failure + # if: failure() + # run: | + # curl -H "Content-Type: application/json" \ + # -X POST \ + # -d '{ + # "embeds": [{ + # "title": "❌ Deployment Failed!", + # "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`", + # "color": 15158332, + # "footer": { + # "text": "Release Notification", + # "icon_url": "https://example.com/failure-icon.png" + # }, + # "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'" + # }] + # }' \ + # ${{ secrets.DISCORD_WEBHOOK }} diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index 8f4b4954..14756f42 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -263,17 +263,18 @@ export class ProfileEmployeeController extends Controller { : null, position: Extension.ToThaiNumber( Extension.ToThaiNumber( - `${item.positionName != null ? item.positionName : "-"} ${item.positionType == null ? (item.positionCee??"") : (item.positionType == "อำนวยการ" || item.positionType == "บริหาร" ? item.positionType : "") + item.positionLevel}`, + `${item.positionName != null ? item.positionName : "-"} ${item.positionType == null ? item.positionCee ?? "" : (item.positionType == "อำนวยการ" || item.positionType == "บริหาร" ? item.positionType : "") + item.positionLevel}`, ), ), posNo: item.posNo != null ? Extension.ToThaiNumber(item.posNo) : "", - orgRoot: item.orgRoot != null ? Extension.ToThaiNumber( item.orgRoot) : "", - orgChild1: item.orgChild1 != null ? Extension.ToThaiNumber( item.orgChild1) : "", - orgChild2: item.orgChild2 != null ? Extension.ToThaiNumber( item.orgChild2) : "", - orgChild3: item.orgChild3 != null ? Extension.ToThaiNumber( item.orgChild3) : "", - orgChild4: item.orgChild4 != null ? Extension.ToThaiNumber( item.orgChild4) : "", - positionCee: item.positionCee != null ? Extension.ToThaiNumber( item.positionCee) : "", - positionExecutive: item.positionExecutive != null ? Extension.ToThaiNumber( item.positionExecutive) : "", + orgRoot: item.orgRoot != null ? Extension.ToThaiNumber(item.orgRoot) : "", + orgChild1: item.orgChild1 != null ? Extension.ToThaiNumber(item.orgChild1) : "", + orgChild2: item.orgChild2 != null ? Extension.ToThaiNumber(item.orgChild2) : "", + orgChild3: item.orgChild3 != null ? Extension.ToThaiNumber(item.orgChild3) : "", + orgChild4: item.orgChild4 != null ? Extension.ToThaiNumber(item.orgChild4) : "", + positionCee: item.positionCee != null ? Extension.ToThaiNumber(item.positionCee) : "", + positionExecutive: + item.positionExecutive != null ? Extension.ToThaiNumber(item.positionExecutive) : "", })) : [ { @@ -350,7 +351,7 @@ export class ProfileEmployeeController extends Controller { salary_raw.length > 0 && salary_raw[0].positionName != null ? Extension.ToThaiNumber( Extension.ToThaiNumber( - `${salary_raw[0].positionName != null ? salary_raw[0].positionName : "-"} ${salary_raw[0].positionType == null ? (salary_raw[0].positionCee??"") : (salary_raw[0].positionType == "อำนวยการ" || salary_raw[0].positionType == "บริหาร" ? salary_raw[0].positionType : "") + salary_raw[0].positionLevel}`, + `${salary_raw[0].positionName != null ? salary_raw[0].positionName : "-"} ${salary_raw[0].positionType == null ? salary_raw[0].positionCee ?? "" : (salary_raw[0].positionType == "อำนวยการ" || salary_raw[0].positionType == "บริหาร" ? salary_raw[0].positionType : "") + salary_raw[0].positionLevel}`, ), ) : "", @@ -2105,20 +2106,20 @@ export class ProfileEmployeeController extends Controller { .andWhere( new Brackets((qb) => { qb.where( - requestBody.keyword != null && requestBody.keyword != "" + requestBody.keyword != null && requestBody.keyword != "" ? `CONCAT(profileEmployee.prefix, profileEmployee.firstName," ",profileEmployee.lastName) LIKE :keyword` : "1=1", { keyword: `%${requestBody.keyword}%`, - }) - .orWhere( - requestBody.keyword != null && requestBody.keyword != "" - ? "profileEmployee.citizenId LIKE :keyword" - : "1=1", - { - keyword: `%${requestBody.keyword}%`, - }, - ); + }, + ).orWhere( + requestBody.keyword != null && requestBody.keyword != "" + ? "profileEmployee.citizenId LIKE :keyword" + : "1=1", + { + keyword: `%${requestBody.keyword}%`, + }, + ); }), ) .andWhere( @@ -2423,7 +2424,7 @@ export class ProfileEmployeeController extends Controller { }, }); - const _profile = { + const _profile: any = { profileId: profile.id, prefix: profile.prefix, rank: profile.rank, @@ -2482,6 +2483,32 @@ export class ProfileEmployeeController extends Controller { ? `${root?.orgRootShortName}${posMaster?.posMasterNo}` : "", }; + if (_profile.child4Id != null) { + _profile.node = 4; + _profile.nodeId = _profile.child4Id; + _profile.nodeDnaId = _profile.child4DnaId; + _profile.nodeShortName = _profile.child4ShortName; + } else if (_profile.child3Id != null) { + _profile.node = 3; + _profile.nodeId = _profile.child3Id; + _profile.nodeDnaId = _profile.child3DnaId; + _profile.nodeShortName = _profile.child3ShortName; + } else if (_profile.child2Id != null) { + _profile.node = 2; + _profile.nodeId = _profile.child2Id; + _profile.nodeDnaId = _profile.child2DnaId; + _profile.nodeShortName = _profile.child2ShortName; + } else if (_profile.child1Id != null) { + _profile.node = 1; + _profile.nodeId = _profile.child1Id; + _profile.nodeDnaId = _profile.child1DnaId; + _profile.nodeShortName = _profile.child1ShortName; + } else if (_profile.rootId != null) { + _profile.node = 0; + _profile.nodeId = _profile.rootId; + _profile.nodeDnaId = _profile.rootDnaId; + _profile.nodeShortName = _profile.rootShortName; + } return new HttpSuccess(_profile); } @@ -4099,7 +4126,7 @@ export class ProfileEmployeeController extends Controller { where: { id: id }, }); if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); - let _null:any = null; + let _null: any = null; profile.isLeave = requestBody.isLeave; profile.leaveReason = requestBody.leaveReason; profile.dateLeave = requestBody.dateLeave; @@ -4706,14 +4733,14 @@ export class ProfileEmployeeController extends Controller { throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบแบบร่างโครงสร้าง"); } - const permissionProflile = await this.permissionProflileRepository.findOne({ - relations : ["orgRootTree"], - where:{ + const permissionProflile = await this.permissionProflileRepository.findOne({ + relations: ["orgRootTree"], + where: { profileId: id, - orgRootTree:{ - orgRevisionId: orgRevisionPublish.id - } - } + orgRootTree: { + orgRevisionId: orgRevisionPublish.id, + }, + }, }); const posMaster = profile.current_holders == null || @@ -4825,8 +4852,8 @@ export class ProfileEmployeeController extends Controller { ? `${profile.profileEducations[0].degree ?? ""} ${profile.profileEducations[0].field ?? ""}` : "-", statusCheckEdit: profile.statusCheckEdit, - isEdit: permissionProflile?.isEdit??false, - isCheck: permissionProflile?.isCheck??false, + isEdit: permissionProflile?.isEdit ?? false, + isCheck: permissionProflile?.isCheck ?? false, }; if (_profile.child4Id != null) {