Repository navigation
[Customer Portal Backend] Add productCount to deployments search response - #1040
Conversation
📝 WalkthroughWalkthroughThis PR adds an optional ChangesDeployment product count
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/customer-portal/backend/utils.bal (1)
325-341: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winUse optional field access for
deployedProductCount.deployment.deployedProductCountcan panic when the entity service omits the field; switch todeployment?.deployedProductCountsoproductCountstays empty instead of failing the mapping.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/customer-portal/backend/utils.bal` around lines 325 - 341, The mapDeployments transformation currently reads deployment.deployedProductCount directly, which can panic when the field is omitted. Update the Deployment mapping in mapDeployments to use optional field access for deployedProductCount so productCount becomes empty instead of failing, while keeping the rest of the response mapping unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@apps/customer-portal/backend/utils.bal`:
- Around line 325-341: The mapDeployments transformation currently reads
deployment.deployedProductCount directly, which can panic when the field is
omitted. Update the Deployment mapping in mapDeployments to use optional field
access for deployedProductCount so productCount becomes empty instead of
failing, while keeping the rest of the response mapping unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 2a74c629-81ef-4a1c-bf3d-0ec8451cb19c
📒 Files selected for processing (4)
apps/customer-portal/backend/modules/entity/types.balapps/customer-portal/backend/modules/types/types.balapps/customer-portal/backend/openapi.yamlapps/customer-portal/backend/utils.bal
Summary
productCountfield to theDeploymentresponse type, mapped fromdeployedProductCountreturned by the entity servicemapDeployments()inutils.balto pass through the new fieldopenapi.yamlwithDeploymentandDeploymentsResponseschemas includingproductCount, and wired the 200 response forPOST /projects/{id}/deployments/searchTest plan
POST /projects/{id}/deployments/searchand verify each deployment object includesproductCountproductCountis absent (not null) when entity service does not returndeployedProductCountSummary by CodeRabbit
New Features
Bug Fixes