[CSM Portal][BE] align with entity service PR #929: drop Key/Keys suffix, add change-requests search - #933
Conversation
… drop Key/Keys suffix, add change-requests search - Remove Key/Keys suffix from all enum request fields to match entity service: stateKey→state, severityKey→severity, workStateKey→workState (PATCH case), typeKey→type, issueTypeKey→issueType (create case/comment), typeKeys→types, stateKeys→states, severityKeys→severities, engagementTypeKeys→engagementTypes, issueTypeKeys→issueTypes (case search), deploymentTypeKeys→deploymentTypes (deployment search) - Update PatchCase handler to read state/workState from new JSON field names - Update CreateCaseComment handler to read type from new JSON field name - Add POST /change-requests/search endpoint: entity client method, handler, interface, mock, tests, route registration, and openapi spec - Update openapi.yaml, README.md, and CLAUDE.md throughout Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 52 minutes and 14 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. 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 (7)
📝 WalkthroughWalkthroughThe PR renames all ChangesField Naming Refactor (
New Change Requests Search Endpoint
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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
🤖 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 `@apps/csm-portal/backend/internal/handler/cases.go`:
- Around line 183-186: The request guard in cases handling is now only reading
the renamed JSON keys, so legacy portal payloads can silently bypass the
work-note exemption and local transition checks. Update the parsing logic in the
cases handler to accept both the new and legacy aliases in the relevant request
metadata structs (including the work-state guard path), or explicitly detect
legacy-only payloads and return a clear 400; keep the behavior
backward-compatible during the rename rather than defaulting to empty values.
In `@apps/csm-portal/backend/openapi.yaml`:
- Around line 131-132: The OpenAPI request schema change in the case
update/create endpoints is removing live field names too abruptly, while the
frontend consumer still sends the older keys. Update the relevant request body
definitions in openapi.yaml so the case mutation endpoints accept both the new
names and the existing client fields used by cases.ts, or otherwise keep the old
spellings during a deprecation window; make sure the specs for the affected
operations stay backward-compatible across all referenced request-body blocks.
🪄 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: 362cf78a-912b-44e0-af14-66fc654f8be4
📒 Files selected for processing (10)
apps/csm-portal/backend/CLAUDE.mdapps/csm-portal/backend/README.mdapps/csm-portal/backend/cmd/server/main.goapps/csm-portal/backend/internal/entity/entity.goapps/csm-portal/backend/internal/handler/cases.goapps/csm-portal/backend/internal/handler/cases_test.goapps/csm-portal/backend/internal/handler/change_requests.goapps/csm-portal/backend/internal/handler/change_requests_test.goapps/csm-portal/backend/internal/handler/helpers_test.goapps/csm-portal/backend/openapi.yaml
…ate/type (PR wso2-open-operations#932) - Add GetChangeRequest entity client method, interface method, handler, mock, tests, and route registration for GET /change-requests/{id} - UUID validation on the path param (fail fast before calling upstream) - Update ChangeRequestSearchView in openapi.yaml: mark impact, state, type as nullable: true to match entity service PR wso2-open-operations#932 fix - Add ChangeRequestDetail schema extending ChangeRequestSearchView with approval and planning fields - Update README.md with the new endpoint Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
Key/Keyssuffix from all enum request fields to match the entity service PR [Customer Entity] Add search endpoint and standardise enum field naming #929 contract:stateKey→state,severityKey→severity,workStateKey→workState(PATCH case);typeKey→type,issueTypeKey→issueType(create case/comment);typeKeys→types,stateKeys→states,severityKeys→severities,engagementTypeKeys→engagementTypes,issueTypeKeys→issueTypes(case search);deploymentTypeKeys→deploymentTypes(deployment search)state/workStateinPatchCase,typeinCreateCaseComment)POST /change-requests/searchendpoint: entity client method,ChangeRequestHandler, interface, mock, tests, route registration, and full OpenAPI spec entryTest plan
go test ./...)TestSearchChangeRequeststests cover auth, body size, invalid JSON, happy path, and upstream error mapping🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes