Skip to content

[Customer Portal]{BE] Update case response - #317

Merged
Rashmika998 merged 1 commit into
wso2-open-operations:customer-portal-milestone-1from
Rashmika998:customer-portal-milestone-1-projects
Mar 10, 2026
Merged

Rashmika998 merged 1 commit into
wso2-open-operations:customer-portal-milestone-1from
Rashmika998:customer-portal-milestone-1-projects

Conversation

@Rashmika998

@Rashmika998 Rashmika998 commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Description

Updated the case response to include the associated product information.

Changes

  • Added product details to the case response payload.

Reason

Including product information in the case response allows clients to retrieve product-related data without requiring additional API calls.

Impact

  • Enhances the case response payload with product details.
  • Improves data availability for clients consuming the API.

Related PRs

Summary by CodeRabbit

  • New Features
    • Cases now include associated product information, enhancing case details and context for better management.

@Rashmika998 Rashmika998 self-assigned this Mar 9, 2026
@Rashmika998 Rashmika998 added the Type/Improvement Marks enhancements or improvements to existing features label Mar 9, 2026
@coderabbitai

coderabbitai Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR extends the Case data model across three backend modules by adding an optional product field of type ReferenceTableItem? or ReferenceItem? to the Case record. The change includes updates to utility functions to extract and map the product field during case searches and response transformations.

Changes

Cohort / File(s) Summary
Case Type Definitions
apps/customer-portal/backend/modules/entity/types.bal, apps/customer-portal/backend/modules/types/types.bal
Added optional product field to the public Case record in both modules, positioned after the assignedTeam field, extending the case data model to include product reference information.
Case Utility Mappings
apps/customer-portal/backend/utils.bal
Updated case extraction and mapping logic in searchCases and mapCaseResponse functions to extract the product field from case and response objects, and include it in the returned structures.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • cloby99
  • sacheeramesh

Poem

🐰 A product field hops into Case,
Making data structures embrace,
Reference items, neatly placed,
The case type is now graced,
With product info interlaced! 📦

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is incomplete and does not follow the required template structure. Critical sections are missing including Purpose (with issue links), Goals, Approach, User stories, Release note, Documentation, Training, Certification, Marketing, Automation tests, Security checks, Samples, Migrations, Test environment, and Learning. Fill out the complete PR description template with all required sections: Purpose with issue links, Goals, Approach, User stories, Release note, Documentation, Training, Certification, Marketing, Automation tests (unit and integration), Security checks, Samples, Migrations (if applicable), Test environment, and Learning. Provide specific details rather than generic descriptions.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title is partially related to the changeset, referring to a real aspect of the change (updating case response) but being overly broad and not highlighting the specific main change (adding product information).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/customer-portal/backend/modules/entity/types.bal`:
- Around line 321-322: The CaseResponse type currently inherits product as
optional from the shared Case record, which weakens the contract; update
CaseResponse so product is required by removing the optional marker and ensure
the other guaranteed fields (updatedOn, slaResponseTime, account, csManager) are
also non-optional on CaseResponse (either by making them non-optional in the
shared Case if appropriate or by explicitly redeclaring them non-optional on
CaseResponse) so the API contract matches the frontend expectations; if
list/search payloads omit these fields, model those payloads separately rather
than making CaseResponse fields optional.

In `@apps/customer-portal/backend/modules/types/types.bal`:
- Around line 91-92: The product field and other API-guaranteed fields were made
optional causing the public CaseResponse contract to break; update the
CaseResponse definition (the type named CaseResponse that embeds *Case) to make
product non-optional (change ReferenceItem? product to ReferenceItem product)
and likewise mark updatedOn, slaResponseTime, account, and csManager as
non-optional so the API contract is preserved; if you need an alternate
optional/search shape create a separate type for that instead of changing
CaseResponse.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 57582ebf-7cb9-40d8-bc9c-cfe3660e5960

📥 Commits

Reviewing files that changed from the base of the PR and between e067edd and 5d9b922.

📒 Files selected for processing (3)
  • apps/customer-portal/backend/modules/entity/types.bal
  • apps/customer-portal/backend/modules/types/types.bal
  • apps/customer-portal/backend/utils.bal

Comment thread apps/customer-portal/backend/modules/entity/types.bal
Comment thread apps/customer-portal/backend/modules/types/types.bal
@Rashmika998
Rashmika998 merged commit 6fc6660 into wso2-open-operations:customer-portal-milestone-1 Mar 10, 2026
1 check passed
@Rashmika998 Rashmika998 moved this from Done to Staging Deployed in Customer Portal Development Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

App/Customer Portal Area/Backend Type/Improvement Marks enhancements or improvements to existing features

Projects

Status: Staging Deployed

Development

Successfully merging this pull request may close these issues.

2 participants