Skip to content

Commit

Permalink
🔨 [Refactoring] if분기문 helper함수로 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
seyeon22222 committed Dec 31, 2024
1 parent c0961f7 commit 0489b19
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 0489b19

Please sign in to comment.