44 lines
964 B
TypeScript
44 lines
964 B
TypeScript
import { IsOptional, IsNumber, IsString, IsIn, IsBoolean } from 'class-validator';
|
|
import { ApiPropertyOptional } from '@nestjs/swagger';
|
|
import { Type } from 'class-transformer';
|
|
|
|
export class FindFoodsDto {
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@Type(() => Number)
|
|
@ApiPropertyOptional({ example: 1 })
|
|
page?: number;
|
|
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@Type(() => Number)
|
|
@ApiPropertyOptional({ example: 10 })
|
|
limit?: number;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@ApiPropertyOptional({ example: 'cheese' })
|
|
search?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@ApiPropertyOptional({ example: 'createdAt' })
|
|
orderBy?: string;
|
|
|
|
@IsOptional()
|
|
@IsIn(['asc', 'desc'])
|
|
@ApiPropertyOptional({ example: 'desc' })
|
|
order?: 'asc' | 'desc';
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@ApiPropertyOptional({ example: 'category-ulid' })
|
|
categoryId?: string;
|
|
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
@Type(() => Boolean)
|
|
@ApiPropertyOptional({ example: true })
|
|
isActive?: boolean;
|
|
}
|