diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/card/service/CardService.java b/src/main/java/org/prgrms/nabimarketbe/domain/card/service/CardService.java index 9124bfa6..134c7712 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/card/service/CardService.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/card/service/CardService.java @@ -58,11 +58,16 @@ public CardCreateResponseDTO save( try { thumbnailUrl = cardImageService.uploadImageUrl(card.getCardId(), thumbnail); } catch (IOException e) { - throw new RuntimeException(e); + throw new RuntimeException("썸네일 이미지 업로드를 실패하였습니다."); } savedCard.setThumbNailImage(thumbnailUrl); - List savedCardImages = cardImageService.uploadImageUrlList(card.getCardId(),files); // TODO: bulk insert 로 전환 + List savedCardImages = null; // TODO: bulk insert 로 전환 + try { + savedCardImages = cardImageService.uploadImageUrlList(card.getCardId(),files); + } catch (IOException e) { + throw new RuntimeException("카드 상세 이미지 업로드를 실패하였습니다."); + } savedCardImages.add(0, CardImage.builder() .imageUrl(thumbnailUrl) diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/cardimage/service/CardImageService.java b/src/main/java/org/prgrms/nabimarketbe/domain/cardimage/service/CardImageService.java index 50cd5ddf..726bf002 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/cardimage/service/CardImageService.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/cardimage/service/CardImageService.java @@ -39,17 +39,13 @@ public String uploadImageUrl(Long cardId, MultipartFile file) throws IOException } @Transactional - public List uploadImageUrlList(Long cardId, List files) { + public List uploadImageUrlList(Long cardId, List files) throws IOException { Card card = cardRepository.findById(cardId) .orElseThrow(() -> new RuntimeException("해당 카드가 존재하지 않습니다")); List uploadFileList = null; - try { - uploadFileList = s3FileUploadService.uploadFileList(files); - } catch (IOException e) { - throw new RuntimeException(e); - } + uploadFileList = s3FileUploadService.uploadFileList(files); List cardImageList = new ArrayList<>();