33 lines
666 B
TypeScript
33 lines
666 B
TypeScript
import { IsOptional, IsString, IsNumber, IsIn, IsBoolean } from 'class-validator';
|
|
import { Type } from 'class-transformer';
|
|
|
|
export class QueryProductDto {
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsNumber()
|
|
page?: number;
|
|
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsNumber()
|
|
limit?: number;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
sortBy?: string; // Should be a property of the Product entity
|
|
|
|
@IsOptional()
|
|
@IsIn(['ASC', 'DESC'])
|
|
order?: 'ASC' | 'DESC';
|
|
|
|
// --- Add other filterable properties below ---
|
|
// @IsOptional()
|
|
// @IsString()
|
|
// name?: string;
|
|
|
|
// @IsOptional()
|
|
// @Type(() => Boolean)
|
|
// @IsBoolean()
|
|
// is_available?: boolean;
|
|
}
|