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
@@ -15,7 +15,12 @@ import {
Min,
ValidateNested,
} from 'class-validator';
import { PaginationQueryDto } from '../../../../common/http/response';
import {
CodeRelationDto,
DefaultRelationDto,
PaginationQueryDto,
UserRelationDto,
} from '../../../../common/http/response';
import {
DOCUMENT_ADDRESS_MAX_LENGTH,
DOCUMENT_CODE_MAX_LENGTH,
@@ -217,14 +222,12 @@ export class PackingSlipDto {
id!: string;
@ApiProperty()
code!: string;
@ApiPropertyOptional({ nullable: true, format: 'uuid' })
salesOrderId!: string | null;
@ApiPropertyOptional({ nullable: true })
salesOrderNumber!: string | null;
@ApiPropertyOptional({ type: CodeRelationDto, nullable: true })
salesOrder!: CodeRelationDto | null;
@ApiProperty()
date!: number;
@ApiProperty({ format: 'uuid' })
customerId!: string;
@ApiProperty({ type: DefaultRelationDto, nullable: true })
customer!: DefaultRelationDto | null;
@ApiProperty()
address!: string;
@ApiPropertyOptional({ nullable: true })
@@ -239,8 +242,8 @@ export class PackingSlipDto {
createdAt!: number;
@ApiProperty()
updatedAt!: number;
@ApiProperty({ format: 'uuid' })
createdBy!: string;
@ApiProperty({ format: 'uuid' })
updatedBy!: string;
@ApiProperty({ type: UserRelationDto })
createdBy!: UserRelationDto;
@ApiProperty({ type: UserRelationDto })
updatedBy!: UserRelationDto;
}