Skip to content

Add distribution and beneficiary assignment search - #188

Open
FroDev-CR wants to merge 1 commit into
aid-linkk:masterfrom
FroDev-CR:feature/distribution-assignment-search
Open

Add distribution and beneficiary assignment search#188
FroDev-CR wants to merge 1 commit into
aid-linkk:masterfrom
FroDev-CR:feature/distribution-assignment-search

Conversation

@FroDev-CR

Copy link
Copy Markdown
  • Add SearchService.searchDistributions() / searchAssignments(): filtering, pagination and sorting for Distribution and BeneficiaryAssignment records, reusing the existing search pagination/sort-validation helpers.
  • Distribution filters: id/blockchainTxHash/transactionRef, campaign (id or name), beneficiary (id or name), status, method, location (beneficiary country/city), distributedBy, date range, amount range.
  • Assignment filters: id, campaign (id or name), beneficiary (id or name), needsCategory, location, priority range, date range. Note: the BeneficiaryAssignment model has no status/completedAt field, so status filtering isn't available for this endpoint (documented in API.md).
  • New GET /search/distributions and GET /search/assignments endpoints (Admin/Verifier only), plus entityType=distribution|assignment support in the existing GET /search/advanced endpoint.
  • Add zod validation schemas (distributionSearchSchema, assignmentSearchSchema) matching the existing beneficiarySearchSchema conventions.
  • Add missing indexes on BeneficiaryAssignment (assignedAt, priority) via migration; Distribution already had campaignId/beneficiaryId/status/ distributedAt indexed.
  • Unit tests covering where-clause construction, sorting, pagination, and advancedSearch entity routing for both new endpoints.
  • Document both endpoints (query params, examples, response shape) in API.md.

- Add SearchService.searchDistributions() / searchAssignments(): filtering,
  pagination and sorting for Distribution and BeneficiaryAssignment records,
  reusing the existing search pagination/sort-validation helpers.
- Distribution filters: id/blockchainTxHash/transactionRef, campaign
  (id or name), beneficiary (id or name), status, method, location
  (beneficiary country/city), distributedBy, date range, amount range.
- Assignment filters: id, campaign (id or name), beneficiary (id or name),
  needsCategory, location, priority range, date range. Note: the
  BeneficiaryAssignment model has no status/completedAt field, so status
  filtering isn't available for this endpoint (documented in API.md).
- New GET /search/distributions and GET /search/assignments endpoints
  (Admin/Verifier only), plus entityType=distribution|assignment support
  in the existing GET /search/advanced endpoint.
- Add zod validation schemas (distributionSearchSchema, assignmentSearchSchema)
  matching the existing beneficiarySearchSchema conventions.
- Add missing indexes on BeneficiaryAssignment (assignedAt, priority) via
  migration; Distribution already had campaignId/beneficiaryId/status/
  distributedAt indexed.
- Unit tests covering where-clause construction, sorting, pagination, and
  advancedSearch entity routing for both new endpoints.
- Document both endpoints (query params, examples, response shape) in API.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant