Skip to content

added DonationsRepository and tests#15

Merged
thaninbew merged 2 commits intomainfrom
feature/donations-repository
Oct 15, 2025
Merged

added DonationsRepository and tests#15
thaninbew merged 2 commits intomainfrom
feature/donations-repository

Conversation

@pujitakalinadhabhotla
Copy link
Copy Markdown
Contributor

ℹ️ Issue
Closes #7

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

Changes made:

Created DonationsRepository class with 5 required methods for data access operations
Implemented findPaginated() with flexible filtering (by donation type, amount range, date range, anonymity status, and recurring intervals)
Added searchByDonorNameOrEmail() for case-insensitive search across donor name and email fields
Built getTotalsByDateRange() to calculate aggregate totals and counts for specific date ranges
Implemented findRecentPublic() that returns privacy-aware public donations (r
Wrote unit test suite with 20+ test cases covering all methods and edge cases
Used TypeORM QueryBuilder for efficient, type-safe database queries
✔️ Verification
Run npm test donations.repository.spec.ts to execute the full test suite
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 thaninbew merged commit 17055a2 into main Oct 15, 2025
8 checks passed
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

2 participants