Skip to content

Commit

Permalink
Merge pull request #31 from MARKETFUBY/revert-28-feat/product-detail
Browse files Browse the repository at this point in the history
Revert "[차소연] 상품 상세 조회에 후기 이미지 리스트 추가"
  • Loading branch information
Soyeon-Cha authored Nov 26, 2023
2 parents 9b2e1e2 + 60a9b68 commit 600b72e
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 47 deletions.
5 changes: 1 addition & 4 deletions src/main/java/MARKETFUBY/Product/dto/ProductDetailDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import MARKETFUBY.Product.domain.Packing;
import MARKETFUBY.Product.domain.Product;
import MARKETFUBY.ReviewImage.domain.ReviewImage;
import lombok.*;

import java.util.List;
Expand All @@ -28,13 +27,12 @@ public class ProductDetailDto {
private Boolean isLiked;
private String detailInfoImg;
private String productInfoImg;
private List<ProductReviewImageDto> reviewImages;
private Integer reviewCount;
private List<ProductReviewDto> reviews;
private List<ProductInquiryDto> inquiries;

@Builder
public ProductDetailDto(Product product, List<ProductReviewImageDto> reviewImages, Integer reviewCount, List<ProductReviewDto> reviews, List<ProductInquiryDto> inquiries){
public ProductDetailDto(Product product, Integer reviewCount, List<ProductReviewDto> reviews, List<ProductInquiryDto> inquiries){
this.image = product.getImage();
this.title = product.getTitle();
this.subtitle = product.getSubtitle();
Expand All @@ -51,7 +49,6 @@ public ProductDetailDto(Product product, List<ProductReviewImageDto> reviewImage
this.seller = product.getSeller();
this.detailInfoImg = product.getDetailInfoImg();
this.productInfoImg = product.getProductInfoImg();
this.reviewImages = reviewImages;
this.reviewCount = reviewCount;
this.reviews = reviews;
this.inquiries = inquiries;
Expand Down
21 changes: 0 additions & 21 deletions src/main/java/MARKETFUBY/Product/dto/ProductReviewImageDto.java

This file was deleted.

16 changes: 1 addition & 15 deletions src/main/java/MARKETFUBY/Product/service/ProductService.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
import MARKETFUBY.Review.domain.Review;
import MARKETFUBY.Review.dto.ReviewResponseDto;
import MARKETFUBY.ReviewHelp.repository.ReviewHelpRepository;
import MARKETFUBY.ReviewImage.domain.ReviewImage;
import MARKETFUBY.ReviewImage.repository.ReviewImageRepository;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
Expand All @@ -41,7 +39,6 @@ public class ProductService {
private final InquiryRepository inquiryRepository;
private final ReviewHelpRepository reviewHelpRepository;
private final MemberRepository memberRepository;
private final ReviewImageRepository reviewImageRepository;

public MainDto getMainList(){
MainDto mainDto=new MainDto();
Expand Down Expand Up @@ -215,24 +212,13 @@ public SearchDto getSearchList(String sword, Integer sort, Long filters){
}

public ProductDetailDto getProductDetailDto(Product product, Long memberId){
List<ProductReviewImageDto> reviewImages = findReviewImagesByProduct(product);
List<ProductReviewDto> reviews = findReviewsByProduct(product, memberId);
Integer reviewCount = reviews.size();
List<ProductInquiryDto> inquiries = findInquiriesByProduct(product);
ProductDetailDto productDetailDto = new ProductDetailDto(product, reviewImages, reviewCount, reviews, inquiries);
ProductDetailDto productDetailDto = new ProductDetailDto(product, reviewCount, reviews, inquiries);
return productDetailDto;
}

public List<ProductReviewImageDto> findReviewImagesByProduct(Product product) {
List<ReviewImage> reviewImageList = reviewImageRepository.findAllByProduct(product);
List<ProductReviewImageDto> productReviewImageDtos = new ArrayList<>();
reviewImageList.forEach(reviewImage -> {
ProductReviewImageDto productReviewImageDto = ProductReviewImageDto.from(reviewImage);
productReviewImageDtos.add(productReviewImageDto);
});
return productReviewImageDtos;
}

public List<ProductReviewDto> findReviewsByProduct(Product product, Long memberId){
List<Review> reviewList = reviewRepository.findAllByProduct(product);
List<ProductReviewDto> productReviewDtos = new ArrayList<>();
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/MARKETFUBY/ReviewImage/domain/ReviewImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import MARKETFUBY.Product.domain.Product;
import MARKETFUBY.Review.domain.Review;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import javax.persistence.*;
Expand All @@ -22,7 +21,6 @@ public class ReviewImage {
@JoinColumn(name = "review_id", nullable = false)
private Review review;

@Getter
@Column
private String url;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
package MARKETFUBY.ReviewImage.repository;

import MARKETFUBY.Inquiry.domain.Inquiry;
import MARKETFUBY.Product.domain.Product;
import org.springframework.data.jpa.repository.JpaRepository;

import MARKETFUBY.ReviewImage.domain.ReviewImage;

import java.util.List;

public interface ReviewImageRepository extends JpaRepository<ReviewImage, Long> {
List<ReviewImage> findAllByProduct(Product product);
}

0 comments on commit 600b72e

Please sign in to comment.