diff --git a/src/main/java/MARKETFUBY/Product/dto/ProductDetailDto.java b/src/main/java/MARKETFUBY/Product/dto/ProductDetailDto.java index dc1cbaa..ef861d0 100644 --- a/src/main/java/MARKETFUBY/Product/dto/ProductDetailDto.java +++ b/src/main/java/MARKETFUBY/Product/dto/ProductDetailDto.java @@ -33,7 +33,7 @@ public class ProductDetailDto { private List inquiries; @Builder - public ProductDetailDto(Product product, List reviewImages, Integer reviewCount, List reviews, List inquiries){ + public ProductDetailDto(Product product, boolean isLiked, List reviewImages, Integer reviewCount, List reviews, List inquiries){ this.image = product.getImage(); this.title = product.getTitle(); this.subtitle = product.getSubtitle(); @@ -48,6 +48,7 @@ public ProductDetailDto(Product product, List reviewImages, Integer revi this.info = product.getInfo(); this.delivery = product.getDelivery(); this.seller = product.getSeller(); + this.isLiked = isLiked; this.detailInfoImg = product.getDetailInfoImg(); this.productInfoImg = product.getProductInfoImg(); this.reviewImages = reviewImages; diff --git a/src/main/java/MARKETFUBY/Product/service/ProductService.java b/src/main/java/MARKETFUBY/Product/service/ProductService.java index 06c7d4b..f3bf0cd 100644 --- a/src/main/java/MARKETFUBY/Product/service/ProductService.java +++ b/src/main/java/MARKETFUBY/Product/service/ProductService.java @@ -214,11 +214,13 @@ public SearchDto getSearchList(String sword, Integer sort, Long filters){ } public ProductDetailDto getProductDetailDto(Product product, Long memberId){ + Member member = memberRepository.findByMemberId(memberId); + boolean isLiked = likeRepository.existsByMemberAndProduct(member,product); List reviewImages = findReviewImagesByProduct(product); List reviews = findReviewsByProduct(product, memberId); Integer reviewCount = reviews.size(); List inquiries = findInquiriesByProduct(product); - ProductDetailDto productDetailDto = new ProductDetailDto(product, reviewImages, reviewCount, reviews, inquiries); + ProductDetailDto productDetailDto = new ProductDetailDto(product, isLiked, reviewImages, reviewCount, reviews, inquiries); return productDetailDto; }