[CSM Portal] add case activities search endpoint (comments, attachments, field changes) - #1062
Conversation
|
Warning Review limit reached
Next review available in: 26 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?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 reviews. How do review 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 refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
✨ 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 |
…ts, field changes)
Expose POST /cases/{id}/activities/search on the entity-service, proxying the
shared integration service's case activities search. Returns a paginated,
vendor-neutral activity feed as a discriminated union on type (comment,
attachment, field_change); field-change entries are returned only when the
request sets includeFieldChanges. Mirrors the existing case attachment/comment
search flow end to end (domain types, CaseService interface, ServiceNow-backed
service impl, handler, route, and OpenAPI). The Postgres impl returns a
not-supported error, matching the sibling attachment endpoints.
63f6ff2 to
aa92ec0
Compare
Purpose
The CSM portal needs a single, chronologically-ordered activity feed for a case that interleaves comments, attachments, and (optionally) field changes, so an engineer can see the full history of a case in one place. Today the entity-service only exposes comments and attachments as separate searches, and it has no way to surface recorded field changes at all. This PR adds a case activities search endpoint that returns all of these as one unified, paginated feed.
Goals
POST /cases/{id}/activities/searchto the entity-service, returning a paginated activity feed for a case.type(comment,attachment,field_change) so the frontend can render each entry appropriately.includeFieldChanges; when it is omitted orfalse, only comment and attachment entries are returned.Approach
The endpoint mirrors the existing case attachment/comment search flow end to end:
internal/domain): newSearchCaseActivitiesRequest(case id from the path,pagination, optionalincludeFieldChanges),SearchCaseActivitiesResponse(activityarray plustotal/limit/offset/hasMore, matching the sibling search responses), andCaseActivity/FieldChange/ActivityTypetypes.CaseActivitycarries the shared fields (id, type, content, createdOn, created-by name fields) plus type-specific fields set only for the matchingtype(commentTypefor comments;fileName/contentType/sizeBytes/downloadUrlfor attachments;changesfor field changes).internal/service): newSearchCaseActivitieson theCaseServiceinterface. The active data-source implementation proxies the corresponding integration-service search (case id carried in the path), maps the response into the neutral domain types, and computeshasMorethe same way the sibling searches do. The Postgres implementation returns a not-supported error, matching the existing attachment endpoints.internal/handler,internal/server): a new handler decodes the body, pulls the case id from the path, and the route is registered alongside the existing case attachment/comment routes.openapi.yaml): documents the new path and the request/response/CaseActivity/FieldChange/ActivityTypeschemas in neutral vocabulary.This is purely additive: no existing endpoint, type, or contract changes. It depends on a corresponding integration-service change (exposing the case activities search), tracked separately.
User stories
As a CS engineer, I want a single feed of a case's comments, attachments, and field changes so I can review the case's full history without stitching together multiple views.
Release note
Added a case activities search endpoint that returns a unified, paginated feed of a case's comments, attachments, and optional field changes.
Documentation
N/A - internal service-to-service API; the contract is captured in the repo's
openapi.yaml, which this PR updates. No end-user product documentation is affected.Training
N/A - no training-content impact.
Certification
N/A - no impact on certification exams; this is an internal API addition with no end-user-facing behavior change.
Marketing
N/A - internal platform change, nothing to promote.
Automation tests
Security checks
go vet ./...runs clean.Samples
N/A - no samples associated with this change.
Related PRs
A corresponding integration-service change (exposing the case activities search) is tracked separately.
Migrations (if applicable)
N/A - no schema or data migrations; no persistence changes.
Test environment
Go toolchain on macOS. Verified with
go build ./...,go vet ./..., andgo test ./...(all pass).Learning
Followed the existing
SearchCaseAttachments/SearchCaseCommentsimplementations in the entity-service as the reference pattern; no new libraries or external research required.