-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat] #78 - 좋아요, 좋아요 해제 기능 구현 #79
Conversation
src/main/java/com/napzak/domain/product/core/ProductRepository.java
Outdated
Show resolved
Hide resolved
src/main/java/com/napzak/domain/interest/core/InterestSaver.java
Outdated
Show resolved
Hide resolved
src/main/java/com/napzak/domain/interest/core/InterestSaver.java
Outdated
Show resolved
Hide resolved
src/main/java/com/napzak/domain/interest/core/InterestRemover.java
Outdated
Show resolved
Hide resolved
src/main/java/com/napzak/domain/interest/core/InterestProductFacade.java
Outdated
Show resolved
Hide resolved
src/main/java/com/napzak/domain/interest/api/controller/InterestController.java
Outdated
Show resolved
Hide resolved
각 계층의 역할분리 관련 코멘트 달았습니다! 그렇게 무거운 pr은 아니라서 금방 코멘트 반영 가능하실 것 같네요ㅎㅎ 반영 부탁드립니다 |
@Transactional | ||
public void decrementInterestCount(Long productId) { | ||
productRepository.decrementInterestCount(productId); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
decrementInterestCount는 product의 interestCount만 바꾸는 메소드이므로 ProductRemover보다는 ProductUpdater에 있는 게 적절할 것 같습니다!
import com.napzak.domain.product.api.exception.ProductErrorCode; | ||
import com.napzak.domain.product.core.ProductRetriever; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ProductRetriever를 호출해야하는 건 facade로 불러옵시다!
그리고 ErrorCode는 InterestErrorCode 만들어서 거기안에 코드 정의하면 좋을 것 같습니다
if (!productRetriever.existsById(productId)) { //존재하지 않는 product | ||
throw new NapzakException(ProductErrorCode.PRODUCT_NOT_FOUND); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
밑에서 interest의 존재 여부를 확인하기 때문에 product의 존재 여부 검증은 필요치 않을 것 같습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
좋아요~
Related issue 🛠
Work Description ✏️
좋아요를 누른 상태에서 다시 요청을 보낼 수 없도록 하였습니다.
좋아요를 누르지 않은 상태에서 좋아요 해제를 할 수 없도록 하였습니다.
좋아요를 누르면 product의 interestCount를 증가시킵니다.
좋아요를 해제하면 감소시킵니다.
Trouble Shooting ⚽️
Related ScreenShot 📷
Uncompleted Tasks 😅
To Reviewers 📢