Enhance pagination and ordering capabilities in API responses

- Updated pagination-response and read-write-controllers documentation to include `orderBy` and `orderType` parameters for sorting results.
- Introduced new `order-clause` module to handle ordering logic, including validation for order types and columns.
- Enhanced `PaginationQueryDto` to support ordering fields in API requests.
- Updated various repository and service classes to implement ordering in database queries.
- Added unit tests for new ordering functionality and ensured existing tests cover the updated behavior.
- Refactored related DTOs to include user and code relations for better data representation in responses.
This commit is contained in:
shancheas
2026-08-27 13:09:41 +07:00
parent 790725e227
commit 4c45a4371e
85 changed files with 1824 additions and 365 deletions
@@ -62,8 +62,17 @@ describe('CyclesService', () => {
weekday: 'monday',
startBranchId: 'br-1',
endBranchId: 'br-2',
startBranch: { id: 'br-1', code: 'B1', name: 'Start' },
endBranch: { id: 'br-2', code: 'B2', name: 'End' },
routeGeometry: geometry,
destinations: [{ id: 'dest-1', customerId: 'cus-1', sortOrder: 0 }],
destinations: [
{
id: 'dest-1',
customerId: 'cus-1',
customer: { id: 'cus-1', code: 'C1', name: 'Acme' },
sortOrder: 0,
},
],
},
],
status: Status.create('draft'),
@@ -71,6 +80,9 @@ describe('CyclesService', () => {
updatedAt: now,
createdBy: 'user-1',
updatedBy: 'user-1',
employee: { id: 'emp-1', code: 'E1', name: 'Ada' },
createdByUser: { id: 'user-1', username: 'admin' },
updatedByUser: { id: 'user-1', username: 'admin' },
};
const located = { id: 'x', latitude: -6.2, longitude: 106.8 };