import { ApiPropertyOptional } from '@nestjs/swagger'; import { Type } from 'class-transformer'; import { IsInt, IsOptional, IsString, Max, Min } from 'class-validator'; export class PaginationDto { @ApiPropertyOptional({ default: 1, minimum: 1 }) @IsOptional() @Type(() => Number) @IsInt() @Min(1) page: number = 1; @ApiPropertyOptional({ default: 20, minimum: 1, maximum: 100 }) @IsOptional() @Type(() => Number) @IsInt() @Min(1) @Max(100) pageSize: number = 20; @ApiPropertyOptional({ description: '排序,如 createdAt:desc' }) @IsOptional() @IsString() sort?: string; }