feat: adds param to get filtered claims by checked field#117
Conversation
Signed-off-by: Amit Singh <singhamitch@outlook.com>
Signed-off-by: Amit Singh <singhamitch@outlook.com>
Signed-off-by: Amit Singh <singhamitch@outlook.com>
Signed-off-by: Amit Singh <singhamitch@outlook.com>
Signed-off-by: Amit Singh <singhamitch@outlook.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds optional filtering support to the claims listing API via a new ChangesClaims Checked Filter Implementation
Sequence DiagramsequenceDiagram
participant Handler
participant Service as ClaimService
participant Repo as ClaimRepository
participant DB as pgsql.Client
Handler->>Service: GetClaims(ctx, ClaimFilter{Checked: bool})
Service->>Repo: GetClaims(ctx, ClaimFilter)
Repo->>DB: FindAll(ctx, &api.Claim{}, filterFields{Checked})
DB->>Repo: []api.Claim
Repo->>Service: []api.Claim
Service->>Handler: []api.Claim
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 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 docstrings
🧪 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 `@api/source-score.yaml`:
- Around line 171-177: Add a 400 Bad Request response to the OpenAPI operation
for GET /api/v1/claims to reflect that an unparsable checked query parameter can
cause a 400; update the responses block in api/source-score.yaml for the GET
/api/v1/claims operation to include a 400 response schema/description (matching
the project's error response shape) so generated clients and docs match the
runtime behavior when the checked query value is invalid.
In `@pkg/domain/claim/claim_service_test.go`:
- Around line 79-81: The test sets a global default return on the shared fake
using fakeClaimRepo.GetClaimsReturns which can leak state into other specs;
replace that with a per-call return by capturing the current call index
(callsBefore := fakeClaimRepo.GetClaimsCallCount()) and then call
fakeClaimRepo.GetClaimsReturnsOnCall(callsBefore, expected, nil) so only this
specific call returns the expected value.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: f4308a3b-7666-4b7a-92af-1e0e7f9eadeb
📒 Files selected for processing (13)
.gitignoreacceptance/claim_test.goapi/source-score.yamlpkg/db/pgsql/client.gopkg/domain/claim/claim_repository.gopkg/domain/claim/claim_repository_test.gopkg/domain/claim/claim_service.gopkg/domain/claim/claim_service_test.gopkg/domain/claim/claimfakes/fake_claim_repository.gopkg/domain/claim/claimfakes/fake_claim_service.gopkg/domain/proof/proof_repository.gopkg/domain/source/source_repository.gopkg/handlers/claim.go
There was a problem hiding this comment.
1 issue found across 13 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="api/source-score.yaml">
<violation number="1" location="api/source-score.yaml:176">
P2: The `checked` query parameter can trigger a `400 Bad Request` response (see handler at `pkg/handlers/claim.go` lines 36-40), but the OpenAPI spec only declares a `200` response for this operation. Add a `400` response to keep the API contract accurate for clients and generated SDKs.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Signed-off-by: Amit Singh <singhamitch@outlook.com>
Summary by CodeRabbit
New Features
checkedquery parameter (true/false).Documentation
checkedquery parameter and a400 Invalid request parametersresponse.Tests