Skip to content

Commit

Permalink
refactor: product가 삭제된 봉달 상품의 productId 기본 값 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
TaeyeonRoyce committed Feb 2, 2024
1 parent a66f802 commit f7a2d80
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
24 changes: 12 additions & 12 deletions src/main/kotlin/com/petqua/application/cart/dto/CartProductDtos.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ data class CartProductResponse(
) {

constructor(cartProduct: CartProduct, product: Product?, storeName: String?) : this(
cartProduct.id,
storeName ?: "",
product?.id ?: cartProduct.productId,
product?.name ?: "",
product?.thumbnailUrl ?: "",
product?.price?.intValueExact() ?: 0,
product?.discountRate ?: 0,
product?.discountPrice?.intValueExact() ?: 0,
cartProduct.quantity.value,
cartProduct.isMale,
cartProduct.deliveryMethod.name,
product != null
id = cartProduct.id,
storeName = storeName ?: "",
productId = product?.id ?: 0L,
productName = product?.name ?: "",
productThumbnailUrl = product?.thumbnailUrl ?: "",
productPrice = product?.price?.intValueExact() ?: 0,
productDiscountRate = product?.discountRate ?: 0,
productDiscountPrice = product?.discountPrice?.intValueExact() ?: 0,
quantity = cartProduct.quantity.value,
isMale = cartProduct.isMale,
deliveryMethod = cartProduct.deliveryMethod.name,
isOnSale = product != null
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ class CartProductServiceTest(
Then("상품의 판매 여부를 포함한 리스트를 반환 한다") {
assertSoftly(results) {
size shouldBe 3
find { it.productId == productAId }!!.isOnSale shouldBe false
find { it.productId == 0L }!!.isOnSale shouldBe false
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ class CartProductControllerTest(
assertSoftly(response) {
statusCode shouldBe HttpStatus.OK.value()
responseBody.size shouldBe 3
responseBody.find { it.productId == productA.id }!!.isOnSale shouldBe false
responseBody.find { it.productId == 0L }!!.isOnSale shouldBe false
}
}
}
Expand Down

0 comments on commit f7a2d80

Please sign in to comment.