-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Overview
Eventually, we want our backend to have the ability to identify donors who haven't donated in a while. We can then use this information to send them emails reminding them to donate to FCC. The goal of this ticket is to implement the former half of this functionality.
Tasks
- Add
findLapsedDonorsmethod toDonationsRepository: This method should use a QueryBuilder to efficiently identify unique donor emails. - Create a new GET endpoint in the donations controller
donations/lapsed - In the service: Create a getLapsedDonors method that the controller will call. This method should act as the orchestrator, invoking the Repository to fetch the data and applying any final business logic or DTO mapping.
- Write unit tests that ensure the following:
- The list returned should include donors who haven't donated in
numMonthsmonths - The list returned should include unique donors to prevent sending emails to the same person more than once
- Only include donations that successfully went through (
status === DonationStatus.SUCCEEDED) - If a donor has an active recurring donation (i.e. at least one of a given donor's donations satisfies
donationType === DonationType.RECURRING), that donor wouldn't be considered lapsed, and thus shouldn't appear in the returned list
- The list returned should include donors who haven't donated in
Acceptance Criteria
- All unit tests should pass
- Controller route should have effective Swagger documentation
Metadata
Metadata
Assignees
Labels
No labels