Skip to content

Conversation

@SauravBizbRolly
Copy link
Contributor

@SauravBizbRolly SauravBizbRolly commented Jul 7, 2025

πŸ“‹ Description

JIRA ID:

Please provide a summary of the change and the motivation behind it. Include relevant context and details.


βœ… Type of Change

  • 🐞 Bug fix (non-breaking change which resolves an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • πŸ”₯ Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • πŸ›  Refactor (change that is neither a fix nor a new feature)
  • βš™οΈ Config change (configuration file or build script updates)
  • πŸ“š Documentation (updates to docs or readme)
  • πŸ§ͺ Tests (adding new or updating existing tests)
  • 🎨 UI/UX (changes that affect the user interface)
  • πŸš€ Performance (improves performance)
  • 🧹 Chore (miscellaneous changes that don't modify src or test files)

ℹ️ Additional Information

Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.

Summary by CodeRabbit

  • New Features

    • Introduced beneficiary consent management with OTP-based consent workflows, including endpoints to send, validate, and resend OTPs.
    • Added dynamic form management with modules and form types, supporting creation and association of form fields.
    • Integrated Firebase Cloud Messaging for sending notifications and managing user tokens, with new endpoints for notification delivery and token updates.
    • Added support for storing and managing user tokens in the database.
  • Configuration

    • Added extensive new configuration options for external integrations (Firebase, SMS, Email, Identity, CTI, etc.) and scheduler tasks.
    • New Firebase settings added to configuration files for enabling and credential management.
  • Improvements

    • Enhanced logging and error handling in beneficiary identity and OTP flows.
    • Added consent status tracking to beneficiary and identity data models.
  • Bug Fixes

    • Improved JWT token validation and user ID extraction logic.
  • Chores

    • Updated project dependencies to include Firebase Admin SDK.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 7, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update introduces Firebase Cloud Messaging integration, dynamic form management, and beneficiary consent OTP handling. It adds new configuration properties, controller classes, DTOs, entities, repositories, and services for these features. The JWT utility is refactored, and new endpoints for notification and form management are provided. Minor logging and configuration improvements are also included.

Changes

File(s) / Group Change Summary
pom.xml Added Firebase Admin SDK dependency.
src/main/environment/common_ci.properties, src/main/environment/common_docker.properties, application.properties Added Firebase and various other configuration properties.
src/main/java/com/iemr/common/CommonApplication.java Added Firebase-related imports.
src/main/java/com/iemr/common/config/firebase/FirebaseMessagingConfig.java New config class to initialize FirebaseMessaging bean using provided credentials and enable flag.
src/main/java/com/iemr/common/controller/beneficiaryConsent/BeneficiaryConsentController.java New REST controller for beneficiary consent OTP: send, validate, and resend endpoints.
src/main/java/com/iemr/common/controller/dynamicForm/DynamicFormController.java New controller for dynamic form and module creation endpoints.
src/main/java/com/iemr/common/controller/firebaseNotification/FirebaseNotificationController.java New controller for sending notifications, updating, and retrieving user tokens via Firebase.
src/main/java/com/iemr/common/controller/otp/OTPGateway.java Enhanced logging; changed OTP success check to substring match.
src/main/java/com/iemr/common/controller/users/IEMRAdminController.java Updated JWT user ID extraction method.
src/main/java/com/iemr/common/data/beneficiaryConsent/BeneficiaryConsentRequest.java New DTO for beneficiary consent requests (mobNo, otp, userName, designation).
src/main/java/com/iemr/common/data/dynamic_from/FormEntity.java, src/main/java/com/iemr/common/data/dynamic_from/ModuleEntity.java New JPA entities for dynamic forms and modules.
src/main/java/com/iemr/common/data/userToken/UserTokenData.java New entity for storing user tokens.
src/main/java/com/iemr/common/dto/dynamicForm/FormFieldDTO.java, src/main/java/com/iemr/common/dto/dynamicForm/FormTypeEntityDTO.java, src/main/java/com/iemr/common/dto/dynamicForm/ModuleEntityDTO.java New DTOs for dynamic form and module data transfer.
src/main/java/com/iemr/common/dto/identity/CommonIdentityDTO.java, src/main/java/com/iemr/common/model/beneficiary/BeneficiaryModel.java Added isConsent field to DTO and model.
src/main/java/com/iemr/common/model/notification/NotificationMessage.java, src/main/java/com/iemr/common/model/notification/UserToken.java New models for notification message and user token.
src/main/java/com/iemr/common/repo/userToken/UserTokenRepo.java New JPA repository for user tokens.
src/main/java/com/iemr/common/repository/dynamic_form/FormTypeRepository.java, src/main/java/com/iemr/common/repository/dynamic_form/ModuleRepository.java New repositories for form and module entities.
src/main/java/com/iemr/common/service/beneficiary/IdentityBeneficiaryServiceImpl.java Improved error handling, logging, and configuration property injection.
src/main/java/com/iemr/common/service/beneficiary/RegisterBenificiaryServiceImpl.java Logging and isConsent field assignment adjustments.
src/main/java/com/iemr/common/service/beneficiaryOTPHandler/BeneficiaryOTPHandler.java, src/main/java/com/iemr/common/service/beneficiaryOTPHandler/BeneficiaryOTPHandlerImpl.java New interface and implementation for OTP handling (send, validate, resend).
src/main/java/com/iemr/common/service/dynamicForm/FormTypeService.java, src/main/java/com/iemr/common/service/dynamicForm/ModuleService.java New services for form type and module management.
src/main/java/com/iemr/common/service/firebaseNotification/FirebaseNotificationService.java New service for sending notifications and managing user tokens via Firebase.
src/main/java/com/iemr/common/service/notification/NotificationService.java, src/main/java/com/iemr/common/utils/JwtUserIdValidationFilter.java Minor whitespace additions.
src/main/java/com/iemr/common/utils/JwtUtil.java Refactored: removed denylist check, simplified validation, added extractUserId method.

Sequence Diagram(s)

Beneficiary Consent OTP Flow

sequenceDiagram
    participant Client
    participant BeneficiaryConsentController
    participant BeneficiaryOTPHandlerImpl
    participant ExternalSMSService

    Client->>BeneficiaryConsentController: POST /beneficiaryConsent/sendConsent (mobNo)
    BeneficiaryConsentController->>BeneficiaryOTPHandlerImpl: sendOTP(request)
    BeneficiaryOTPHandlerImpl->>BeneficiaryOTPHandlerImpl: generateOTP()
    BeneficiaryOTPHandlerImpl->>ExternalSMSService: sendSMS(otp, mobNo)
    ExternalSMSService-->>BeneficiaryOTPHandlerImpl: SMS sent response
    BeneficiaryOTPHandlerImpl-->>BeneficiaryConsentController: Success/Failure
    BeneficiaryConsentController-->>Client: OutputResponse (success/error)
Loading

Firebase Notification Flow

sequenceDiagram
    participant Client
    participant FirebaseNotificationController
    participant FirebaseNotificationService
    participant FirebaseMessaging

    Client->>FirebaseNotificationController: POST /firebaseNotification/sendNotification (NotificationMessage)
    FirebaseNotificationController->>FirebaseNotificationService: sendNotification(notificationMessage)
    FirebaseNotificationService->>FirebaseMessaging: send(message)
    FirebaseMessaging-->>FirebaseNotificationService: response
    FirebaseNotificationService-->>FirebaseNotificationController: response string
    FirebaseNotificationController-->>Client: response
Loading

Possibly related PRs

  • PSMRI/Common-API#246: Adds Firebase Admin SDK, configuration properties, and notification components, matching the Firebase integration changes.
  • PSMRI/Common-API#183: Introduces Firebase Admin SDK, FirebaseMessagingConfig, and notification controller/service, directly related to Firebase setup.
  • PSMRI/Common-API#227: Adds Firebase Admin SDK, configuration, and notification classes, overlapping with the Firebase integration components.

Suggested labels

enhancement

Suggested reviewers

  • ravishanigarapu
  • drtechie

Poem

A rabbit hopped through fields of code,
Bringing Firebase to lighten the load.
OTPs now leap with ease,
Dynamic forms dance in the breeze.
Notifications fly,
On clouds up highβ€”
All thanks to this code, oh my! πŸ‡βœ¨


πŸ“œ Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 46195c5 and 6c0a72f.

πŸ“’ Files selected for processing (35)
  • pom.xml (1 hunks)
  • src/main/environment/common_ci.properties (1 hunks)
  • src/main/environment/common_docker.properties (1 hunks)
  • src/main/java/com/iemr/common/CommonApplication.java (3 hunks)
  • src/main/java/com/iemr/common/config/firebase/FirebaseMessagingConfig.java (1 hunks)
  • src/main/java/com/iemr/common/controller/beneficiaryConsent/BeneficiaryConsentController.java (1 hunks)
  • src/main/java/com/iemr/common/controller/dynamicForm/DynamicFormController.java (1 hunks)
  • src/main/java/com/iemr/common/controller/firebaseNotification/FirebaseNotificationController.java (1 hunks)
  • src/main/java/com/iemr/common/controller/otp/OTPGateway.java (2 hunks)
  • src/main/java/com/iemr/common/controller/users/IEMRAdminController.java (1 hunks)
  • src/main/java/com/iemr/common/data/beneficiaryConsent/BeneficiaryConsentRequest.java (1 hunks)
  • src/main/java/com/iemr/common/data/dynamic_from/FormEntity.java (1 hunks)
  • src/main/java/com/iemr/common/data/dynamic_from/ModuleEntity.java (1 hunks)
  • src/main/java/com/iemr/common/data/userToken/UserTokenData.java (1 hunks)
  • src/main/java/com/iemr/common/dto/dynamicForm/FormFieldDTO.java (1 hunks)
  • src/main/java/com/iemr/common/dto/dynamicForm/FormTypeEntityDTO.java (1 hunks)
  • src/main/java/com/iemr/common/dto/dynamicForm/ModuleEntityDTO.java (1 hunks)
  • src/main/java/com/iemr/common/dto/identity/CommonIdentityDTO.java (1 hunks)
  • src/main/java/com/iemr/common/model/beneficiary/BeneficiaryModel.java (2 hunks)
  • src/main/java/com/iemr/common/model/notification/NotificationMessage.java (1 hunks)
  • src/main/java/com/iemr/common/model/notification/UserToken.java (1 hunks)
  • src/main/java/com/iemr/common/repo/userToken/UserTokenRepo.java (1 hunks)
  • src/main/java/com/iemr/common/repository/dynamic_form/FormTypeRepository.java (1 hunks)
  • src/main/java/com/iemr/common/repository/dynamic_form/ModuleRepository.java (1 hunks)
  • src/main/java/com/iemr/common/service/beneficiary/IdentityBeneficiaryServiceImpl.java (4 hunks)
  • src/main/java/com/iemr/common/service/beneficiary/RegisterBenificiaryServiceImpl.java (2 hunks)
  • src/main/java/com/iemr/common/service/beneficiaryOTPHandler/BeneficiaryOTPHandler.java (1 hunks)
  • src/main/java/com/iemr/common/service/beneficiaryOTPHandler/BeneficiaryOTPHandlerImpl.java (1 hunks)
  • src/main/java/com/iemr/common/service/dynamicForm/FormTypeService.java (1 hunks)
  • src/main/java/com/iemr/common/service/dynamicForm/ModuleService.java (1 hunks)
  • src/main/java/com/iemr/common/service/firebaseNotification/FirebaseNotificationService.java (1 hunks)
  • src/main/java/com/iemr/common/service/notification/NotificationService.java (1 hunks)
  • src/main/java/com/iemr/common/utils/JwtUserIdValidationFilter.java (1 hunks)
  • src/main/java/com/iemr/common/utils/JwtUtil.java (1 hunks)
  • src/main/resources/application.properties (1 hunks)
✨ Finishing Touches
  • πŸ“ Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share
πŸͺ§ Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@SauravBizbRolly SauravBizbRolly changed the base branch from develop to 3.3.0 July 7, 2025 07:41
@SauravBizbRolly SauravBizbRolly merged commit c054fa8 into PSMRI:3.3.0 Jul 7, 2025
4 checks passed
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 7, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
E Security Rating on New Code (required β‰₯ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

# DB Connections
spring.datasource.url=jdbc:mysql://localhost:3306/db_iemr
spring.datasource.username=<Enter password>
spring.datasource.password=YesBank@123#

Check failure

Code scanning / SonarCloud

Database passwords should not be disclosed High

Make sure this database password gets changed and removed from the code. See more on SonarQube Cloud
# DB Connections
spring.datasource.url=jdbc:mysql://localhost:3306/db_iemr
spring.datasource.username=<Enter password>
spring.datasource.password=YesBank@123#

Check failure

Code scanning / SonarCloud

Credentials should not be hard-coded High

Revoke and change this password, as it is compromised. See more on SonarQube Cloud
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

secondary.datasource.username=<Enter username>
secondary.datasource.password=<Enter password>

Check failure

Code scanning / SonarCloud

Database passwords should not be disclosed High

Make sure this database password gets changed and removed from the code. See more on SonarQube Cloud
@coderabbitai coderabbitai bot mentioned this pull request Aug 28, 2025
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant