From 263cae0c559921461c30d5bb5bda9c79084ba593 Mon Sep 17 00:00:00 2001 From: kittapath Date: Sat, 7 Dec 2024 09:31:49 +0700 Subject: [PATCH 1/3] test build discord --- .github/workflows/release.yaml | 61 ++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7c5469f..2f29d54 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,5 +1,5 @@ -name: release-test -run-name: release-test ${{ github.actor }} +name: release +run-name: release ${{ github.actor }} on: push: tags: @@ -9,11 +9,11 @@ env: REGISTRY: docker.frappet.com IMAGE_NAME: ehr/bma-ehr-development-service DEPLOY_HOST: frappet.com - # COMPOSE_PATH: /home/frappet/docker/bma-ehr COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-development + jobs: # act workflow_dispatch -W .github/workflows/release.yaml --input IMAGE_VER=test-v1 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd - release-test: + release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -67,22 +67,41 @@ jobs: docker compose pull docker compose up -d echo "${{ steps.gen_ver.outputs.image_ver }}"> success - - uses: snow-actions/line-notify@v1.1.0 + - name: Notify Discord Success if: success() - with: - access_token: ${{ secrets.TOKEN_LINE }} - message: | - -Success✅✅✅ - Image: ${{env.IMAGE_NAME}} - Version: ${{ steps.gen_ver.outputs.IMAGE_VER }} - By: ${{github.actor}} - - uses: snow-actions/line-notify@v1.1.0 - if: failure() - with: - access_token: ${{ secrets.TOKEN_LINE }} - message: | - -Failure❌❌❌ - Image: ${{env.IMAGE_NAME}} - Version: ${{ steps.gen_ver.outputs.IMAGE_VER }} - By: ${{github.actor}} + 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 }} From 0c646b7c6eda9bdb86f95fd337c93e8a9a317eb1 Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Wed, 11 Dec 2024 13:51:56 +0700 Subject: [PATCH 2/3] add status --- src/controllers/DevelopmentScholarshipController.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/controllers/DevelopmentScholarshipController.ts b/src/controllers/DevelopmentScholarshipController.ts index b095ba8..117dfb3 100644 --- a/src/controllers/DevelopmentScholarshipController.ts +++ b/src/controllers/DevelopmentScholarshipController.ts @@ -240,6 +240,7 @@ export class DevelopmentScholarshipController extends Controller { posType: item.posType ? item.posType.posTypeName : null, posLevel: item.posLevel ? item.posLevel.posLevelName : null, posExecutive: item.posExecutive, + status: item.status, })); return new HttpSuccess({ data: formattedData, total }); From 86a5cd7fb5f7649612aa0585062f1ed6bf32c126 Mon Sep 17 00:00:00 2001 From: kittapath Date: Sat, 14 Dec 2024 01:04:10 +0700 Subject: [PATCH 3/3] edit permission --- src/interfaces/permission.ts | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/src/interfaces/permission.ts b/src/interfaces/permission.ts index 407c08f..d462e4c 100644 --- a/src/interfaces/permission.ts +++ b/src/interfaces/permission.ts @@ -183,7 +183,7 @@ class CheckAuth { return false; }); } - public async checkOrg(token: any,keycloakId: string) { + public async checkOrg(token: any, keycloakId: string) { const redisClient = await this.redis.createClient({ host: process.env.REDIS_HOST, port: process.env.REDIS_PORT, @@ -193,37 +193,16 @@ class CheckAuth { if (reply != null) { reply = JSON.parse(reply); } else { - // await new CallAPI() - // .GetData( - // { - // headers: { authorization: token }, - // }, `/org/permission/checkOrg/${keycloakId}`,false) - // .then((x) => { - // console.log("[In Then]"); - // console.log("[res]",x); - // let data: any = { - // orgRootId: x.orgRootId, - // orgChild1Id: x.orgChild1Id, - // orgChild2Id: x.orgChild2Id, - // orgChild3Id: x.orgChild3Id, - // orgChild4Id: x.orgChild4Id, - // }; - // console.log("[data]",data); - // return data; - // }, - // ) - // .catch((error) => { - // console.error("Error calling API:", error); - // }); + if (!keycloakId) throw "Error calling API No KeycloakId"; try { const x = await new CallAPI().GetData( { headers: { authorization: token }, - }, - `/org/permission/checkOrg/${keycloakId}`, - false + }, + `/org/permission/checkOrg/${keycloakId}`, + false, ); - + const data = { orgRootId: x.orgRootId, orgChild1Id: x.orgChild1Id, @@ -231,7 +210,7 @@ class CheckAuth { orgChild3Id: x.orgChild3Id, orgChild4Id: x.orgChild4Id, }; - + return data; } catch (error) { console.error("Error calling API:", error);