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

Fix: cart 못가져오는 오류 수정 #102

Merged
merged 1 commit into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public enum ExceptionCode {
ORDER_NOT_RECEIPT(400, "Order is not receipt."),
INVALID_INOUT(400, "Invalid inout."),
CART_NOT_EDITABLE(400, "Cart is not editable."),
COUPON_NOT_VALID(400, "Coupon is not valid.");
COUPON_NOT_VALID(400, "Coupon is not valid."),
NOT_MY_CART(400, "Not my cart.");

private int status;
private String message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,13 @@ private void verifyMyCart(UserInfo user, Cart cart) {
if (cart.getUserInfo().equals(user)) {
return;
}
throw new BusinessLogicException(ExceptionCode.CART_NOT_FOUND);
System.out.println("asdf");
throw new BusinessLogicException(ExceptionCode.NOT_MY_CART);
}

private Cart getCartId(UserInfo user, Long cartId) {
if (cartId == null) {
return getCart(user);
}
return cartRepository.findById(cartId).orElse(getCart(user));
return (cartId == null) ? getCart(user)
: cartRepository.findById(cartId).orElseGet(() -> getCart(user));
}

@Override
Expand Down