From 2b2c20fbaf1b505b554f5539576cd214d3f42da0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=8B=E1=85=B3=E1=86=AB?= =?UTF-8?q?=E1=84=8C=E1=85=B5?= Date: Tue, 26 Sep 2023 23:35:32 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EB=A9=94=EC=84=9C=EB=93=9C=20?= =?UTF-8?q?=EC=9D=B8=EB=9D=BC=EC=9D=B8=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/service/UpdateShopStatusService.kt | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/mealkitary-application/src/main/kotlin/com/mealkitary/shop/application/service/UpdateShopStatusService.kt b/mealkitary-application/src/main/kotlin/com/mealkitary/shop/application/service/UpdateShopStatusService.kt index e7ce594..3893e0c 100644 --- a/mealkitary-application/src/main/kotlin/com/mealkitary/shop/application/service/UpdateShopStatusService.kt +++ b/mealkitary-application/src/main/kotlin/com/mealkitary/shop/application/service/UpdateShopStatusService.kt @@ -15,7 +15,7 @@ class UpdateShopStatusService( ) : UpdateShopStatusUseCase { override fun update(shopId: Long) { - val shop = findShopById(shopId) + val shop = loadShopPort.loadOneShopById(shopId) if (shop.status.isValidStatus()) { checkReservationByShopId(shopId) @@ -23,8 +23,10 @@ class UpdateShopStatusService( 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) { @@ -34,10 +36,4 @@ class UpdateShopStatusService( shop.changeStatusValid() } } - - private fun checkReservationByShopId(shopId: Long) { - if (checkExistenceShopPort.hasReservations(shopId)) { - throw IllegalStateException("예약이 존재할 경우 가게 상태를 INVALID로 변경할 수 없습니다.") - } - } }