This commit is contained in:
mahyargdz
2025-09-14 15:15:03 +03:30
commit be82059172
534 changed files with 51310 additions and 0 deletions
+112
View File
@@ -0,0 +1,112 @@
import { Expose } from "class-transformer";
import { IsArray, IsNotEmpty, IsOptional, IsString } from "class-validator";
import { ApiProperty } from "../../../common/decorator/swggerDocs";
import { IsValidId } from "../../../common/decorator/validation.decorator";
import { BlogCategoryModel } from "../models/blogCategory.model";
export class CreateBlogDTO {
@Expose()
@IsNotEmpty()
@IsString()
@ApiProperty({ type: "string", description: "farsi title of blog", example: "دیابت | علائم، علل ابتلا، پیشگیری و درمان" })
title_fa: string;
@Expose()
@IsNotEmpty()
@IsString()
@ApiProperty({ type: "string", description: "english slug of blog", example: "diabetes" })
slug: string;
@Expose()
@IsNotEmpty()
@IsValidId(BlogCategoryModel)
@ApiProperty({ type: "string", description: "id of blog category", example: "66eda6397ac110c16462737a" })
category: string;
@Expose()
@IsNotEmpty()
@IsString()
@ApiProperty({ type: "string", description: "description of blog ", example: "دیابت | علائم، علل ابتلا، پیشگیری و درمان" })
description: string;
@Expose()
@IsNotEmpty()
@IsString()
@ApiProperty({
type: "string",
description: "description of blog ",
example:
"دیابت بیماری است که در آن بدن نمی تواند گلوکز لازم برای تامین انرژی سلول های بدن بیمار را تامین کند. در واقع شخصی که به این بیماری مبتلا باشد سطح گلوکز در بدن او بالا میماند و هورمونی به اسم انسولین که قند موجود در بدن را به انرژی تبدیل کند نمیتواند این انتقال را انجام دهد .",
})
content: string;
@Expose()
@IsNotEmpty()
@IsArray()
@IsString({ each: true })
@ApiProperty({ type: "Array", description: "tags of blog ", example: ["diabetes", "test", "sugar"] })
tags: string[];
@Expose()
@IsNotEmpty()
@IsString()
@ApiProperty({ type: "string", description: "image url of blog ", example: "https://cdn.com" })
imageUrl: string;
}
export class UpdateBlogDTO {
@Expose()
@IsOptional()
@IsNotEmpty()
@IsString()
@ApiProperty({ type: "string", description: "farsi title of blog", example: "دیابت | علائم، علل ابتلا، پیشگیری و درمان" })
title_fa?: string;
@Expose()
@IsOptional()
@IsNotEmpty()
@IsString()
@ApiProperty({ type: "string", description: "english slug of blog", example: "diabetes" })
slug?: string;
@Expose()
@IsOptional()
@IsNotEmpty()
@IsValidId(BlogCategoryModel)
@ApiProperty({ type: "string", description: "id of blog category", example: "66ed83563858f185c68449ff" })
category?: string;
@Expose()
@IsOptional()
@IsNotEmpty()
@IsString()
@ApiProperty({ type: "string", description: "description of blog ", example: "دیابت | علائم، علل ابتلا، پیشگیری و درمان" })
description?: string;
@Expose()
@IsOptional()
@IsNotEmpty()
@IsString()
@ApiProperty({
type: "string",
description: "description of blog ",
example:
"دیابت بیماری است که در آن بدن نمی تواند گلوکز لازم برای تامین انرژی سلول های بدن بیمار را تامین کند. در واقع شخصی که به این بیماری مبتلا باشد سطح گلوکز در بدن او بالا میماند و هورمونی به اسم انسولین که قند موجود در بدن را به انرژی تبدیل کند نمیتواند این انتقال را انجام دهد .",
})
content?: string;
@Expose()
@IsOptional()
@IsNotEmpty()
@IsArray()
@IsString({ each: true })
@ApiProperty({ type: "Array", description: "tags of blog ", example: ["diabetes", "test", "sugar"] })
tags?: string[];
@Expose()
@IsOptional()
@IsNotEmpty()
@ApiProperty({ type: "string", description: "image url of blog ", example: "https://cdn.com" })
imageUrl?: string;
}