-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Overview
We want to set up an endpoint that allows us to export donation information to a CSV format.
Tasks
- Add
GET /donations/exportroute indonations.controller.ts, ensuring that only admins can access that route.- If a non-admin tries to access the route, throw an
UnauthorizedException
- If a non-admin tries to access the route, throw an
- Add a corresponding
exportToCsvmethod indonations.service.ts. This function should generate a CSV file with columns for a donation's ID, first and last name, email, amount, type, interval (if recurring), date, and transaction ID- Since the CSV file could potentially be very large depending on how many donations are in the database, it may be useful to use file streaming (Documentation: https://docs.nestjs.com/techniques/streaming-files)
- Write unit tests to ensure that files are formatted correctly, and edge cases (e.g. no donations to format) are properly handled
Acceptance Criteria
- The controller should call the method in the service to export the donations in CSV format
- Only admins should be able to successfully call the route
- All unit tests pass
Metadata
Metadata
Assignees
Labels
No labels