diff --git a/src/main/java/leets/weeth/domain/board/application/dto/PostDTO.java b/src/main/java/leets/weeth/domain/board/application/dto/PostDTO.java index 0ca4b5e2..918c21a3 100644 --- a/src/main/java/leets/weeth/domain/board/application/dto/PostDTO.java +++ b/src/main/java/leets/weeth/domain/board/application/dto/PostDTO.java @@ -24,7 +24,7 @@ public record Save( public record Update( @NotNull String title, @NotNull String content, - @Valid List<@NotNull FileUpdateRequest> files + @Valid List<@NotNull FileSaveRequest> files ){} @Builder diff --git a/src/main/java/leets/weeth/domain/board/application/usecase/PostUseCaseImpl.java b/src/main/java/leets/weeth/domain/board/application/usecase/PostUseCaseImpl.java index 0da7dc3f..552d69f7 100644 --- a/src/main/java/leets/weeth/domain/board/application/usecase/PostUseCaseImpl.java +++ b/src/main/java/leets/weeth/domain/board/application/usecase/PostUseCaseImpl.java @@ -98,8 +98,10 @@ public void update(Long postId, PostDTO.Update dto, Long userId) { Post post = validateOwner(postId, userId); List fileList = getFiles(postId); + fileDeleteService.delete(fileList); - fileUpdateService.updateFiles(fileList, dto.files()); + List files = fileMapper.toFileList(dto.files(), post); + fileSaveService.save(files); postUpdateService.update(post, dto); }