Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9f23f79
Fix the Build Error (#400)
vanitha1822 Apr 24, 2026
1c69049
fix: add missing property for swagge (#401)
vanitha1822 May 4, 2026
8251770
feat: add mobile to peersAtFacility and ashaList in facilityData logi…
vishwab1 May 19, 2026
b4b15be
Merge Releases 3.7.0 and 3.8.1 (#416)
vanitha1822 May 19, 2026
3437e74
fix: aam-2313 phone number leading with zero - removed zero (#418)
snehar-nd May 21, 2026
0da4823
fix: merge 3.6.2 to release 3.8.1 (#419)
vishwab1 May 21, 2026
ddadb3a
fix: merge with main
vanitha1822 May 22, 2026
b4ecdc5
Merge 3.8.1 to Main (#422)
vanitha1822 May 22, 2026
3e0bbb7
Sn/3.8.1 (#423)
snehar-nd May 22, 2026
cbb1817
fix: use stringRedisTemplate for jti: key read/delete in concurrent s…
vishwab1 May 22, 2026
8b548d3
fix: correct exempt roles and allow superadmin concurrent sessions
vishwab1 May 22, 2026
a8102b1
Merge pull request #424 from PSMRI/vb/fixSession
snehar-nd May 22, 2026
6a0b97d
Merge pull request #421 from PSMRI/nd/vs/merge_3.8.1
snehar-nd May 25, 2026
a6a6d3c
fix: delete camp:vanID and camp:parkingPlaceID from Redis on MMU logout
vishwab1 Jun 12, 2026
758bf36
feat: add endpoint to expose server's LAN IP address
vishwab1 Jun 16, 2026
be92d7c
fix: extented the token expiry timing
snehar-nd Jun 16, 2026
fc1deba
Merge pull request #428 from PSMRI/sn/tokenExpiry
snehar-nd Jun 16, 2026
716ef53
fix(BeneficiaryRegistrationController): added checks for null to prev…
FrankOHara43 Jun 17, 2026
d75e13c
chore(commitlint): add commit-msg hook and workflow validation (#368)
DurgaPrasad-54 Jun 17, 2026
3773e26
fix: build issue due to property name case mismatch (#430)
vanitha1822 Jun 22, 2026
73caab7
Merge remote-tracking branch 'origin/main' into vb/release-3.8.2
vishwab1 Jun 25, 2026
d08403f
Merge remote-tracking branch 'origin/release-3.8.1' into vb/release-3…
vishwab1 Jun 25, 2026
5a34772
Merge remote-tracking branch 'origin/release-3.8.2' into vb/release-3…
vishwab1 Jun 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .git-hooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
set -e

npx --yes @commitlint/cli@20.4.3 --edit "$1"
28 changes: 14 additions & 14 deletions .github/workflows/commit-lint.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
name: Commit Compliance
name: Commit Message Check

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
commitlint:
commit-check:
runs-on: ubuntu-latest

steps:
- name: Checkout code with submodule
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
submodules: true
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: '20'

- name: Install dependencies
run: npm ci --legacy-peer-deps

- name: Run commitlint on PR
- name: Validate commit messages
run: |
npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
set -eo pipefail
commits=$(git log --no-merges --pretty=format:"%H" "${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}")
for sha in $commits; do
tmp=$(mktemp)
git log -1 --pretty=format:"%B" "$sha" > "$tmp"
npx --yes @commitlint/cli@20.4.3 --edit "$tmp"
rm "$tmp"
done
2 changes: 0 additions & 2 deletions .husky/commit-msg

This file was deleted.

2 changes: 0 additions & 2 deletions .husky/pre-commit

This file was deleted.

98 changes: 98 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# CLAUDE.md - Common-API

## Project Overview

Common-API is the gateway microservice for the AMRIT healthcare platform. It provides shared APIs consumed by all frontend UIs including authentication, beneficiary registration, call handling, location masters, notifications, feedback, reporting, and integrations with external systems (c-Zentrix CTI, Everwell, eAusadha, eSanjeevani, ABDM, Firebase, Honeywell POCT devices).

## Tech Stack

- Java 17
- Spring Boot 3.2.2
- Spring Data JPA / Hibernate
- MySQL 8.0
- Redis (session management, caching)
- MongoDB (optional, for specific integrations)
- Maven (build tool)
- Swagger/OpenAPI (API documentation)
- Lombok, MapStruct
- CryptoJS-compatible AES encryption
- Firebase Admin SDK
- WAR packaging (deploys to Wildfly)

## Build and Run

```bash
# Build
mvn clean install -DENV_VAR=local

# Run locally (start Redis first)
mvn spring-boot:run -DENV_VAR=local

# Package WAR
mvn -B package --file pom.xml -P <profile> # profiles: dev, local, test, ci, uat

# Run tests
mvn test
```

### Configuration

- Copy `src/main/environment/common_example.properties` to `common_local.properties` and edit.
- Environment selected via `-DENV_VAR=<env>`.
- Swagger UI: `http://localhost:8083/swagger-ui.html`

## Package Structure

Base package: `com.iemr.common`

| Layer | Package | Description |
|-------|---------|-------------|
| Controllers | `controller.*` | REST endpoints (40+ sub-packages) |
| Services | `service.*` | Business logic |
| Repositories | `repository.*`, `repo.*` | JPA repositories |
| Entities | `data.*` | JPA entity classes |
| DTOs | `model.*` | Transfer objects |
| Mappers | `mapper.*` | Object mapping |
| Config | `config.*` | Swagger, encryption, Firebase, Quartz, prototypes |
| Constants | `constant` | Application constants |
| Utils | `utils.*` | Redis, HTTP, session, validation, exception |

## Key Functional Domains

- **Authentication/Authorization**: `controller.users` - login, session, user management
- **Beneficiary Registration**: `controller.beneficiary` - create, search, update beneficiaries
- **Call Handling**: `controller.callhandling` - CTI integration, call lifecycle
- **Feedback/Grievance**: `controller.feedback`, `controller.grievance` - feedback and complaint management
- **Location**: `controller.location` - state, district, block, village masters
- **Notifications**: `controller.notification` - alerts, SMS, email, Firebase push
- **Reporting**: `controller.report`, `controller.secondaryReport` - CRM reports
- **Helpline 104**: `controller.helpline104history` - medical advice history
- **COVID**: `controller.covid` - vaccination status
- **CTI Integration**: `controller.cti` - c-Zentrix computer telephony
- **External Integrations**: `controller.eausadha`, `controller.esanjeevani`, `controller.everwell`, `controller.honeywell`, `controller.brd`, `controller.carestream`
- **ABDM**: `controller.abdmfacility` - Ayushman Bharat Digital Mission
- **KM File Management**: `controller.kmfilemanager` - OpenKM document management
- **OTP/SMS**: `controller.otp`, `controller.sms` (via SMS gateway)
- **Scheduling**: `controller.questionconfig`, `controller.scheme`
- **Door-to-Door App**: `controller.door_to_door_app` - field worker support
- **NHM Dashboard**: `controller.nhmdashboard` - National Health Mission integration

## Architecture Notes

- Entry point: `CommonMain.java` (main class in `utils` package)
- Acts as the API gateway; all frontend UIs authenticate through Common-API
- Session management via Redis with 27-minute timeout
- HTTP interceptors attach `Authorization` and `ServerAuthorization` headers
- Status code `5002` signals session expiration to frontends
- AES + PBKDF2 encryption for password handling (`config.encryption`)
- Firebase integration for push notifications (`config.firebase`)
- Quartz scheduler for background jobs (`config.quartz`)
- Extensive test coverage with unit tests under `src/test/`

## CI/CD

- GitHub Actions: `package.yml`, `build-on-pull-request.yml`, `sast.yml`, `commit-lint.yml`, `codeql.yml`
- Conventional Commits enforced via Husky + commitlint
- Checkstyle configuration in `checkstyle.xml`
- JaCoCo for code coverage, SonarQube integration configured
- Dockerfile for containerized deployment
43 changes: 2 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,47 +35,8 @@ Prerequisites
Detailed information on API endpoints can be found in the [API Guide](https://piramal-swasthya.gitbook.io/amrit/architecture/api-guide).

## Setting Up Commit Hooks

This project uses Git hooks to enforce consistent code quality and commit message standards. Even though this is a Java project, the hooks are powered by Node.js. Follow these steps to set up the hooks locally:

### Prerequisites
- Node.js (v18 or later)
- npm (comes with Node.js)

### Setup Steps

1. **Install Node.js and npm**
- Download and install from [nodejs.org](https://nodejs.org/)
- Verify installation with:
```
node --version
npm --version
```
2. **Install dependencies**
- From the project root directory, run:
```
npm ci
```
- This will install all required dependencies including Husky and commitlint
3. **Verify hooks installation**
- The hooks should be automatically installed by Husky
- You can verify by checking if the `.husky` directory contains executable hooks
### Commit Message Convention
This project follows a specific commit message format:
- Format: `type(scope): subject`
- Example: `feat(login): add remember me functionality`
Types include:
- `feat`: A new feature
- `fix`: A bug fix
- `docs`: Documentation changes
- `style`: Code style changes (formatting, etc.)
- `refactor`: Code changes that neither fix bugs nor add features
- `perf`: Performance improvements
- `test`: Adding or fixing tests
- `build`: Changes to build process or tools
- `ci`: Changes to CI configuration
- `chore`: Other changes (e.g., maintenance tasks, dependencies)
Your commit messages will be automatically validated when you commit, ensuring project consistency.
Enable git hooks (run once after cloning):
- Run the command `git config core.hooksPath .git-hooks`.

## Usage
All features have been exposed as REST endpoints. Refer to the SWAGGER API specification for details.
Expand Down
3 changes: 1 addition & 2 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'body-leading-blank': [1, 'always'],
'body-max-line-length': [2, 'always', 100],
Expand Down Expand Up @@ -32,5 +31,5 @@ module.exports = {
'test',
],
],
}
},
};
Loading
Loading