-
Notifications
You must be signed in to change notification settings - Fork 0
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
feature: 봉달 관련 api 스펙 수정 #106
The head ref may contain hidden characters: "102-feature-\uBD09\uB2EC-\uAD00\uB828-api-\uC2A4\uD399-\uC218\uC815"
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.
리뷰가 늦어 죄송합니다!
몇 가지 코멘트 남겨두었어요
고생하셨습니다 화이팅입니다 😃
) | ||
} | ||
|
||
// applications |
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.
주석 좋네요!
private fun validateDeliveryFee(productId: Long, deliveryMethod: DeliveryMethod, deliveryFee: BigDecimal) { | ||
productRepository.findByIdOrThrow(productId, ProductException(NOT_FOUND_PRODUCT)) | ||
.getDeliveryFee(deliveryMethod) | ||
.also { throwExceptionWhen(it != deliveryFee) { CartProductException(DIFFERENT_DELIVERY_FEE) } } |
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.
위에서 exist 으로 조회하지 않고 직접 Product 를 꺼내 놓았다가 사용하는 것은 어떨까요?
val productId = productRepository.save( | ||
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.
봉달 상품 옵션 수정 시, 상품에 존재하지 않는 옵션으로도 수정할 수 있는 것 같습니다...!
@@ -35,9 +43,10 @@ class CartProductService( | |||
validateDuplicatedProduct( | |||
memberId = command.memberId, | |||
productId = command.productId, | |||
isMale = command.isMale, | |||
sex = command.sex, |
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.
봉달 저장 시 상품에 존재하지 않는 옵션으로도 저장할 수 있는 것 같습니다.
FEMALE, MALE 만 존재하는 상품인데, HERMAPHRODITE 으로 봉달 저장하는 거요,,!
fun saveCartProductCommand( | ||
memberId: Long = 0L, | ||
productId: Long = 0L, | ||
quantity: Int = 1, | ||
sex: Sex = MALE, | ||
deliveryMethod: DeliveryMethod = COMMON, | ||
deliveryFee: BigDecimal = 3000.toBigDecimal(), | ||
): SaveCartProductCommand { | ||
return SaveCartProductCommand( | ||
memberId = 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.
픽스쳐 좋네요! 👍
@@ -24,7 +23,7 @@ fun saveOrderCommand( | |||
shippingAddressId = shippingAddressId, | |||
shippingRequest = shippingRequest, | |||
orderProductCommands = orderProductCommands, | |||
totalAmount = totalAmount.setScale(DEFAULT_SCALE), | |||
totalAmount = totalAmount.setDefaultScale(), |
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.
얘 때문에 열받아 죽을뻔 했어요..ㅋㅋㅋㅋ
홍고 화이팅
|
||
DIFFERENT_DELIVERY_FEE(httpStatus = BAD_REQUEST, code = "CP40", errorMessage = "잘못된 배송비입니다."), |
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.
👍
@@ -83,7 +83,7 @@ class CartProductController( | |||
@GetMapping | |||
fun readAll( | |||
@Auth loginMember: LoginMember, | |||
): ResponseEntity<List<CartProductResponse>> { | |||
): ResponseEntity<List<CartProductWithSupportedOptionResponse>> { |
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.
멋집니당 👍
api 테스트 하면서 한 가지 발견한 게 있는데요,,
위에 save 메서드에 response 가 잘못된 것 같아요
@Combi153 |
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.
고생하셨습니다!!!
val productOptions = productOptionRepository.findAllByProductId(productId) | ||
val maleAdditionalPrice = productOptions.find { it.sex == MALE }?.additionalPrice | ||
val femaleAdditionalPrice = productOptions.find { it.sex == FEMALE }?.additionalPrice |
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.
👍 감사합니다
📌 관련 이슈
📁 작업 설명
봉달 목록 관련하여 응답 데이터를 수정하였습니다.
AS-IS
TO-BE
성별이 단순 boolean이 아닌 Enum으로 변경됨에 따라 필드값이 수정 되었습니다.
승훈님과 논의 후, 봉달 목록에서 옵션 변경 시 지원되는 옵션(성별, 운송 정보)을 표현하기 위해 [safeDeliveryFee, commonDeliveryFee, maleAdditionalPrice] 등이 추가 되었습니다.
운송방식과 동일하게
maleAdditionalPrice
가 null인 경우 지원하지 않는 것으로 간주합니다.기타
자웅동체인 경우 maleAdditionalPrice과 femaleAdditionalPrice 모두 null 값이 응답됩니다.
성별 옵션 선택이 존재하지 않기 때문에 추가금액 역시 의미없는 값이라 생각했습니다. (상품 가격만으로도 표현 가능)