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

feature: 봉달 관련 api 스펙 수정 #106

Merged
merged 6 commits into from
Feb 27, 2024

Conversation

TaeyeonRoyce
Copy link
Member

📌 관련 이슈

📁 작업 설명

  • 설명
    봉달 목록 관련하여 응답 데이터를 수정하였습니다.

AS-IS

{
    "id": 3,
    "storeName": "store",
    "productId": 3,
    "productName": "쿠아3",
    "productThumbnailUrl": "image.jpg",
    "productPrice": 1,
    "productDiscountRate": 0,
    "productDiscountPrice": 1,
    "quantity": 1,
    "isMale": true,
    "deliveryMethod": "COMMON",
    "isOnSale": true
},

TO-BE

{
    "id": 3,
    "storeName": "store",
    "productId": 3,
    "productName": "쿠아3",
    "productThumbnailUrl": "image.jpg",
    "productPrice": 1,
    "productDiscountRate": 0,
    "productDiscountPrice": 1,
    "quantity": 1,
    "sex": "MALE",
    "deliveryMethod": "COMMON",
    "deliveryFee": 3000.00,
    "isOnSale": true,
    "safeDeliveryFee": null,
    "commonDeliveryFee": 3000.00,
    "pickUpDeliveryFee": null,
    "maleAdditionalPrice": 0.00,
    "femaleAdditionalPrice": 3000.00
},

성별이 단순 boolean이 아닌 Enum으로 변경됨에 따라 필드값이 수정 되었습니다.
승훈님과 논의 후, 봉달 목록에서 옵션 변경 시 지원되는 옵션(성별, 운송 정보)을 표현하기 위해 [safeDeliveryFee, commonDeliveryFee, maleAdditionalPrice] 등이 추가 되었습니다.
운송방식과 동일하게 maleAdditionalPrice가 null인 경우 지원하지 않는 것으로 간주합니다.

기타

자웅동체인 경우 maleAdditionalPrice과 femaleAdditionalPrice 모두 null 값이 응답됩니다.
성별 옵션 선택이 존재하지 않기 때문에 추가금액 역시 의미없는 값이라 생각했습니다. (상품 가격만으로도 표현 가능)

Copy link
Contributor

@Combi153 Combi153 left a comment

Choose a reason for hiding this comment

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

리뷰가 늦어 죄송합니다!
몇 가지 코멘트 남겨두었어요
고생하셨습니다 화이팅입니다 😃

)
}

// applications
Copy link
Contributor

Choose a reason for hiding this comment

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

주석 좋네요!

Comment on lines 74 to 77
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) } }
Copy link
Contributor

Choose a reason for hiding this comment

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

위에서 exist 으로 조회하지 않고 직접 Product 를 꺼내 놓았다가 사용하는 것은 어떨까요?

Comment on lines +166 to +167
val productId = productRepository.save(
product(
Copy link
Contributor

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,
Copy link
Contributor

Choose a reason for hiding this comment

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

봉달 저장 시 상품에 존재하지 않는 옵션으로도 저장할 수 있는 것 같습니다.

FEMALE, MALE 만 존재하는 상품인데, HERMAPHRODITE 으로 봉달 저장하는 거요,,!

Comment on lines +37 to +46
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,
Copy link
Contributor

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(),
Copy link
Contributor

Choose a reason for hiding this comment

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

얘 때문에 열받아 죽을뻔 했어요..ㅋㅋㅋㅋ
홍고 화이팅

Comment on lines +24 to +25

DIFFERENT_DELIVERY_FEE(httpStatus = BAD_REQUEST, code = "CP40", errorMessage = "잘못된 배송비입니다."),
Copy link
Contributor

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>> {
Copy link
Contributor

Choose a reason for hiding this comment

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

멋집니당 👍

api 테스트 하면서 한 가지 발견한 게 있는데요,,
위에 save 메서드에 response 가 잘못된 것 같아요

Copy link

Test Results

 34 files  ±0   34 suites  ±0   20s ⏱️ +2s
164 tests ±0  164 ✅ ±0  0 💤 ±0  0 ❌ ±0 
228 runs  +5  228 ✅ +5  0 💤 ±0  0 ❌ ±0 

Results for commit 3075f97. ± Comparison against base commit e091746.

@TaeyeonRoyce
Copy link
Member Author

@Combi153
말씀주신 리뷰 반영했습니다!
추가로 상품 상세 조회 시, 봉달 목록과 동일하게 성별에 따른 추가금액 정보도 응답값에 포함하였습니다!

Copy link
Contributor

@Combi153 Combi153 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!!!

Comment on lines +47 to +49
val productOptions = productOptionRepository.findAllByProductId(productId)
val maleAdditionalPrice = productOptions.find { it.sex == MALE }?.additionalPrice
val femaleAdditionalPrice = productOptions.find { it.sex == FEMALE }?.additionalPrice
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 감사합니다

@TaeyeonRoyce TaeyeonRoyce merged commit 4ca1b76 into develop Feb 27, 2024
2 checks passed
@TaeyeonRoyce TaeyeonRoyce deleted the 102-feature-봉달-관련-api-스펙-수정 branch February 27, 2024 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature: 봉달 관련 api 스펙 수정
3 participants