import { ProductFilter } from './product.filter'; import { ApiPropertyOptional } from '@nestjs/swagger'; import { Transform } from 'class-transformer'; import { IsInt, IsOptional, Min, ValidateNested } from 'class-validator'; export class FindManyProductDto { @ApiPropertyOptional({ type: ProductFilter }) @IsOptional() @ValidateNested() @Transform(({ value }) => value) where?: InstanceType; @ApiPropertyOptional({ description: 'Number of records to take', default: 10 }) @IsOptional() @IsInt() @Min(1) @Transform(({ value }) => value !== undefined ? Number(value) : 10) take = 10; @ApiPropertyOptional({ description: 'Number of records to skip', default: 0 }) @IsOptional() @IsInt() @Min(0) @Transform(({ value }) => value !== undefined ? Number(value) : 0) skip = 0; @ApiPropertyOptional({ description: 'Record to start from' }) @IsOptional() cursor?: Record; @ApiPropertyOptional({ description: 'Ordering of results' }) @IsOptional() orderBy?: Record; }