Skip to content

[Customer Portal][BE] Add project type ID to the classify endpoint payload - #520

Merged
cloby99 merged 2 commits into
wso2-open-operations:dev-app-customer-portalfrom
Rashmika998:dev-app-customer-portal
Apr 20, 2026
Merged

cloby99 merged 2 commits into
wso2-open-operations:dev-app-customer-portalfrom
Rashmika998:dev-app-customer-portal

Conversation

@Rashmika998

@Rashmika998 Rashmika998 commented Apr 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR updates the cases/classify endpoint payload to include projectTypeId, enabling the agent to determine severity based on the project type.

Changes

  • Added projectTypeId field to cases/classify request payload
  • Updated request DTOs/records and validation logic
  • Adjusted agent integration to utilize project type for severity mapping
  • Updated service-layer mappings

Reason

Severity classification varies depending on the project type.
Previously, the agent did not have project context, which could lead to incorrect severity classification.

By including projectTypeId:

  • The agent can map severity accurately based on project type
  • Improves classification accuracy
  • Aligns with project-specific business rules

Impact

⚠ Payload updated (potential breaking change if field is required)

Consumers must include:

  • projectTypeId in the classify request payload

Testing

  • Verified classification works with different project types
  • Confirmed severity mapping changes based on projectTypeId
  • Tested validation for missing/invalid projectTypeId

Summary by CodeRabbit

  • New Features

    • Added project type ID requirement to case classification process.
  • Bug Fixes

    • Improved handling of nullable account fields by removing unnecessary default values.

@Rashmika998 Rashmika998 self-assigned this Apr 20, 2026
@coderabbitai

coderabbitai Bot commented Apr 20, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The pull request adds a required projectTypeId field to the CaseClassificationPayload type definition and updates the corresponding OpenAPI schema. Additionally, default values are removed from nullable string fields in the Account schema.

Changes

Cohort / File(s) Summary
AI Chat Agent Type Definition
apps/customer-portal/backend/modules/ai_chat_agent/types.bal
Added required projectTypeId string field to CaseClassificationPayload record type.
OpenAPI Schema
apps/customer-portal/backend/openapi.yaml
Updated CaseClassificationPayload schema to include new required projectTypeId field; removed default: "" constraints from nullable string fields domainList and classification in Account schema.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested labels

Type/Improvement, App/Customer Portal, Area/Backend

Suggested reviewers

  • shayanmalinda
  • sacheeramesh

Poem

🐰 A new field hops into sight,
projectTypeId shining bright,
Types and schemas now align,
From backend code to OpenAPI line,
Our AI chat agent's ready to mine! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The PR description covers purpose, goals, approach, and testing but omits many template sections like documentation, training, certification, marketing, security checks, and test environment details.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title accurately summarizes the main change: adding a projectTypeId field to the classify endpoint payload. It is concise, clear, and directly reflects the modifications shown in both the types.bal and openapi.yaml files.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@Rashmika998 Rashmika998 changed the title [Customer Portal][BE] Add project ID to the classify endpoint payload [Customer Portal][BE] Add project type ID to the classify endpoint payload Apr 20, 2026
@Rashmika998 Rashmika998 added Type/Improvement Marks enhancements or improvements to existing features App/Customer Portal Area/Backend labels Apr 20, 2026

@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: 1

🤖 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/ai_chat_agent/types.bal`:
- Around line 44-46: Add the missing projectTypeId to the frontend payload:
update the CaseClassificationRequest type to include projectTypeId: string, read
the value from useGetProjectDetails(projectId).data?.type?.id in
NoveraChatPage.tsx, and pass that value into the classifyCase(...) call where
the request object is constructed; ensure you handle the possible undefined case
(e.g., guard/early return or fallback) so classifyCase receives a valid string
for projectTypeId.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 869f8e31-d59d-4144-9226-2f0400414413

📥 Commits

Reviewing files that changed from the base of the PR and between a8e6da5 and 869a1ab.

📒 Files selected for processing (2)
  • apps/customer-portal/backend/modules/ai_chat_agent/types.bal
  • apps/customer-portal/backend/openapi.yaml

Comment thread apps/customer-portal/backend/modules/ai_chat_agent/types.bal
@cloby99
cloby99 merged commit 04074b6 into wso2-open-operations:dev-app-customer-portal Apr 20, 2026
1 check passed
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