feat: validate if
This commit is contained in:
parent
30c7ae7dc5
commit
8297dc76b4
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue