Skip to content

Conversation

SauravBizbRolly
Copy link

@SauravBizbRolly SauravBizbRolly commented Jun 23, 2025

πŸ“‹ Description

JIRA ID:

Fix firebasebase64

βœ… 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 via new endpoints for sending, validating, and resending OTPs.
    • Added Firebase Cloud Messaging integration, including endpoints for sending notifications and managing user tokens.
    • Added new data models for beneficiary consent requests, notification messages, and user tokens.
    • Enabled configuration options for Firebase integration in environment files.
  • Bug Fixes

    • Improved OTP success detection logic for beneficiary consent flows.
  • Refactor

    • Refactored JWT utility methods and removed unused token denylist logic.
  • Chores

    • Added Firebase Admin SDK as a new dependency.
    • Enhanced logging and minor code cleanups.

vanitha1822 and others added 5 commits June 19, 2025 19:53
* Add the functionality for video call consultation service

* Add the necessary imports for the application

* Update video call service with DB changes

* Add update api for call status updation

* Add service class to prepare the sms template and include benregid

* update the properties in common_example file

* Fix the issue in date time conversion

* Add the link generated time and islinkused flag for the meeting link

* Change the consultation date format and response format for send link api

* Add the video call url properties in environment files

* Add recording functionality

* Remove dev and test properties as it not in develop

* feat:fix the alignment

* feat:remove cross origins and add variable name for ci file

* Add the properties in docker file

* Add recording properties in properties file

* fix:coderabbit comments
Copy link
Contributor

coderabbitai bot commented Jun 23, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update introduces Firebase Cloud Messaging integration by adding the Firebase Admin SDK, related configuration classes, and REST controllers for notification and OTP consent workflows. It also adds new data models and repositories for user tokens, updates DTOs and models with consent fields, and refactors JWT utility logic to simplify token validation.

Changes

File(s) Change Summary
pom.xml Added Firebase Admin SDK dependency.
src/main/environment/common_ci.properties, src/main/environment/common_docker.properties Added Firebase configuration properties for enabling and credential file path.
src/main/java/com/iemr/common/CommonApplication.java Added imports for Firebase services (preparatory, no logic change).
src/main/java/com/iemr/common/config/firebase/FirebaseMessagingConfig.java New configuration class for initializing FirebaseMessaging bean using properties.
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/firebaseNotification/FirebaseNotificationController.java New REST controller for sending notifications, updating, and retrieving user tokens.
src/main/java/com/iemr/common/controller/otp/OTPGateway.java Enhanced logging and changed OTP success check to substring match.
src/main/java/com/iemr/common/controller/users/IEMRAdminController.java Changed JWT user ID extraction method.
src/main/java/com/iemr/common/data/beneficiaryConsent/BeneficiaryConsentRequest.java New data class for beneficiary consent request details.
src/main/java/com/iemr/common/data/userToken/UserTokenData.java New JPA entity for user token storage.
src/main/java/com/iemr/common/dto/identity/CommonIdentityDTO.java, src/main/java/com/iemr/common/model/beneficiary/BeneficiaryModel.java Added isConsent Boolean field (default false).
src/main/java/com/iemr/common/model/notification/NotificationMessage.java, src/main/java/com/iemr/common/model/notification/UserToken.java New data classes for notification message and user token.
src/main/java/com/iemr/common/repo/userToken/UserTokenRepo.java New JPA repository interface for user tokens.
src/main/java/com/iemr/common/service/beneficiary/RegisterBenificiaryServiceImpl.java Logging added and redundant setting of isConsent field.
src/main/java/com/iemr/common/service/beneficiaryOTPHandler/BeneficiaryOTPHandler.java, src/main/java/com/iemr/common/service/beneficiaryOTPHandler/BeneficiaryOTPHandlerImpl.java New OTP handler service interface and implementation for beneficiary consent.
src/main/java/com/iemr/common/service/firebaseNotification/FirebaseNotificationService.java New service for sending notifications and managing user tokens with Firebase.
src/main/java/com/iemr/common/service/notification/NotificationService.java Added blank line (no logic change).
src/main/java/com/iemr/common/utils/JwtUserIdValidationFilter.java Added blank line (no logic change).
src/main/java/com/iemr/common/utils/JwtUtil.java Refactored: removed denylist logic, simplified token validation, changed user ID extraction.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant BeneficiaryConsentController
    participant BeneficiaryOTPHandlerImpl
    participant SMSGateway

    Client->>BeneficiaryConsentController: POST /sendConsent (mobile number)
    BeneficiaryConsentController->>BeneficiaryOTPHandlerImpl: sendOTP(request)
    BeneficiaryOTPHandlerImpl->>SMSGateway: sendSMS(OTP, user details)
    SMSGateway-->>BeneficiaryOTPHandlerImpl: SMS send response
    BeneficiaryOTPHandlerImpl-->>BeneficiaryConsentController: OTP send result
    BeneficiaryConsentController-->>Client: OutputResponse (success/error)
Loading
sequenceDiagram
    participant Client
    participant FirebaseNotificationController
    participant FirebaseNotificationService
    participant FirebaseMessaging (Firebase SDK)

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

Possibly related PRs

  • PSMRI/Common-API#227: Adds Firebase Admin SDK, configuration, and integration setupβ€”directly related to this PR's Firebase features.
  • PSMRI/Common-API#211: Modifies token denylist logic in JwtUtil, which this PR removes, making them code-level opposites.
  • PSMRI/Common-API#183: Introduces the same Firebase Admin SDK, configuration, and notification controller/service as this PR.

Suggested labels

enhancement

Suggested reviewers

  • drtechie

Poem

Hopping through code with Firebase in tow,
Notifications and OTPs now swiftly flow.
Tokens are managed, consent is tracked,
With beans and controllers, all neatly packed.
The garden of features is growing anewβ€”
A bunny’s delight in what teamwork can do!
πŸ‡βœ¨


πŸ“œ 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 15ecbb5 and 9ff4061.

πŸ“’ Files selected for processing (23)
  • 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/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/userToken/UserTokenData.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/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/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)
✨ 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.

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
4.4% Duplication on New Code (required ≀ 3%)
B 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

@SauravBizbRolly SauravBizbRolly changed the base branch from develop to 3.3.0 June 23, 2025 13:12
@Operation(summary = "Resend Consent")
@RequestMapping(value = "/resendConsent", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON, headers = "Authorization")
public String resendConsent(@Param(value = "{\"mobNo\":\"String\"}") @RequestBody String requestOBJ) {
logger.info(requestOBJ.toString());

Check notice

Code scanning / SonarCloud

Logging should not be vulnerable to injection attacks Low

Change this code to not log user-controlled data. See more on SonarQube Cloud
@Operation(summary = "Send OTP")
@RequestMapping(value = "/sendOTP", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON, headers = "Authorization")
public String sendOTP(@Param(value = "{\"mobNo\":\"String\"}") @RequestBody String requestOBJ) {
logger.info(requestOBJ.toString());

Check notice

Code scanning / SonarCloud

Logging should not be vulnerable to injection attacks Low

Change this code to not log user-controlled data. See more on SonarQube Cloud
@Operation(summary = "Resend OTP")
@RequestMapping(value = "/resendOTP", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON, headers = "Authorization")
public String resendOTP(@Param(value = "{\"mobNo\":\"String\"}") @RequestBody String requestOBJ) {
logger.info(requestOBJ.toString());

Check notice

Code scanning / SonarCloud

Logging should not be vulnerable to injection attacks Low

Change this code to not log user-controlled data. See more on SonarQube Cloud
@SauravBizbRolly SauravBizbRolly merged commit a5394df into PSMRI:3.3.0 Jun 23, 2025
5 of 6 checks passed
This was referenced Jul 3, 2025
Merged
@coderabbitai coderabbitai bot mentioned this pull request Sep 3, 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.

2 participants