Skip to content

Commit

Permalink
Merge pull request #194 from BETTER-iTER/feature/193
Browse files Browse the repository at this point in the history
[Feature/193] 리뷰 수정 image 저장 관련 문제 해결
  • Loading branch information
luke0408 authored Mar 5, 2024
2 parents 2adecaf + 2f4c4df commit 7c8ffad
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ public void updateReview(Long reviewId, UpdateReviewRequestDto request) {

reviewRepository.save(review);

this.clearS3ReviewImage(review);
// this.clearS3ReviewImage(review);
}

private void clearS3ReviewImage(Review review) {
Expand All @@ -457,10 +457,13 @@ private void updateReviewImages(Review review, List<String> imageList) {
List<ReviewImage> nowReviewImages = review.getReviewImages();
reviewImageRepository.deleteAll(nowReviewImages);

List<ReviewImage> newReviewImages = imageList.stream()
.map(image -> ReviewImage.createReviewImage(review, image, imageList.indexOf(image)))
.collect(Collectors.toList());
reviewImageRepository.saveAll(newReviewImages);
for (int i = 0; i < imageList.size(); i++) {
reviewImageRepository.save(ReviewImage.builder()
.review(review)
.imgUrl(imageList.get(i))
.orderNum(i)
.build());
}
}

private void updateReviewSpecData(Review review, List<ReviewSpecData> nowReviewSpecDataList,
Expand Down

0 comments on commit 7c8ffad

Please sign in to comment.