Skip to content

Commit

Permalink
Merge pull request #55 from UMC-neoul/develop
Browse files Browse the repository at this point in the history
상품찜 관련 코드 수정
  • Loading branch information
sujinyang00 authored Aug 21, 2023
2 parents ada0ac1 + 2c180b9 commit 2a27990
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/example/neoul/controller/MyController.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ public ApiResponse<BrandRes.getLikedBrandRes> getUserLikedBrand(){
@PatchMapping("/product/like/{productId}")
public ApiResponse<String> likeProduct(@PathVariable("productId") Long productId){
productService.likeProduct(productId);
return new ApiResponse("브랜드를 찜했습니다");
return new ApiResponse("상품을 찜했습니다");
}


@ApiOperation(value = "상품 찜 취소하기", notes = "상품 찜 취소하기")
@PatchMapping("/product/dislike/{productId}")
public ApiResponse<String> deleteLikedProduct(@PathVariable("productId") Long productId){
productService.deleteLikedProduct(productId);
return new ApiResponse("브랜드 찜이 취소가 되었습니다");
return new ApiResponse("상품 찜이 취소가 되었습니다");
}


Expand Down
13 changes: 13 additions & 0 deletions src/main/java/com/example/neoul/service/ProductService.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,22 @@ public ProductRes.getLikedProductRes getUserLikedProduct() {
List<ProductRes.LikedProductList> list = new ArrayList<>();

for(UserLikedProduct userLikedProduct : userLikedProductList){
List<ProductImage> images = productImageRepository.findAllByProduct(userLikedProduct.getProduct());
List<String> productImgList = new ArrayList<>();

for(ProductImage productImage : images){
productImgList.add(productImage.getUrl());
}

ProductRes.LikedProductList e = ProductRes.LikedProductList.builder()
.productId(userLikedProduct.getProduct().getId())
.productName(userLikedProduct.getProduct().getName())
.productImgList(productImgList)
.brandId(userLikedProduct.getProduct().getBrand().getId())
.brandName(userLikedProduct.getProduct().getBrand().getName())
.price(userLikedProduct.getProduct().getPrice())
.discountedRatio(userLikedProduct.getProduct().getDiscountedRatio())
.discountedSalePrice(userLikedProduct.getProduct().getDiscountedSalePrice())
.build();
list.add(e);
}
Expand Down

0 comments on commit 2a27990

Please sign in to comment.