1 2 3 4 5 6 7 8 9 10 11 12 13 14import { ApiProperty, PickType } from '@nestjs/swagger'; import { IsOptional } from 'class-validator'; import { Posts } from 'src/entities/Posts'; export class CreatePostDto extends PickType(Posts, [ 'title', 'content', 'category', ] as const) { @ApiProperty({ type: 'string', format: 'binary', required: false }) @IsOptional() image: Express.Multer.File; }