diff --git a/src/main/java/trothly/trothcam/controller/web/CertificateController.java b/src/main/java/trothly/trothcam/controller/web/CertificateController.java index 8a0f76d..b0b4165 100644 --- a/src/main/java/trothly/trothcam/controller/web/CertificateController.java +++ b/src/main/java/trothly/trothcam/controller/web/CertificateController.java @@ -1,6 +1,7 @@ package trothly.trothcam.controller.web; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.*; import trothly.trothcam.domain.member.Member; @@ -14,6 +15,7 @@ import java.util.List; +@Slf4j @RestController @RequiredArgsConstructor @RequestMapping("/api/products") diff --git a/src/main/java/trothly/trothcam/service/web/CertificateService.java b/src/main/java/trothly/trothcam/service/web/CertificateService.java index b206fbc..5ed7dc4 100644 --- a/src/main/java/trothly/trothcam/service/web/CertificateService.java +++ b/src/main/java/trothly/trothcam/service/web/CertificateService.java @@ -3,6 +3,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import trothly.trothcam.domain.history.History; import trothly.trothcam.domain.history.HistoryRepository; import trothly.trothcam.domain.image.Image; @@ -36,14 +37,21 @@ public class CertificateService { private final HistoryRepository historyRepository; // 공개 인증서 비공개 인증서로 변환 (비공개하기[판매취소] 클릭 시) +// { +// "isSuccess": false, +// "code": 500, +// "message": "Failed to convert value of type 'java.lang.String' to required type 'java.lang.Long'; nested exception is java.lang.NumberFormatException: For input string: \"undefined\"" +// } + @Transactional public List getPrivateCertificates(Member member, Long productId) { + log.info("서비스 드루옴"); Optional getProduct = productRepository.findById(productId); if(getProduct.isEmpty()) throw new BaseException(ErrorCode.PRODUCT_NOT_FOUND); Product product = getProduct.get(); product.updatePublicYn(PublicYn.N); // 1. 해당 인증서 비공개로 전환 - productRepository.save(product); + // productRepository.save(product); List productList = productRepository.findAllByMemberAndPublicYn(member, PublicYn.N); // 2. 비공개 리스트 조회 List productDtoList = productList.stream() @@ -55,10 +63,11 @@ public List getPrivateCertificates(Member member, Long productId) { Optional getLikeProduct = likeProductRepository.findByProductAndMember(p, p.getMember()); boolean isLiked = getLikeProduct.isPresent(); + log.info("잘 됨요"); return new ProductDto(p, webToken, isLiked); }) .collect(Collectors.toList()); - + log.info("리턴 직전"); return productDtoList; }