-
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
[Refactor] 장바구니 상품 추가 Dto 클래스 타입 record로 변경 및 ErrorCode 추가 #32
Conversation
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.
좋습니다 도형씨.
@@ -24,7 +22,6 @@ public class CartController { | |||
private final CartService cartService; | |||
|
|||
@PostMapping("/add") | |||
@ResponseStatus(HttpStatus.NO_CONTENT) |
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.
좋습니다.
@@ -37,7 +39,7 @@ public class CartService { | |||
public void addCartItem(CartItemAddRequestDto cartItemAddRequestDto, String userId) { | |||
|
|||
Member findMember = memberRepository.findByUserId(userId) | |||
.orElseThrow(() -> new IllegalArgumentException("존재하지 않는 회원입니다.")); | |||
.orElseThrow(() -> new BusinessException(ErrorCode.MEMBER_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.
좋아요.
@@ -53,16 +55,11 @@ public void addCartItem(CartItemAddRequestDto cartItemAddRequestDto, String user | |||
|
|||
// 해당 회원의 장바구니를 가져와서 상품을 추가 | |||
Cart findCart = cartRepository.findCartByMember_Id(memberId) |
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.
현재 설정은 PhysicalNamingStrategyStandardImpl 이거라 Repository 메서드도 findByMemberId로 바꾸면 될 듯!? 크게 상관은 없긴 하지만 통일한다면~~
(참고)
SpringPhysicalNamingStrategy(Default)
-> camel case를 underscore 형태로 변경
PhysicalNamingStrategyStandardImpl
-> 변수 이름을 그대로 사용
.cart(cart) | ||
.item(item) | ||
.count(count) | ||
.build(); |
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.
👍
💡 연관된 이슈
close #23
📝 작업 내용
💬 리뷰 요구 사항