Skip to content

Commit

Permalink
refactor: 메서드 인라인화
Browse files Browse the repository at this point in the history
  • Loading branch information
1o18z committed Sep 26, 2023
1 parent 5789df1 commit 2b2c20f
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ class UpdateShopStatusService(
) : UpdateShopStatusUseCase {

override fun update(shopId: Long) {
val shop = findShopById(shopId)
val shop = loadShopPort.loadOneShopById(shopId)

if (shop.status.isValidStatus()) {
checkReservationByShopId(shopId)
}
updateStatus(shop)
}

private fun findShopById(shopId: Long): Shop {
return loadShopPort.loadOneShopById(shopId)
private fun checkReservationByShopId(shopId: Long) {
if (checkExistenceShopPort.hasReservations(shopId)) {
throw IllegalStateException("예약이 존재할 경우 가게 상태를 INVALID로 변경할 수 없습니다.")
}
}

private fun updateStatus(shop: Shop) {
Expand All @@ -34,10 +36,4 @@ class UpdateShopStatusService(
shop.changeStatusValid()
}
}

private fun checkReservationByShopId(shopId: Long) {
if (checkExistenceShopPort.hasReservations(shopId)) {
throw IllegalStateException("예약이 존재할 경우 가게 상태를 INVALID로 변경할 수 없습니다.")
}
}
}

0 comments on commit 2b2c20f

Please sign in to comment.