Skip to content

refactor: [devjaes] update transaction date validation and enhance tr…#4

Merged
devjaes merged 3 commits into
developfrom
feat/dashboard-improvements
Oct 13, 2025
Merged

refactor: [devjaes] update transaction date validation and enhance tr…#4
devjaes merged 3 commits into
developfrom
feat/dashboard-improvements

Conversation

@devjaes

@devjaes devjaes commented Oct 12, 2025

Copy link
Copy Markdown
Owner

This pull request introduces improvements to how transactions are filtered and aggregated by date and category, as well as refactors related repository logic for clarity and correctness. The main focus is to ensure date-based filtering includes all transactions for the selected days, and to enhance category-based aggregation with category names. Additionally, the codebase sees some cleanup and consistency improvements in joins and entity mapping.

Date handling and filtering improvements:

  • Added utility functions setStartOfDay and setEndOfDay in src/shared/utils/date.utils.ts to ensure date filters include all transactions for the selected days. These are now used throughout the repository for date range queries.
  • Updated transactionFiltersSchema to use .date() instead of .datetime() for startDate and endDate, reflecting that only the date part is relevant for filtering.
  • Refactored repository methods to use setStartOfDay and setEndOfDay for all date range queries, ensuring correct inclusion of transactions at the boundaries. [1] [2] [3]

Category aggregation enhancements:

  • Modified category totals aggregation to include categoryName along with categoryId and total, both in the repository interface and implementation, and reflected this in service and DTO layers. [1] [2] [3] [4]

Repository consistency and code cleanup:

  • Standardized SQL joins in PgTransactionRepository for better readability and consistent formatting. [1] [2] [3] [4] [5] [6]
  • Improved entity mapping to handle nullable category and paymentMethod objects more cleanly.
  • Minor refactoring for clarity in condition building for filters.

DTO and service updates:

  • Updated DTOs and service logic to handle new fields (categoryName) and ensure compatibility with the improved repository methods. [1] [2]

These changes collectively make date filtering more robust, enhance reporting by including category names, and improve code maintainability and readability.…ansaction repository methods

  • Changed date validation in transaction filters from datetime to date.
  • Updated transaction repository methods to include category names in category totals.
  • Improved date handling in transaction queries to ensure correct filtering by date range.

…ansaction repository methods

- Changed date validation in transaction filters from datetime to date.
- Updated transaction repository methods to include category names in category totals.
- Improved date handling in transaction queries to ensure correct filtering by date range.
@devjaes devjaes requested a review from Leninner October 12, 2025 07:11
@Leninner Leninner requested a review from Copilot October 12, 2025 12:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request refactors transaction date validation and enhances transaction repository methods to improve date filtering accuracy and category aggregation functionality. The main purpose is to ensure date-based filtering includes all transactions for selected days and to provide category names alongside totals in aggregation results.

  • Added utility functions for proper date boundary handling (setStartOfDay and setEndOfDay)
  • Updated transaction filtering to use date validation instead of datetime and enhanced category aggregation to include category names
  • Improved code formatting and consistency across SQL joins in the repository

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/shared/utils/date.utils.ts New utility functions for setting start and end of day boundaries
src/features/transactions/infrastructure/adapters/transaction.repository.ts Enhanced date filtering, category aggregation, and improved SQL join formatting
src/features/transactions/domain/ports/transaction-repository.port.ts Updated interface to include categoryName in aggregation results
src/features/transactions/domain/entities/ITrends.ts Added CategoryTotalData interface for type safety
src/features/transactions/application/services/transactions.service.ts Updated service to handle new categoryName field and entity properties
src/features/transactions/application/dtos/transaction.dto.ts Changed date validation from datetime to date format

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/shared/utils/date.utils.ts Outdated
Comment thread src/features/transactions/infrastructure/adapters/transaction.repository.ts Outdated
devjaes and others added 2 commits October 12, 2025 22:00
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…repository.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@devjaes devjaes merged commit a2782b9 into develop Oct 13, 2025
1 check 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.

2 participants