27 lines
1004 B
TypeScript
27 lines
1004 B
TypeScript
import { ApiPropertyOptional } from "@nestjs/swagger";
|
|
import { Type } from "class-transformer";
|
|
import { IsOptional, IsString, IsUUID } from "class-validator";
|
|
|
|
import { PaginationDto } from "../../../common/DTO/pagination.dto";
|
|
import { CategoryMessage } from "../../../common/enums/message.enum";
|
|
|
|
export class CategorySearchQueryDto {
|
|
@IsOptional()
|
|
@IsUUID("4", { message: CategoryMessage.PARENT_ID_SHOULD_BE_UUID })
|
|
@ApiPropertyOptional({ description: "Parent category id", example: "8b1e8b1e-8b1e-8b1e-8b1e-8b1e8b1e8b1e" })
|
|
parentId?: string;
|
|
}
|
|
|
|
export class CategoryListSearchQueryDto extends PaginationDto {
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
// @IsBoolean({ message: CategoryMessage.IS_ACTIVE_SHOULD_BE_BOOLEAN })
|
|
@ApiPropertyOptional({ description: "Category status", example: 1 })
|
|
isActive?: number;
|
|
|
|
@IsOptional()
|
|
@IsString({ message: CategoryMessage.SEARCH_QUERY_STRING })
|
|
@ApiPropertyOptional({ description: "Search query", example: "search query" })
|
|
q?: string;
|
|
}
|