From 0489b19d28751dc411a7aa755f44ddb35ace60f0 Mon Sep 17 00:00:00 2001 From: seykim Date: Tue, 31 Dec 2024 15:31:24 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20[Refactoring]=20if=EB=B6=84?= =?UTF-8?q?=EA=B8=B0=EB=AC=B8=20helper=ED=95=A8=EC=88=98=EB=A1=9C=20?= =?UTF-8?q?=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../publicschedule/service/PublicScheduleAdminService.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gg-calendar-api/src/main/java/gg/calendar/api/admin/schedule/publicschedule/service/PublicScheduleAdminService.java b/gg-calendar-api/src/main/java/gg/calendar/api/admin/schedule/publicschedule/service/PublicScheduleAdminService.java index 58310d45e..bfdca9fe2 100644 --- a/gg-calendar-api/src/main/java/gg/calendar/api/admin/schedule/publicschedule/service/PublicScheduleAdminService.java +++ b/gg-calendar-api/src/main/java/gg/calendar/api/admin/schedule/publicschedule/service/PublicScheduleAdminService.java @@ -57,10 +57,14 @@ public PublicScheduleAdminUpdateResDto updatePublicSchedule( public void deletePublicSchedule(Long id) { PublicSchedule publicSchedule = publicScheduleAdminRepository.findById(id) .orElseThrow(() -> new NotExistException(ErrorCode.PUBLIC_SCHEDULE_NOT_FOUND)); + isDeleted(publicSchedule); + publicSchedule.delete(); + } + + private void isDeleted(PublicSchedule publicSchedule) { if (publicSchedule.getStatus().equals(ScheduleStatus.DELETE)) { throw new InvalidParameterException(ErrorCode.PUBLIC_SCHEDULE_ALREADY_DELETED); } - publicSchedule.delete(); } public PublicScheduleAdminResDto detailPublicSchedule(Long id) {