Skip to content

Conversation

@pujitakalinadhabhotla
Copy link

ℹ️ Issue

Closes DonationsRepository: admin-focused queries and helpers

📝 Description

This PR implements a dedicated repository layer for donations to handle complex database queries, pagination, filtering, and aggregations.

Changes made:

  1. Created DonationsRepository class with 5 required methods for data access operations
  2. Implemented findPaginated() with flexible filtering (by donation type, amount range, date range, anonymity status, and recurring intervals)
  3. Added searchByDonorNameOrEmail() for case-insensitive search across donor name and email fields
  4. Built getTotalsByDateRange() to calculate aggregate totals and counts for specific date ranges
  5. Implemented findRecentPublic() that returns privacy-aware public donations (r
  6. Wrote unit test suite with 20+ test cases covering all methods and edge cases
  7. Used TypeORM QueryBuilder for efficient, type-safe database queries

✔️ Verification

  1. Run npm test donations.repository.spec.ts to execute the full test suite
  2. All 20+ tests should pass
    • Pagination logic with various page sizes and filters
    • Search functionality with multiple field matching
    • Aggregate calculations (sum, count) with null handling
    • Delete operations with error cases
    • Query builder method call verification

thaninbew and others added 29 commits September 13, 2025 02:10
…ain-dtos

Gr donations service domain dtos
…ller-dtos

feat: donation controller DTOs, donations swagger
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.

DonationsRepository: admin-focused queries and helpers

5 participants