Skip to content

Commit

Permalink
Merge pull request #43 from MARKETFUBY/feat/like
Browse files Browse the repository at this point in the history
[차소연] 상세 정보 isLiked 오류 수정
  • Loading branch information
Soyeon-Cha authored Nov 26, 2023
2 parents 16691c1 + 23292b0 commit 968d684
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/main/java/MARKETFUBY/Product/dto/ProductDetailDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class ProductDetailDto {
private List<ProductInquiryDto> inquiries;

@Builder
public ProductDetailDto(Product product, List<String> reviewImages, Integer reviewCount, List<ProductReviewDto> reviews, List<ProductInquiryDto> inquiries){
public ProductDetailDto(Product product, boolean isLiked, List<String> reviewImages, Integer reviewCount, List<ProductReviewDto> reviews, List<ProductInquiryDto> inquiries){
this.image = product.getImage();
this.title = product.getTitle();
this.subtitle = product.getSubtitle();
Expand All @@ -48,6 +48,7 @@ public ProductDetailDto(Product product, List<String> 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;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/MARKETFUBY/Product/service/ProductService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> 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, isLiked, reviewImages, reviewCount, reviews, inquiries);
return productDetailDto;
}

Expand Down

0 comments on commit 968d684

Please sign in to comment.