diff --git a/src/main/java/org/prography/spring/service/validation/ValidateRoomService.java b/src/main/java/org/prography/spring/service/validation/ValidateRoomService.java index fb585aa..e419549 100644 --- a/src/main/java/org/prography/spring/service/validation/ValidateRoomService.java +++ b/src/main/java/org/prography/spring/service/validation/ValidateRoomService.java @@ -33,7 +33,7 @@ public class ValidateRoomService { public void validateUserStatusIsActive(Long userId) { Optional checkUserStatusIsActive = userRepository.findByIdAndStatus(userId, ACTIVE); - if (!checkUserStatusIsActive.isPresent()) { + if (checkUserStatusIsActive.isEmpty()) { throw new BussinessException(BAD_REQUEST); } } @@ -55,7 +55,7 @@ public User validateUserIsExist(Long userId) { public void validateRoomIsExist(Long roomId) { Optional checkRoomIsExist = roomRepository.findById(roomId); - if (!checkRoomIsExist.isPresent()) { + if (checkRoomIsExist.isEmpty()) { throw new BussinessException(BAD_REQUEST); } } @@ -63,7 +63,7 @@ public void validateRoomIsExist(Long roomId) { public void validateRoomStatusIsWait(Long roomId) { Optional checkRoomStatusIsWait = roomRepository.findByIdAndStatus(roomId, WAIT); - if (!checkRoomStatusIsWait.isPresent()) { + if (checkRoomStatusIsWait.isEmpty()) { throw new BussinessException(BAD_REQUEST); } } @@ -107,7 +107,7 @@ public void validateHostOfRoom(Long roomId, Long userId) { public void validateUserIsInRoom(Long roomId, Long userId) { Optional checkUserParticipate = userRoomRepository.findByRoomId_IdAndUserId_Id(roomId, userId); - if (!checkUserParticipate.isPresent()) { + if (checkUserParticipate.isEmpty()) { throw new BussinessException(BAD_REQUEST); } } diff --git a/src/main/java/org/prography/spring/service/validation/ValidateTeamService.java b/src/main/java/org/prography/spring/service/validation/ValidateTeamService.java index 65333a6..76618f0 100644 --- a/src/main/java/org/prography/spring/service/validation/ValidateTeamService.java +++ b/src/main/java/org/prography/spring/service/validation/ValidateTeamService.java @@ -34,7 +34,7 @@ public void validateRoomIsExist(Long roomId) { public void validateRoomStatusIsWait(Long roomId) { Optional checkRoomStatusIsWait = roomRepository.findByIdAndStatus(roomId, WAIT); - if (!checkRoomStatusIsWait.isPresent()) { + if (checkRoomStatusIsWait.isEmpty()) { throw new BussinessException(BAD_REQUEST); } } @@ -42,7 +42,7 @@ public void validateRoomStatusIsWait(Long roomId) { public void validateUserParticipationInRoom(Long roomId, Long userId) { Optional checkUserIsParticipate = userRoomRepository.findByUserId_IdAndRoomId_Id(userId, roomId); - if (!checkUserIsParticipate.isPresent()) { + if (checkUserIsParticipate.isEmpty()) { throw new BussinessException(BAD_REQUEST); } }