import { IsOptional, IsString, IsNumber, IsBoolean, Min, } from 'class-validator'; import { Type } from 'class-transformer'; import { ApiPropertyOptional } from '@nestjs/swagger'; export class QueryBrokerDto { @ApiPropertyOptional({ description: '券商ID', example: 1, minimum: 1, }) @IsOptional() @Type(() => Number) @IsNumber() @Min(1) brokerId?: number; @ApiPropertyOptional({ description: '券商代码', example: 'HTZQ', }) @IsOptional() @IsString() brokerCode?: string; @ApiPropertyOptional({ description: '券商名称', example: '华泰证券', }) @IsOptional() @IsString() brokerName?: string; @ApiPropertyOptional({ description: '地区/国家代码', example: 'CN', enum: ['CN', 'US', 'HK', 'SG', 'JP', 'UK', 'AU', 'CA', 'OTHER'], }) @IsOptional() @IsString() region?: string; @ApiPropertyOptional({ description: '是否启用', example: true, }) @IsOptional() @Type(() => Boolean) @IsBoolean() isActive?: boolean; @ApiPropertyOptional({ description: '页码', example: 1, minimum: 1, default: 1, }) @IsOptional() @Type(() => Number) @IsNumber() @Min(1) page?: number = 1; @ApiPropertyOptional({ description: '每页数量', example: 10, minimum: 1, default: 10, }) @IsOptional() @Type(() => Number) @IsNumber() @Min(1) limit?: number = 10; @ApiPropertyOptional({ description: '排序字段', example: 'createdAt', default: 'createdAt', }) @IsOptional() @IsString() sortBy?: string = 'createdAt'; @ApiPropertyOptional({ description: '排序方向', example: 'DESC', enum: ['ASC', 'DESC'], default: 'DESC', }) @IsOptional() @IsString() sortOrder?: 'ASC' | 'DESC' = 'DESC'; }