Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 3, 2025

Changes

This PR adds optional startDate and endDate query parameters to the GET /api/transaction endpoint, allowing users to filter transactions by date range.

Implementation

The date filtering has been implemented across all layers of the application:

  • Controller: Added DateTime? parameters startDate and endDate to the GetTransactions action
  • Business Logic: Updated TransactionProcessor.GetTransactions() to accept and pass through date filters
  • Data Layer: Modified ITransactionsDataService interface and TransactionsDataService implementation to apply MongoDB filters for date ranges

The filtering is performed at the database level using MongoDB query operators:

  • startDate: Uses $gte (greater than or equal) to include transactions from the specified date onwards
  • endDate: Uses $lte (less than or equal) to include transactions up to the specified date

API Usage

# Get all transactions (backward compatible - no filters)
GET /api/transaction

# Get transactions from a specific start date
GET /api/transaction?startDate=2024-01-01

# Get transactions within a date range
GET /api/transaction?startDate=2024-01-01&endDate=2024-01-31

# Combine with existing account filter
GET /api/transaction?accountId=account123&startDate=2024-01-01&endDate=2024-12-31

Backward Compatibility

All parameters are optional with default values of null, ensuring existing API calls continue to work without modification. The date filters can be used independently or in combination with the existing accountId filter.

Additional Changes

  • Updated test mocks to accommodate the new method signature
  • Added necessary using System; directives for DateTime support

Fixes #[issue-number]

Original prompt

can you add start and end date filter parameters to the get transactions endpoint


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: benfl3713 <44288013+benfl3713@users.noreply.github.com>
Copilot AI changed the title [WIP] can you add start and end date filter parameters to the get transactions endpoint Add start and end date filter parameters to GET transactions endpoint Oct 3, 2025
Copilot AI requested a review from benfl3713 October 3, 2025 15:29
@benfl3713 benfl3713 marked this pull request as ready for review October 3, 2025 16:24
@benfl3713 benfl3713 merged commit d99cd3f into master Oct 3, 2025
2 checks passed
@benfl3713 benfl3713 deleted the copilot/fix-345a4e20-8611-4c6c-968c-be76e3b7563a branch October 3, 2025 16:24
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.

2 participants