Skip to content

Commit

Permalink
#103 fix: deleteImageUrls null처리 (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
yonghwankim-dev authored Sep 22, 2023
1 parent 4497d32 commit 03eb9bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package codesquard.app.api.item;

import java.util.ArrayList;
import java.util.List;

import javax.validation.Valid;
Expand Down Expand Up @@ -71,6 +72,9 @@ public ApiResponse<Void> modifyItem(@PathVariable Long itemId,
@Valid @RequestPart("item") ItemModifyRequest request,
@RequestPart(value = "thumbnailImage", required = false) MultipartFile thumbnailImage,
@AuthPrincipal Principal principal) {
if (addImages == null) {
addImages = new ArrayList<>();
}
itemService.modifyItem(itemId, request, addImages, thumbnailImage, principal);
return ApiResponse.ok("상품 수정을 완료하였습니다.", null);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package codesquard.app.api.item;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -106,6 +107,9 @@ public void modifyItem(Long itemId, ItemModifyRequest request, List<MultipartFil
log.debug("상품 수정 서비스의 이미지 테이블 저장 결과 : {}", saveImages);

List<String> deleteImageUrls = request.getDeleteImageUrls();
if (deleteImageUrls == null) {
deleteImageUrls = new ArrayList<>();
}
int deleteImageSize = deleteImages(itemId, deleteImageUrls);
log.debug("이미지 테이블의 삭제 결과 : 삭제 개수={}", deleteImageSize);

Expand Down

0 comments on commit 03eb9bd

Please sign in to comment.