import { ApiProperty } from '@nestjs/swagger'; import { IsOptional, IsString, IsBoolean } from 'class-validator'; import { Transform } from 'class-transformer'; /** * 查询药物列表 DTO */ export class MedicationQueryDto { @ApiProperty({ description: '是否只获取激活的药物', example: true, required: false, }) @IsOptional() @IsString() @Transform(({ value }) => value === 'true') isActive?: boolean; @ApiProperty({ description: '页码', example: 1, required: false }) @IsOptional() @IsString() page?: string; @ApiProperty({ description: '每页数量', example: 20, required: false }) @IsOptional() @IsString() pageSize?: string; }