Repository navigation
[Customer Entity] Add deployments search API and move product versions to resource-scoped route - #751
Conversation
…/versions/search and remove productId from request body
|
Warning Review limit reached
More reviews will be available in 49 minutes and 52 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
📝 WalkthroughWalkthroughThis PR introduces a complete deployment search feature across the entity-service stack (domain types, database schema, repository, service, and HTTP handler), while also refactoring the product versions search endpoint to treat ChangesDeployment search feature and product versions endpoint refactor
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
Actionable comments posted: 2
🧹 Nitpick comments (1)
entity-service/internal/server/routes.go (1)
65-65: Document the breaking API change for consumers.The route change from
POST /product-versions/searchtoPOST /products/{id}/versions/searchbreaks existing API consumers. Although this is intentional and improves the REST design by making the product ID a path parameter, ensure that:
- Migration guides or changelog document this breaking change
- API consumers are notified before deployment
- Any API versioning or deprecation strategy is followed
🤖 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 `@entity-service/internal/server/routes.go` at line 65, The new route registration using "POST /products/{id}/versions/search" (handler productVersionHandler.SearchProductVersions) is a breaking change from the old "POST /product-versions/search"; update documentation and release artifacts to reflect this: add an entry to the changelog and migration guide describing the exact path change and example requests, create a deployment/notification note for API consumers, and apply your project’s versioning/deprecation policy (e.g., bump API version or add a deprecated endpoint proxy) so clients are warned or can migrate before removal.
🤖 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.
Inline comments:
In `@entity-service/internal/repository/deployment_repo.go`:
- Around line 53-69: SearchDeployments is currently casting the columns
(project_id::text, type::text) which prevents use of existing btree indexes;
instead stop casting the columns in the WHERE string and cast the parameter
arrays to the correct DB types. Update the clauses built around the where
variable (where += ...) to use "project_id = ANY($%d::<uuid array type>)" and
"type = ANY($%d::<deployment_type_enum array type>)" (keeping argIdx and
filterArgs logic), ensure req.ProjectIDs is passed as the appropriate UUID-typed
slice and req.DeploymentTypeKeys is converted to the correct enum-typed slice
(the existing typeStrings conversion can remain if you cast the parameter to the
enum array in SQL), and leave argIdx/filterArgs updates as-is so the DB can use
idx_deployments_project_id and idx_deployments_type.
In `@entity-service/migrations/000006_create_deployments.up.sql`:
- Around line 1-8: The migration creates the enum deployment_type_enum
unconditionally which makes the migration non-rerunnable; change the enum
creation in 000006_create_deployments.up.sql to be idempotent by checking for
the type first and only creating it when absent (e.g., wrap in a DO block that
queries pg_type/pg_namespace for typname = 'deployment_type_enum' and runs
CREATE TYPE ... only if not present, or use CREATE TYPE IF NOT EXISTS on PG
versions that support it) so retries after partial failure won’t error on an
existing type.
---
Nitpick comments:
In `@entity-service/internal/server/routes.go`:
- Line 65: The new route registration using "POST
/products/{id}/versions/search" (handler
productVersionHandler.SearchProductVersions) is a breaking change from the old
"POST /product-versions/search"; update documentation and release artifacts to
reflect this: add an entry to the changelog and migration guide describing the
exact path change and example requests, create a deployment/notification note
for API consumers, and apply your project’s versioning/deprecation policy (e.g.,
bump API version or add a deprecated endpoint proxy) so clients are warned or
can migrate before removal.
🪄 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: 7705c69f-cf3e-4590-a00b-82b038259e3a
📒 Files selected for processing (9)
entity-service/internal/domain/entity.goentity-service/internal/handler/deployment_handler.goentity-service/internal/handler/product_version_handler.goentity-service/internal/repository/deployment_repo.goentity-service/internal/server/routes.goentity-service/internal/service/deployment_service.goentity-service/internal/service/interfaces.goentity-service/migrations/000006_create_deployments.down.sqlentity-service/migrations/000006_create_deployments.up.sql
9f909b1 to
e9eeb96
Compare
Wires POST /deployments/search into the csm-portal backend, proxying to the entity service endpoint added in wso2-open-operations#751. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Wires POST /deployments/search into the csm-portal backend, proxying to the entity service endpoint added in wso2-open-operations#751. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Purpose
POST /deployments/searchendpoint with pagination and optional filters:projectIds[],deploymentTypeKeys[], andsearchQuery(ILIKE on name)deploymentstable withdeployment_type_enumand supporting indexesPOST /product-versions/searchtoPOST /products/{id}/versions/search— product ID is now a path parameter, removed from the request bodySummary by CodeRabbit
Release Notes
New Features
API Changes
/product-versions/searchto/products/{id}/versions/searchfor improved scoping