Skip to content

Commit

Permalink
Merge pull request #66 from bandalgomsu/develop
Browse files Browse the repository at this point in the history
[fix] : 이미지 없이 업로드 가능하게 수정
  • Loading branch information
bandalgomsu authored Jun 4, 2024
2 parents edfccb4 + b848aea commit 1caac09
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public String uploadImage(MultipartFile multipart) {

public List<String> uploadImages(List<MultipartFile> multiparts) {
List<String> urls = new ArrayList<>();

multiparts.forEach(
multipart -> urls.add(uploadImage(multipart))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,19 @@ public ExhibitUploadResponse uploadExhibit(ExhibitUploadRequest request, Long us
.build();

Exhibit save = exhibitRepository.save(exhibit);
List<ExhibitImage> exhibitImages = new ArrayList<>();

s3Service.uploadImages(request.getImages()).forEach(
url -> {
ExhibitImage image = ExhibitImage.builder().url(url).build();
exhibit.addImage(image);
exhibitImages.add(image);
}
);
if (request.getImages() != null) {
List<ExhibitImage> exhibitImages = new ArrayList<>();

exhibitImageRepository.saveAll(exhibitImages);
s3Service.uploadImages(request.getImages()).forEach(
url -> {
ExhibitImage image = ExhibitImage.builder().url(url).build();
exhibit.addImage(image);
exhibitImages.add(image);
}
);

exhibitImageRepository.saveAll(exhibitImages);
}
log.info("[EXHIBITION] : {}님의 {} 업로드 성공", loginUser.getNickname(), exhibit.getTitle());

return ExhibitUploadResponse.builder().exhibitId(save.getId()).build();
Expand Down

0 comments on commit 1caac09

Please sign in to comment.