diff --git a/src/main/java/MARKETFUBY/Product/dto/ProductReviewDto.java b/src/main/java/MARKETFUBY/Product/dto/ProductReviewDto.java index 61982b4..424bc8c 100644 --- a/src/main/java/MARKETFUBY/Product/dto/ProductReviewDto.java +++ b/src/main/java/MARKETFUBY/Product/dto/ProductReviewDto.java @@ -1,14 +1,12 @@ package MARKETFUBY.Product.dto; import MARKETFUBY.Review.domain.Review; -import MARKETFUBY.ReviewImage.domain.ReviewImage; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Getter; import java.time.LocalDate; -import java.util.List; @Getter @Builder @@ -19,18 +17,17 @@ public class ProductReviewDto { private String brand; private String title; private String content; - private List imageList; + // private String imgUrl; private LocalDate date; private Boolean isReviewHelp; - public static ProductReviewDto from(Review review, List images, Boolean isReviewHelp){ + public static ProductReviewDto from(Review review, Boolean isReviewHelp){ return ProductReviewDto.builder() .name(review.getWriter().getName()) .level(review.getWriter().getLevel()) .brand(review.getProduct().getBrand()) .title(review.getProduct().getTitle()) .content(review.getContent()) - .imageList(images) .date(review.getCreatedAt().toLocalDate()) .isReviewHelp(isReviewHelp) .build(); diff --git a/src/main/java/MARKETFUBY/Product/service/ProductService.java b/src/main/java/MARKETFUBY/Product/service/ProductService.java index 072e407..8561d39 100644 --- a/src/main/java/MARKETFUBY/Product/service/ProductService.java +++ b/src/main/java/MARKETFUBY/Product/service/ProductService.java @@ -237,25 +237,19 @@ public List findReviewsByProduct(Product product, Long memberI List reviewList = reviewRepository.findAllByProduct(product); List productReviewDtos = new ArrayList<>(); reviewList.forEach(review -> { - List images = findImagesByReview(review); Member member = memberRepository.findByMemberId(memberId); if (member != null) { Boolean isReviewHelp = reviewHelpRepository.existsByMemberAndReview(member, review); - ProductReviewDto productReviewDto = ProductReviewDto.from(review, images, isReviewHelp); + ProductReviewDto productReviewDto = ProductReviewDto.from(review, isReviewHelp); productReviewDtos.add(productReviewDto); } else { - ProductReviewDto productReviewDto = ProductReviewDto.from(review, images, false); + ProductReviewDto productReviewDto = ProductReviewDto.from(review, false); productReviewDtos.add(productReviewDto); } }); return productReviewDtos; } - public List findImagesByReview(Review review){ - List imageList = reviewImageRepository.findAllByReview(review); - return imageList; - } - public List findInquiriesByProduct(Product product){ List inquiryList = inquiryRepository.findAllByProduct(product); List productInquiryDtos = new ArrayList<>(); diff --git a/src/main/java/MARKETFUBY/ReviewImage/domain/ReviewImage.java b/src/main/java/MARKETFUBY/ReviewImage/domain/ReviewImage.java index 8e90ba1..05be640 100644 --- a/src/main/java/MARKETFUBY/ReviewImage/domain/ReviewImage.java +++ b/src/main/java/MARKETFUBY/ReviewImage/domain/ReviewImage.java @@ -18,7 +18,6 @@ public class ReviewImage { @Column(name = "image_id", updatable = false) private Long imageId; - @Getter @ManyToOne @JoinColumn(name = "review_id", nullable = false) private Review review; diff --git a/src/main/java/MARKETFUBY/ReviewImage/repository/ReviewImageRepository.java b/src/main/java/MARKETFUBY/ReviewImage/repository/ReviewImageRepository.java index 0cca214..e07773b 100644 --- a/src/main/java/MARKETFUBY/ReviewImage/repository/ReviewImageRepository.java +++ b/src/main/java/MARKETFUBY/ReviewImage/repository/ReviewImageRepository.java @@ -2,7 +2,6 @@ import MARKETFUBY.Inquiry.domain.Inquiry; import MARKETFUBY.Product.domain.Product; -import MARKETFUBY.Review.domain.Review; import org.springframework.data.jpa.repository.JpaRepository; import MARKETFUBY.ReviewImage.domain.ReviewImage; @@ -11,5 +10,4 @@ public interface ReviewImageRepository extends JpaRepository { List findAllByProduct(Product product); - List findAllByReview(Review review); }