Add date and createdBy filters to sales payments functionality

- Introduced new filters `date` and `createdBy` in the `ListSalesPaymentsFilters` and `ListSalesPaymentsQuery` types to enhance querying capabilities.
- Updated the `SalesPaymentsRepository` to handle filtering based on the new fields.
- Enhanced the `SalesPaymentsService` to process the new filters and ensure proper date handling.
- Added unit tests to validate the integration of the new filters in the service layer.
- Updated DTOs to include validation for the new fields, ensuring correct data formats in API requests.
This commit is contained in:
shancheas
2026-09-01 15:29:07 +07:00
parent 51db4f4a4d
commit 6b3ddfcff9
5 changed files with 45 additions and 0 deletions
@@ -316,6 +316,12 @@ export class SalesPaymentsRepository {
parts.push(search);
}
}
if (filters.date !== undefined) {
parts.push(eq(salesPayments.date, filters.date));
}
if (filters.createdBy) {
parts.push(eq(salesPayments.createdBy, filters.createdBy));
}
if (parts.length === 0) {
return undefined;
}