Repository navigation
[Customer Portal][BE] Add time cards search endpoint for project scoped to cases - #536
Conversation
📝 WalkthroughWalkthroughThis PR introduces a new case-grouped time card search feature, adding a dedicated entity function, API endpoint, service handler, and supporting types. The changes enable searching time cards aggregated by cases rather than as individual records, while preserving existing time card search functionality. Changes
Sequence DiagramsequenceDiagram
participant Client
participant Service as Service Handler
participant Entity as Entity Module
participant Backend as Backend API
Client->>Service: POST /projects/{id}/cases/time-cards/search<br/>(with payload & auth)
Service->>Service: Validate auth & build filters<br/>(projectIds, dates, states)
Service->>Entity: searchTimeCardsGroupedByCases<br/>(idToken, payload)
Entity->>Backend: POST /cases/time-cards/search<br/>(with headers & payload)
Backend-->>Entity: CaseTimeCardsSearchResponse<br/>(cases, totalRecords)
Entity-->>Service: CaseTimeCardsSearchResponse
Service->>Service: mapTimeCardSearchResponseGroupedByCases<br/>(transform to types model)
Service-->>Client: http:Ok<br/>(caseTimeCards[], pagination)
Note over Service: On error:<br/>400/401/403/500<br/>with typed responses
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 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: 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/openapi.yaml`:
- Around line 2077-2078: The 200 response for the grouped-search endpoint lacks
a JSON schema, so update the OpenAPI entry for the grouped-search response to
reference the correct schema (CaseTimeCardsSearchResponse) and add the missing
components/schemas definitions for CaseTimeCardsSearchResponse and any nested
grouped time-card record objects used by it (e.g., GroupedTimeCard,
TimeCardRecord or similarly named models) under components.schemas; then
regenerate the OpenAPI client artifacts so generated clients use the typed
response.
🪄 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: 97805cc1-82cd-4565-81b2-b3432957f106
📒 Files selected for processing (6)
apps/customer-portal/backend/modules/entity/entity.balapps/customer-portal/backend/modules/entity/types.balapps/customer-portal/backend/modules/types/types.balapps/customer-portal/backend/openapi.yamlapps/customer-portal/backend/service.balapps/customer-portal/backend/utils.bal
72714d3
into
wso2-open-operations:dev-app-customer-portal
Summary
This PR introduces a new endpoint to search time cards for a project, scoped to cases.
Changes
Functionality
The new endpoint enables:
Reason
Previously, time cards were not easily searchable at the project level when bound to cases.
This enhancement enables:
Testing
Impact
Summary by CodeRabbit