Skip to content
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

Merged
merged 15 commits into from
Jan 21, 2025

Conversation

sae2say
Copy link
Collaborator

@sae2say sae2say commented Jan 19, 2025

Related issue 🛠

Work Description ✏️

좋아요를 누른 상태에서 다시 요청을 보낼 수 없도록 하였습니다.
좋아요를 누르지 않은 상태에서 좋아요 해제를 할 수 없도록 하였습니다.

좋아요를 누르면 product의 interestCount를 증가시킵니다.
좋아요를 해제하면 감소시킵니다.

Trouble Shooting ⚽️

Related ScreenShot 📷

image

image

Uncompleted Tasks 😅

To Reviewers 📢

@hyerinhwang-sailin
Copy link
Collaborator

각 계층의 역할분리 관련 코멘트 달았습니다! 그렇게 무거운 pr은 아니라서 금방 코멘트 반영 가능하실 것 같네요ㅎㅎ 반영 부탁드립니다
POST 좋아요~

Comment on lines 14 to 17
@Transactional
public void decrementInterestCount(Long productId) {
productRepository.decrementInterestCount(productId);
}
Copy link
Collaborator

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에 있는 게 적절할 것 같습니다!

Comment on lines 9 to 10
import com.napzak.domain.product.api.exception.ProductErrorCode;
import com.napzak.domain.product.core.ProductRetriever;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ProductRetriever를 호출해야하는 건 facade로 불러옵시다!
그리고 ErrorCode는 InterestErrorCode 만들어서 거기안에 코드 정의하면 좋을 것 같습니다

Comment on lines 35 to 37
if (!productRetriever.existsById(productId)) { //존재하지 않는 product
throw new NapzakException(ProductErrorCode.PRODUCT_NOT_FOUND);
}
Copy link
Collaborator

@hyerinhwang-sailin hyerinhwang-sailin Jan 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

밑에서 interest의 존재 여부를 확인하기 때문에 product의 존재 여부 검증은 필요치 않을 것 같습니다!

Copy link
Collaborator

@hyerinhwang-sailin hyerinhwang-sailin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋아요~

@hyerinhwang-sailin hyerinhwang-sailin merged commit 725e1d7 into develop Jan 21, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] 좋아요/좋아요 해제 api 구현
2 participants