From d948cc0915337a2bee326fd9c087302e0e29e9a4 Mon Sep 17 00:00:00 2001 From: KOPPIREDDY DURGA PRASAD <144464542+DurgaPrasad-54@users.noreply.github.com> Date: Mon, 19 Jan 2026 22:18:13 +0530 Subject: [PATCH 1/9] Add DeepWiki badge to README Added a badge for DeepWiki to the README. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index aadfef8..8378d6d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # AMRIT - Scheduler Service [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) +[![DeepWiki](https://img.shields.io/badge/DeepWiki-PSMRI%2FScheduler--API-blue)](https://deepwiki.com/PSMRI/Scheduler-API) It acts as an interface between client and the scheduling services provided, allowing users to interact for consultation with specialists. It also provides the info of availability and unavailability of specialists, retrieving available slots for specialists, booking and cancelling slots, and fetching day views of specialists for a particular specialization. From 6fb31b89afa103e220735910a63a39f4904010e3 Mon Sep 17 00:00:00 2001 From: DurgaPrasad-54 Date: Fri, 6 Feb 2026 08:16:56 +0530 Subject: [PATCH 2/9] chore(swagger): automate swagger sync to amrit-docs --- .github/workflows/swagger-json.yml | 100 +++++++++++++++++++++++++++++ pom.xml | 6 +- 2 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/swagger-json.yml diff --git a/.github/workflows/swagger-json.yml b/.github/workflows/swagger-json.yml new file mode 100644 index 0000000..c790e81 --- /dev/null +++ b/.github/workflows/swagger-json.yml @@ -0,0 +1,100 @@ +name: Sync Swagger to AMRIT-Docs + +on: + push: + branches: [ main ] + workflow_dispatch: + +jobs: + swagger-sync: + runs-on: ubuntu-latest + timeout-minutes: 20 + + steps: + - name: Checkout API repo (full history) + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Java 17 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + cache: maven + + - name: Build API (skip tests) + run: mvn -B clean package -DskipTests + + - name: Install jq + run: sudo apt-get update && sudo apt-get install -y jq + + - name: Run API in swagger profile + run: | + nohup mvn spring-boot:run \ + -Dspring-boot.run.profiles=swagger \ + -Dspring-boot.run.arguments=--server.port=9090 \ + > app.log 2>&1 & + echo $! > api_pid.txt + + - name: Wait for API & fetch Swagger + run: | + for i in {1..40}; do + CODE=$(curl --connect-timeout 2 --max-time 5 -s -o swagger_raw.json -w "%{http_code}" http://localhost:9090/v3/api-docs || true) + + if [ "$CODE" = "200" ]; then + jq . swagger_raw.json > scheduler-api.json || { + echo "Swagger JSON invalid" + cat swagger_raw.json + exit 1 + } + + if [ "$(jq '.paths | length' scheduler-api.json)" -eq 0 ]; then + echo "Swagger paths empty – failing" + exit 1 + fi + + echo "Swagger generated successfully" + exit 0 + fi + + echo "Waiting for API... ($i)" + sleep 4 + done + + echo "Swagger not generated" + cat app.log || true + exit 1 + + - name: Stop API + if: always() + run: | + if [ -f api_pid.txt ]; then + kill -9 $(cat api_pid.txt) || true + fi + + - name: Checkout AMRIT-Docs + uses: actions/checkout@v4 + with: + repository: PSMRI/AMRIT-Docs + token: ${{ secrets.DOCS_REPO_TOKEN }} + path: amrit-docs + fetch-depth: 0 + + - name: Copy Swagger JSON + run: | + mkdir -p amrit-docs/docs/swagger + cp scheduler-api.json amrit-docs/docs/swagger/scheduler-api.json + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.DOCS_REPO_TOKEN }} + path: amrit-docs + branch: auto/swagger-update-${{ github.run_id }}-${{ github.run_attempt }} + base: main + commit-message: "chore(docs): auto-update Scheduler-API swagger" + title: "chore(docs): auto-update Scheduler-API swagger" + body: | + This PR automatically updates Scheduler-API Swagger JSON + from the latest main branch build. diff --git a/pom.xml b/pom.xml index 050c2aa..798b545 100644 --- a/pom.xml +++ b/pom.xml @@ -251,7 +251,11 @@ 0.12.6 runtime - + + com.h2database + h2 + runtime + From 397123b0e476c2be9ad58e4b83f63ae3bd430cf0 Mon Sep 17 00:00:00 2001 From: DurgaPrasad-54 Date: Fri, 6 Feb 2026 08:17:06 +0530 Subject: [PATCH 3/9] chore(swagger): automate swagger sync to amrit-docs --- .../resources/application-swagger.properties | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/main/resources/application-swagger.properties diff --git a/src/main/resources/application-swagger.properties b/src/main/resources/application-swagger.properties new file mode 100644 index 0000000..63991c9 --- /dev/null +++ b/src/main/resources/application-swagger.properties @@ -0,0 +1,18 @@ +spring.datasource.url=jdbc:h2:mem:swaggerdb +spring.datasource.driver-class-name=org.h2.Driver +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect +spring.jpa.hibernate.ddl-auto=create-drop + +# Disable Redis if not needed for docs (optional) +spring.redis.host=${REDIS_HOST:localhost} +spring.redis.port=${REDIS_PORT:6379} + +# CORS for Swagger UI +cors.allowed-origins=${CORS_ALLOWED_ORIGINS:http://localhost:9090,http://localhost:8080} +# Logging +logging.level.root=INFO + +# Use environment variable for JWT secret +jwt.secret=${JWT_SECRET_KEY:defualt-key} +common-api-url-searchBeneficiary=http://localhost:8080/beneficiary/search +common-api-url-searchuserbyid=http://localhost:8080/user/searchbyid \ No newline at end of file From afcf543a0d20c04dbfe9c7b7d63115d1d2940071 Mon Sep 17 00:00:00 2001 From: DurgaPrasad-54 Date: Fri, 6 Feb 2026 08:27:29 +0530 Subject: [PATCH 4/9] chore(swagger): automate swagger sync to amrit-docs --- src/main/resources/application-swagger.properties | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/resources/application-swagger.properties b/src/main/resources/application-swagger.properties index 63991c9..f86617c 100644 --- a/src/main/resources/application-swagger.properties +++ b/src/main/resources/application-swagger.properties @@ -3,10 +3,6 @@ spring.datasource.driver-class-name=org.h2.Driver spring.jpa.database-platform=org.hibernate.dialect.H2Dialect spring.jpa.hibernate.ddl-auto=create-drop -# Disable Redis if not needed for docs (optional) -spring.redis.host=${REDIS_HOST:localhost} -spring.redis.port=${REDIS_PORT:6379} - # CORS for Swagger UI cors.allowed-origins=${CORS_ALLOWED_ORIGINS:http://localhost:9090,http://localhost:8080} # Logging From a50d679366366aeeac9a706581b83f972095bf13 Mon Sep 17 00:00:00 2001 From: DurgaPrasad-54 Date: Fri, 6 Feb 2026 08:30:43 +0530 Subject: [PATCH 5/9] chore(swagger): automate swagger sync to amrit-docs --- src/main/resources/application-swagger.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/application-swagger.properties b/src/main/resources/application-swagger.properties index f86617c..5734588 100644 --- a/src/main/resources/application-swagger.properties +++ b/src/main/resources/application-swagger.properties @@ -9,6 +9,6 @@ cors.allowed-origins=${CORS_ALLOWED_ORIGINS:http://localhost:9090,http://localho logging.level.root=INFO # Use environment variable for JWT secret -jwt.secret=${JWT_SECRET_KEY:defualt-key} +jwt.secret=${JWT_SECRET_KEY:#{T(java.util.UUID).randomUUID().toString()}} common-api-url-searchBeneficiary=http://localhost:8080/beneficiary/search common-api-url-searchuserbyid=http://localhost:8080/user/searchbyid \ No newline at end of file From d24ab1753450907a6eb915b47e74b111cdb751ac Mon Sep 17 00:00:00 2001 From: DurgaPrasad-54 Date: Tue, 10 Feb 2026 21:30:13 +0530 Subject: [PATCH 6/9] chore(swagger): update job kills process --- .github/workflows/swagger-json.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/swagger-json.yml b/.github/workflows/swagger-json.yml index c790e81..0b872a9 100644 --- a/.github/workflows/swagger-json.yml +++ b/.github/workflows/swagger-json.yml @@ -11,10 +11,8 @@ jobs: timeout-minutes: 20 steps: - - name: Checkout API repo (full history) + - name: Checkout API repo uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Set up Java 17 uses: actions/setup-java@v4 @@ -26,14 +24,12 @@ jobs: - name: Build API (skip tests) run: mvn -B clean package -DskipTests - - name: Install jq - run: sudo apt-get update && sudo apt-get install -y jq - name: Run API in swagger profile run: | - nohup mvn spring-boot:run \ - -Dspring-boot.run.profiles=swagger \ - -Dspring-boot.run.arguments=--server.port=9090 \ + nohup java -jar target/scheduler-api-*.war \ + --spring.profiles.active=swagger \ + --server.port=9090 \ > app.log 2>&1 & echo $! > api_pid.txt @@ -69,8 +65,15 @@ jobs: - name: Stop API if: always() run: | + # Graceful shutdown of the process group + sleep 5 + # Force kill the process group if still running if [ -f api_pid.txt ]; then - kill -9 $(cat api_pid.txt) || true + kill -TERM -- -$(cat api_pid.txt) || true + sleep 5 + kill -KILL -- -$(cat api_pid.txt) || true + pkill -P $(cat api_pid.txt) || true + fuser -k 9090/tcp || true fi - name: Checkout AMRIT-Docs From ce0a80461ce66ca22f433ecf6b2f3f4716713dd1 Mon Sep 17 00:00:00 2001 From: DurgaPrasad-54 Date: Tue, 10 Feb 2026 21:37:53 +0530 Subject: [PATCH 7/9] chore(swagger): add jq installation in swagger-json.yml --- .github/workflows/swagger-json.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/swagger-json.yml b/.github/workflows/swagger-json.yml index 0b872a9..fe2e57b 100644 --- a/.github/workflows/swagger-json.yml +++ b/.github/workflows/swagger-json.yml @@ -23,7 +23,9 @@ jobs: - name: Build API (skip tests) run: mvn -B clean package -DskipTests - + + - name: Install jq + run: sudo apt-get update && sudo apt-get install -y jq - name: Run API in swagger profile run: | From 4a66a412ec7161a8d7c5370010bca1805b06dd5d Mon Sep 17 00:00:00 2001 From: DurgaPrasad-54 Date: Tue, 10 Feb 2026 22:16:18 +0530 Subject: [PATCH 8/9] chore(swagger): add delete branch after merge --- .github/workflows/swagger-json.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/swagger-json.yml b/.github/workflows/swagger-json.yml index fe2e57b..2745a64 100644 --- a/.github/workflows/swagger-json.yml +++ b/.github/workflows/swagger-json.yml @@ -71,11 +71,13 @@ jobs: sleep 5 # Force kill the process group if still running if [ -f api_pid.txt ]; then - kill -TERM -- -$(cat api_pid.txt) || true - sleep 5 - kill -KILL -- -$(cat api_pid.txt) || true - pkill -P $(cat api_pid.txt) || true - fuser -k 9090/tcp || true + PID=$(cat api_pid.txt) + kill -TERM -- -"$PID" 2>/dev/null || true + sleep 2 + kill -9 -- -"$PID" 2>/dev/null || true + fi + # Fallback: kill any remaining java process on port 9090 + fuser -k 9090/tcp 2>/dev/null || true fi - name: Checkout AMRIT-Docs @@ -92,7 +94,7 @@ jobs: cp scheduler-api.json amrit-docs/docs/swagger/scheduler-api.json - name: Create Pull Request - uses: peter-evans/create-pull-request@v6 + uses: peter-evans/create-pull-request@v8 with: token: ${{ secrets.DOCS_REPO_TOKEN }} path: amrit-docs @@ -100,6 +102,7 @@ jobs: base: main commit-message: "chore(docs): auto-update Scheduler-API swagger" title: "chore(docs): auto-update Scheduler-API swagger" + delete-branch: true body: | This PR automatically updates Scheduler-API Swagger JSON from the latest main branch build. From 7d63d887e25b0ec1fb62b929a5f43f21b87cd5d9 Mon Sep 17 00:00:00 2001 From: DurgaPrasad-54 Date: Wed, 11 Feb 2026 07:36:43 +0530 Subject: [PATCH 9/9] chore(swagger): remove one fi from the swagger workflow --- .github/workflows/swagger-json.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/swagger-json.yml b/.github/workflows/swagger-json.yml index 2745a64..8e78077 100644 --- a/.github/workflows/swagger-json.yml +++ b/.github/workflows/swagger-json.yml @@ -78,7 +78,6 @@ jobs: fi # Fallback: kill any remaining java process on port 9090 fuser -k 9090/tcp 2>/dev/null || true - fi - name: Checkout AMRIT-Docs uses: actions/checkout@v4