update:add ci cd files ==> do not edit those file
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsEnum, IsMongoId, IsNotEmpty, IsOptional } from 'class-validator';
|
||||
import { FaqDto, faqObj } from './faq.dto';
|
||||
import { ItemStatus } from '../common/eNums/itemStatus.enum';
|
||||
|
||||
// OBJ *******************
|
||||
|
||||
export function faqCategoryObj(faqCategory) {
|
||||
let Faqs = [];
|
||||
if (faqCategory.Faqs && faqCategory.Faqs.length !== 0) {
|
||||
Faqs = faqCategory.Faqs.map((faq) => faqObj(faq));
|
||||
}
|
||||
|
||||
return {
|
||||
id: faqCategory.id,
|
||||
title: faqCategory.title,
|
||||
status: faqCategory.status,
|
||||
description: faqCategory.description,
|
||||
Faqs,
|
||||
};
|
||||
}
|
||||
|
||||
// CLASS *******************
|
||||
|
||||
export class FaqCategoryDto {
|
||||
@IsNotEmpty()
|
||||
@ApiProperty({ type: String })
|
||||
@IsMongoId({ message: 'آیدی نامعتبر است.' })
|
||||
id: string;
|
||||
|
||||
@IsNotEmpty()
|
||||
@ApiProperty({ type: String })
|
||||
status: string;
|
||||
|
||||
@IsNotEmpty()
|
||||
@ApiProperty({ type: String })
|
||||
title: string;
|
||||
|
||||
@ApiProperty({ type: String })
|
||||
description: string;
|
||||
|
||||
@ApiProperty({ isArray: true, type: FaqDto })
|
||||
Faqs: FaqDto[];
|
||||
}
|
||||
export class CreateFaqCategoryDto {
|
||||
@IsNotEmpty()
|
||||
@ApiProperty({ type: String })
|
||||
title: string;
|
||||
|
||||
@ApiProperty({ type: String })
|
||||
description: string;
|
||||
}
|
||||
export class UpdateFaqCategoryDto {
|
||||
@IsNotEmpty()
|
||||
@ApiProperty({ type: String })
|
||||
@IsMongoId({ message: 'آیدی نامعتبر است.' })
|
||||
id: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsEnum(ItemStatus)
|
||||
@ApiProperty({ type: String, required: false })
|
||||
status: string;
|
||||
|
||||
@IsNotEmpty()
|
||||
@ApiProperty({ type: String })
|
||||
title: string;
|
||||
|
||||
@ApiProperty({ type: String })
|
||||
description: string;
|
||||
}
|
||||
export class FilterFaqCategoryDto {
|
||||
@IsOptional()
|
||||
@ApiProperty({ type: String, required: false })
|
||||
@IsMongoId({ message: 'آیدی نامعتبر است.' })
|
||||
id: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsEnum(ItemStatus)
|
||||
@ApiProperty({ type: String, required: false })
|
||||
status: string;
|
||||
}
|
||||
Reference in New Issue
Block a user