diff --git a/backend/services/trading-service/src/api/dto/c2c.dto.ts b/backend/services/trading-service/src/api/dto/c2c.dto.ts index 5645027f..b3097387 100644 --- a/backend/services/trading-service/src/api/dto/c2c.dto.ts +++ b/backend/services/trading-service/src/api/dto/c2c.dto.ts @@ -1,5 +1,6 @@ -import { IsString, IsIn, IsOptional, IsNumberString } from 'class-validator'; +import { IsString, IsIn, IsOptional, IsNumberString, IsInt } from 'class-validator'; import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { Type } from 'class-transformer'; // ==================== C2C 订单类型和状态 ==================== @@ -110,12 +111,16 @@ export class QueryC2cOrdersDto { @IsIn(['BUY', 'SELL']) type?: 'BUY' | 'SELL'; - @ApiPropertyOptional({ description: '页码' }) + @ApiPropertyOptional({ description: '页码', default: 1 }) @IsOptional() + @Type(() => Number) + @IsInt() page?: number; - @ApiPropertyOptional({ description: '每页数量' }) + @ApiPropertyOptional({ description: '每页数量', default: 20 }) @IsOptional() + @Type(() => Number) + @IsInt() pageSize?: number; } @@ -128,12 +133,16 @@ export class QueryMyC2cOrdersDto { @IsIn(['PENDING', 'MATCHED', 'PAID', 'COMPLETED', 'CANCELLED', 'EXPIRED']) status?: string; - @ApiPropertyOptional({ description: '页码' }) + @ApiPropertyOptional({ description: '页码', default: 1 }) @IsOptional() + @Type(() => Number) + @IsInt() page?: number; - @ApiPropertyOptional({ description: '每页数量' }) + @ApiPropertyOptional({ description: '每页数量', default: 20 }) @IsOptional() + @Type(() => Number) + @IsInt() pageSize?: number; }