Skip to content

Conversation

@ravishanigarapu
Copy link
Contributor

@ravishanigarapu ravishanigarapu commented May 28, 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
    • Added support for specifying a user role when retrieving eligible call records with language information via the relevant endpoint.

@coderabbitai
Copy link

coderabbitai bot commented May 28, 2025

Walkthrough

The update adds a new path variable, role, to the REST endpoint for the getEligibleRecordsLanguageInfo method in the CallAllocationController. The method signature and its internal call to the service layer are both modified to accept and pass this new parameter.

Changes

File(s) Change Summary
src/main/java/com/iemr/ecd/controller/callallocation/CallAllocationController.java Added role as a path variable to the endpoint and method signature; updated internal method call to include role.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Controller as CallAllocationController
    participant Service as CallAllocationImpl

    Client->>Controller: GET /.../{psmId}/{phoneNoType}/{recordType}/{fDate}/{tDate}/{preferredLanguage}/{role}
    Controller->>Service: getEligibleRecordsLanguageInfo(psmId, phoneNoType, recordType, fDate, tDate, preferredLanguage, role)
    Service-->>Controller: ResponseEligibleCallRecordsDTO
    Controller-->>Client: ResponseEntity<ResponseEligibleCallRecordsDTO>
Loading

Possibly related PRs

Poem

A new path appears, a "role" to play,
In controller code, it finds its way.
Now records can filter, by job or by goal,
Hopping through endpoints, each with a role.
The API's smarter, with one more small hopβ€”
CodeRabbit’s paws never seem to stop! 🐾

✨ 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.

@sonarqubecloud
Copy link

@helenKaryamsetty helenKaryamsetty merged commit b2cfed5 into PSMRI:develop May 28, 2025
6 checks passed
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

πŸ”­ Outside diff range comments (1)
src/main/java/com/iemr/ecd/controller/callallocation/CallAllocationController.java (1)

156-156: πŸ› οΈ Refactor suggestion

Add parameter validation for the role parameter.

The new role parameter lacks validation, which could lead to security issues or unexpected behavior if invalid values are passed.

Consider adding validation to ensure only valid roles are accepted:

public ResponseEntity<ResponseEligibleCallRecordsDTO> getEligibleRecordsLanguageInfo(@PathVariable int psmId,
        @PathVariable String phoneNoType, @PathVariable String recordType, @PathVariable String fDate,
-       @PathVariable String tDate, @PathVariable String preferredLanguage,@PathVariable String role) throws ECDException {
+       @PathVariable String tDate, @PathVariable String preferredLanguage,
+       @PathVariable @Pattern(regexp = "^(ADMIN|SUPERVISOR|AGENT|USER)$", message = "Invalid role") String role) throws ECDException {

Also consider adding the necessary import for validation:

+import javax.validation.constraints.Pattern;
🧹 Nitpick comments (1)
src/main/java/com/iemr/ecd/controller/callallocation/CallAllocationController.java (1)

145-160: Consider URL design and security implications.

Including the role as a path parameter exposes it in URLs, logs, and browser history. Consider if this is the most appropriate approach for role-based access control.

Alternative approaches to consider:

  1. Use request headers: Pass role information in headers instead of URL path
  2. Extract from authentication context: Derive the role from the authenticated user's context
  3. Use request parameters: Pass role as a query parameter if it's optional

Example with header approach:

-@GetMapping(value = "/getEligibleRecordsLanguageInfo/{psmId}/{phoneNoType}/{recordType}/{fDate}/{tDate}/{preferredLanguage}/{role}", produces = MediaType.APPLICATION_JSON_VALUE)
+@GetMapping(value = "/getEligibleRecordsLanguageInfo/{psmId}/{phoneNoType}/{recordType}/{fDate}/{tDate}/{preferredLanguage}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<ResponseEligibleCallRecordsDTO> getEligibleRecordsLanguageInfo(@PathVariable int psmId,
        @PathVariable String phoneNoType, @PathVariable String recordType, @PathVariable String fDate,
-       @PathVariable String tDate, @PathVariable String preferredLanguage,@PathVariable String role) throws ECDException {
+       @PathVariable String tDate, @PathVariable String preferredLanguage,
+       @RequestHeader("X-User-Role") String role) throws ECDException {
πŸ“œ Review details

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

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between b574751 and bd187b2.

πŸ“’ Files selected for processing (1)
  • src/main/java/com/iemr/ecd/controller/callallocation/CallAllocationController.java (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (java)
πŸ”‡ Additional comments (2)
src/main/java/com/iemr/ecd/controller/callallocation/CallAllocationController.java (2)

145-145:

Details

❓ Verification inconclusive

Breaking change: Verify all existing clients are updated.

Adding the {role} path variable to the endpoint URL is a breaking change. Existing clients calling this endpoint will receive 404 errors until they update their API calls to include the role parameter.

Please run the following script to identify potential API consumers that need updating:


🏁 Script executed:

#!/bin/bash
# Description: Find references to the old endpoint pattern that need updating

# Search for the old endpoint pattern in the codebase
rg -A 3 -B 3 "getEligibleRecordsLanguageInfo.*psmId.*phoneNoType.*recordType.*fDate.*tDate.*preferredLanguage" --type java --type js --type ts

# Also search for any OpenAPI/Swagger documentation that might reference this endpoint
rg -A 5 -B 5 "getEligibleRecordsLanguageInfo" --type yaml --type json

Length of output: 2397


Breaking change alert: New role path parameter in getEligibleRecordsLanguageInfo

I didn’t find any internal calls or OpenAPI/Swagger docs referencing the old endpoint pattern, which means external clients will break until they include the new {role} segment. Please verify that:

  • All external consumers (web/mobile clients, integration tests, third-party integrations) are updated to call
    /getEligibleRecordsLanguageInfo/{psmId}/{phoneNoType}/{recordType}/{fDate}/{tDate}/{preferredLanguage}/{role}
  • API documentation (Swagger/OpenAPI definitions, Postman collections, README) is updated to reflect the added parameter
  • You’ve considered versioning this endpoint (or providing a fallback) if you need to maintain backward compatibility

158-158:

Details

βœ… Verification successful

Verify service layer method signature compatibility.

The service call passes the new role parameter, but we need to ensure the service layer method signature has been updated accordingly.

Run the following script to verify the service layer method signature:


🏁 Script executed:

#!/bin/bash
# Description: Verify the service layer method signature matches the controller call

# Search for the service method implementation
ast-grep --pattern 'getEligibleRecordsLanguageInfo($_, $_, $_, $_, $_, $_, $_) {
  $$$
}'

# Also search for the method declaration
rg -A 10 "getEligibleRecordsLanguageInfo.*psmId.*phoneNoType.*recordType.*fDate.*tDate.*preferredLanguage.*role" --type java

Length of output: 2957


🏁 Script executed:

#!/bin/bash
# Locate the service implementation class where CallAllocationImpl is defined
rg -n "class .*CallAllocationImpl" --type java

Length of output: 165


🏁 Script executed:

#!/bin/bash
# Verify the service implementation method signature
rg -n "getEligibleRecordsLanguageInfo" -A3 src/main/java/com/iemr/ecd/service/call_conf_allocation/CallAllocationImpl.java

Length of output: 416


Service method signature updated to include β€˜role’.

Verified in CallAllocationImpl (src/main/java/com/iemr/ecd/service/call_conf_allocation/CallAllocationImpl.java:1057–1059) that

public ResponseEligibleCallRecordsDTO getEligibleRecordsLanguageInfo(
    int psmId,
    String phoneNoType,
    String recordType,
    String fDate,
    String tDate,
    String preferredLanguage,
    String role
) { … }

matches the controller call. No further action required.

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