Skip to content

feat: Extend Search to Beneficiaries with Filters, Pagination.....#97

Merged
BarryArinze merged 5 commits into
aid-linkk:masterfrom
Oluwatos94:feature/74-beneficiary-search
Jun 29, 2026
Merged

feat: Extend Search to Beneficiaries with Filters, Pagination.....#97
BarryArinze merged 5 commits into
aid-linkk:masterfrom
Oluwatos94:feature/74-beneficiary-search

Conversation

@Oluwatos94

Copy link
Copy Markdown
Contributor

What

Extends search to beneficiaries with filtering, pagination, sorting, and faceted aggregation.

Closes #74.

Endpoint

GET /api/v1/search/beneficiariesAdmin/Verifier only (returns PII).

Params: q, country, city, needsCategory, verificationStatus, riskScoreMin/Max, ageMin/Max, familySizeMin/Max, page, limit, sortBy, sortOrder.

Response: { data, pagination: { page, limit, total, totalPages }, facets }.

Highlights

  • Validated zod DTO; sortBy/verificationStatus are enum-checked before hitting Prisma.
  • Age filter/sort derived from dateOfBirth; relevance falls back to recency.
  • Facets: countries, cities, needsCategories, verificationStatuses, riskScore/age/familySize ranges; with
    drill-down semantics (each facet excludes its own active filter).
  • Results + count + facets run in a single $transaction for a consistent snapshot.
  • Stable pagination via id tiebreaker on every sort.
  • New needsCategory field; B-tree indexes on search fields + pg_trgm GIN indexes for q text search.

Migration required

Run prisma migrate dev before deployment; it enables pg_trgm and adds the new indexes/field.

Tests

Unit tests for filters, pagination, sort, drill-down facets, and bucketing. Full suite green (pre-existing
sharp-missing storage suite excepted).

Screenshot 2026-06-21 002237

@BarryArinze

Copy link
Copy Markdown
Collaborator

CI/CD Pipeline test failed. Please resolve it

@Oluwatos94

Copy link
Copy Markdown
Contributor Author

Hi @BarryArinze, pls check now. Do you have to trigger the pipeline yourself? No Job is running automatically.

@BarryArinze

Copy link
Copy Markdown
Collaborator

Yes I will trigger it by myself. Please resolve cothe conflicts so I can

@Oluwatos94

Copy link
Copy Markdown
Contributor Author

@BarryArinze, conflicts resolved.

@GBOYEE

GBOYEE commented Jun 23, 2026

Copy link
Copy Markdown

I'd like to work on this.

Approach:

  • I'll add the CI config and test it locally before pushing
  • Verify with existing tests + add new ones if needed

Estimated effort: ~1-2 hours. PR incoming shortly.

@Oluwatos94

Copy link
Copy Markdown
Contributor Author

@BarryArinze, pls kind check this PR. I have resolved the conflicts again.

@aid-linkk aid-linkk deleted a comment from GBOYEE Jun 29, 2026
@aid-linkk aid-linkk deleted a comment from GBOYEE Jun 29, 2026
@BarryArinze BarryArinze merged commit 14b7b4e into aid-linkk:master Jun 29, 2026
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.

Extend Search to Beneficiaries with Filters, Pagination, Sorting, and Facets

3 participants