chore: add blog blog comment and blog category crud
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { ApiPropertyOptional, PickType } from "@nestjs/swagger";
|
||||
import { Type } from "class-transformer";
|
||||
import { IsDateString, IsIn, IsOptional, IsString, IsUUID } from "class-validator";
|
||||
|
||||
import { PaginationDto } from "../../../common/DTO/pagination.dto";
|
||||
import { BlogMessage, CategoryMessage } from "../../../common/enums/message.enum";
|
||||
|
||||
export class BlogListSearchQueryDto extends PaginationDto {
|
||||
@IsOptional()
|
||||
@IsString({ message: BlogMessage.SEARCH_QUERY_STRING })
|
||||
@ApiPropertyOptional({ description: "Search query", example: "search query" })
|
||||
q?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsUUID(4, { message: CategoryMessage.CAT_ID_SHOULD_BE_UUID })
|
||||
@ApiPropertyOptional({ description: "Category id", example: "8b1e8b1e-8b1e-8b1e-8b1e-8b1e8b1e8b1e" })
|
||||
categoryId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsDateString({}, { message: BlogMessage.INVALID_DATE })
|
||||
@ApiPropertyOptional({ description: "since query", example: "2025-01-27" })
|
||||
since?: string;
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsIn([1, 0], { message: BlogMessage.IS_ACTIVE_SHOULD_BE_1_0 })
|
||||
@ApiPropertyOptional({ description: "blog status", example: 1 })
|
||||
isActive?: number;
|
||||
}
|
||||
|
||||
export class BlogSearchQueryDto extends PickType(BlogListSearchQueryDto, ["limit", "page", "categoryId"] as const) {}
|
||||
Reference in New Issue
Block a user