Skip to content

[Customer Portal][BE] Enhance project search response with stats and hasAgent fields - #362

Merged
cloby99 merged 2 commits into
wso2-open-operations:customer-portal-milestone-1from
Rashmika998:customer-portal-milestone-1-projects
Mar 18, 2026
Merged

cloby99 merged 2 commits into
wso2-open-operations:customer-portal-milestone-1from
Rashmika998:customer-portal-milestone-1-projects

Conversation

@Rashmika998

@Rashmika998 Rashmika998 commented Mar 18, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR updates the project search response to include additional fields required for the landing page.

Changes

  • Extended project search response model to include:
    • stats → Project-related statistics
    • hasAgent → Indicates whether an agent is available for the project
  • Updated DTOs/records and mapping logic
  • Adjusted serialization to include new fields in the response

Reason

The landing page requires additional data to provide a richer project overview.
Including these fields enables:

  • Displaying project statistics directly in the search results
  • Indicating agent availability without additional API calls
  • Improving performance by reducing the need for multiple requests
  • Enhancing user experience with more contextual information

Testing

  • Verified project search response includes stats and hasAgent
  • Tested scenarios with and without agent availability
  • Confirmed correct mapping of stats data

Impact

  • Response structure extended (non-breaking addition)
  • No changes to request payload
  • Improves landing page data availability

Related PR

Summary by CodeRabbit

  • New Features

    • Projects now display enhanced information including agent availability status, active cases and chats count, and SLA status.
    • Conversation statistics expanded to include total and active conversation counts.
  • Chores

    • Removed unused internal dependencies to optimize the codebase.

@coderabbitai

coderabbitai Bot commented Mar 18, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR removes the url module dependency from Dependencies.toml and extends Project-related type definitions by adding four new fields (hasAgent, activeCasesCount, activeChatsCount, slaStatus) across entity and backend type modules. ProjectConversationStatsResponse gains totalCount and activeCount fields, and ProjectResponse is restructured with explicit fields. The mapProjectsResponse utility function is updated to propagate the new fields.

Changes

Cohort / File(s) Summary
Dependency Management
apps/customer-portal/backend/Dependencies.toml
Removed url module entry and its dependency from the ballerinacore dependency graph.
Type Definitions
apps/customer-portal/backend/modules/entity/types.bal, apps/customer-portal/backend/modules/types/types.bal
Added four new fields to Project type: hasAgent (boolean), activeCasesCount (int), activeChatsCount (int), slaStatus (string). Restructured ProjectResponse to use explicit field declarations instead of embedded Project reference. Extended ProjectConversationStatsResponse with totalCount and activeCount fields.
Utility Mapping
apps/customer-portal/backend/utils.bal
Updated mapProjectsResponse function to populate the four new Project fields in the returned response objects.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • #315: Adds and propagates the same hasAgent field alongside related project fields in ProjectResponse and mapProjectsResponse.
  • #300: Modifies the same Project and ProjectResponse type definitions and mapping logic in the backend.
  • #336: Updates project stats handling and active-count calculations in type definitions and utils mapping.

Suggested labels

Type/Improvement

Suggested reviewers

  • cloby99
  • shayanmalinda
  • sacheeramesh

Poem

🐰 Four new fields hop into view,
Projects dance with stats so true,
hasAgent, counts, and status glow,
Type definitions steal the show! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and concisely describes the main change: enhancing project search response with stats and hasAgent fields for the customer portal backend.
Description check ✅ Passed The PR description covers the required sections with sufficient detail: purpose, goals, approach, testing, and impact are clearly documented.
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
📝 Coding Plan
  • Generate coding plan for human review comments

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 requested a review from cloby99 March 18, 2026 11:25
@Rashmika998 Rashmika998 added the Type/Improvement Marks enhancements or improvements to existing features label Mar 18, 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/types/types.bal`:
- Line 275: Locate the comment line containing "# Novera agent enabled status
for the project" in modules/types/types.bal and correct the misspelling "Novera"
to the intended product/team name used elsewhere in the codebase (update the
comment above the agent-enabled field so it matches the canonical spelling).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 662ffef8-fdab-443f-b50a-2b9b219b1631

📥 Commits

Reviewing files that changed from the base of the PR and between 46443c7 and d07913f.

📒 Files selected for processing (4)
  • apps/customer-portal/backend/Dependencies.toml
  • apps/customer-portal/backend/modules/entity/types.bal
  • apps/customer-portal/backend/modules/types/types.bal
  • apps/customer-portal/backend/utils.bal
💤 Files with no reviewable changes (1)
  • apps/customer-portal/backend/Dependencies.toml

# Project type
ReferenceItem 'type;
json...;
# Novera agent enabled status for the project

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.

⚠️ Potential issue | 🟡 Minor

Fix typo in the field documentation.

Novera looks like a typo in the comment and should be corrected for API doc clarity.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/customer-portal/backend/modules/types/types.bal` at line 275, Locate the
comment line containing "# Novera agent enabled status for the project" in
modules/types/types.bal and correct the misspelling "Novera" to the intended
product/team name used elsewhere in the codebase (update the comment above the
agent-enabled field so it matches the canonical spelling).

@cloby99
cloby99 merged commit 4163b0c into wso2-open-operations:customer-portal-milestone-1 Mar 18, 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.

3 participants