Skip to content

[Customer Portal][BE] Remove case checks and update case response - #202

Merged
sacheeramesh merged 1 commit into
wso2-open-operations:customer-portal-milestone-1from
Rashmika998:customer-portal-milestone-1-cases
Feb 19, 2026
Merged

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

Conversation

@Rashmika998

@Rashmika998 Rashmika998 commented Feb 19, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR removes the case validation/check logic from the stats endpoint and updates the case response structure.

Changes

Remove Case Check from Stats Endpoint

  • Removed case existence/validation logic from stats endpoint
  • Delegated case validation responsibility to ServiceNow (SN)
  • Simplified endpoint flow

Update Case Response

  • Updated case response model (fields adjusted as per latest changes)
  • Ensured consistent serialization

Reason

Stats Endpoint Simplification

Case validation is now handled by ServiceNow (SN). Keeping the check in this service resulted in redundant validation and unnecessary coupling.

Removing it:

  • Simplifies backend logic
  • Avoids duplicate validation
  • Aligns responsibility boundaries between services

Case Response Update

The case response structure has been updated to reflect the latest contract and functional requirements.

Testing

  • Verified stats endpoint works without local case validation
  • Confirmed correct behavior when SN handles case validation
  • Tested updated case response structure=

Related PRs

Summary by CodeRabbit

  • New Features

    • Case responses now include expanded closure metadata: closure timestamp, responsible agent information, closure notes, and automatic closure indicator for better case resolution visibility.
  • Refactor

    • Optimized request handling by streamlining case access validation, removing redundant checks from comment and attachment retrieval endpoints for improved performance.

@Rashmika998 Rashmika998 self-assigned this Feb 19, 2026
@Rashmika998 Rashmika998 added Type/Improvement Marks enhancements or improvements to existing features App/Customer Portal Area/Backend labels Feb 19, 2026
@coderabbitai

coderabbitai Bot commented Feb 19, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Extended the CaseResponse record type with closure metadata fields (closedOn, closedBy, closeNotes, hasAutoClosed), and removed per-request case access validation from the comments and attachments retrieval endpoints in the backend service.

Changes

Cohort / File(s) Summary
Closure Metadata Addition
apps/customer-portal/backend/modules/entity/types.bal
Added four optional fields to CaseResponse record: closedOn, closedBy, closeNotes, and hasAutoClosed to track case closure details and auto-closure indicator.
Access Validation Removal
apps/customer-portal/backend/service.bal
Removed per-request case access validation checks from comments and attachments retrieval endpoints, eliminating error handling branches for Unauthorized, Forbidden, and internal errors.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • shayanmalinda
  • cloby99

Poem

🐰 ears wiggling with delight
Cases close with metadata bright,
Auto-closure shining light,
Fewer checks along the way,
Streamlined code to save the day! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is missing most required sections from the repository template (Purpose/Goals, Approach, User stories, Release notes, Documentation, Training, Certification, Marketing, Tests, Security checks, Samples, Migrations, Test environment, and Learning). Provide a complete description following the repository template, including Purpose, Goals, Approach, User stories, Release notes, Documentation, Security checks, and Testing sections with details on code coverage and test cases.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: removing case checks and updating the case response, which aligns with both modifications in the changeset.
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 291-298: The frontend CaseDetails interface is missing the new
closure fields added to the backend CaseResponse; update the CaseDetails
interface in responses.ts to include closedOn: string | null, closedBy: string |
null (or the appropriate ReferenceTableItem-like object type if you have an
equivalent frontend type), closeNotes: string | null, and hasAutoClosed: boolean
| null so the model matches the API contract (ensure you update any places that
construct or read CaseDetails to handle nullable values).
- Around line 291-298: Update the frontend CaseDetails interface to include the
four new closure properties so the API response types align: add closedOn
(string|null), closedBy ({ id: string; name: string | null } | null), closeNotes
(string|null), and hasAutoClosed (boolean|null) to the CaseDetails interface;
ensure the property names exactly match the backend fields (closedOn, closedBy,
closeNotes, hasAutoClosed) and adjust any serializers or uses of CaseDetails
that assume these fields are absent or non-nullable.

Comment thread apps/customer-portal/backend/modules/entity/types.bal
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

None yet

Development

Successfully merging this pull request may close these issues.

2 participants