Skip to content

Commit

Permalink
fix: set default value of createNotice dto
Browse files Browse the repository at this point in the history
  • Loading branch information
2paperstar committed Nov 22, 2023
1 parent 1beacc6 commit 499d4f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/notice/dto/createNotice.dto.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Type } from 'class-transformer';
import {
IsString,
IsOptional,
IsNumber,
IsNotEmpty,
IsDate,
IsNotEmpty,
IsNumber,
IsOptional,
IsString,
MaxLength,
} from 'class-validator';

Expand All @@ -25,9 +25,9 @@ export class CreateNoticeDto {

@IsNumber({}, { each: true })
@IsOptional()
tags?: number[];
tags: number[] = [];

@IsString({ each: true })
@IsOptional()
images?: string[];
images: string[] = [];
}
2 changes: 1 addition & 1 deletion src/notice/notice.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class NoticeService {
{ title, body, deadline, tags, images }: CreateNoticeDto,
userUuid: string,
) {
if (images) {
if (images.length) {
await this.imageService.validateImages(images);
}

Expand Down

0 comments on commit 499d4f3

Please sign in to comment.