feat: validate if

This commit is contained in:
Nevo David 2025-01-04 16:03:58 +07:00
parent 30c7ae7dc5
commit 8297dc76b4
1 changed files with 2 additions and 1 deletions

View File

@ -1,5 +1,5 @@
import {
ArrayMinSize, IsArray, IsDateString, IsDefined, IsIn, IsOptional, IsString, MinLength, ValidateNested,
ArrayMinSize, IsArray, IsDateString, IsDefined, IsIn, IsOptional, IsString, MinLength, ValidateIf, ValidateNested
} from 'class-validator';
import { Type } from 'class-transformer';
import { DevToSettingsDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/dev.to.settings.dto';
@ -93,6 +93,7 @@ export class CreatePostDto {
@IsDateString()
date: string;
@ValidateIf((o) => o.type !== 'draft')
@IsDefined()
@Type(() => Post)
@IsArray()