diff --git a/src/main/java/com/chat/yourway/service/ContactService.java b/src/main/java/com/chat/yourway/service/ContactService.java index 0c5b2f2..c68871d 100644 --- a/src/main/java/com/chat/yourway/service/ContactService.java +++ b/src/main/java/com/chat/yourway/service/ContactService.java @@ -40,7 +40,8 @@ public Contact create(ContactRequestDto contactRequestDto) { if (isEmailExists(contactRequestDto.getEmail())) { log.warn("Email [{}] already in use", contactRequestDto.getEmail()); throw new ValueNotUniqException( - String.format("Email [%s] already in use", contactRequestDto.getEmail())); + String.format("Email [%s] already in use", contactRequestDto.getEmail()) + ); } Contact contact = (Contact.builder() @@ -68,7 +69,8 @@ public Contact findByEmail(String email) { .orElseThrow(() -> { log.warn("Email [{}] wasn't found", email); return new ContactNotFoundException(String.format("Email [%s] wasn't found", email)); - }); + } + ); log.info("Contact was found by email [{}]", email); return contact; @@ -144,14 +146,14 @@ public void prohibitSendingPrivateMessages() { log.info("Prohibited sending private messages by email [{}]", contact.getEmail()); } - private void changePermissionSendingPrivateMessages(String email, boolean isPermittedSendingPrivateMessage) { + private void changePermissionSendingPrivateMessages(String email, boolean messageByContactEmail) { if (!contactRepository.existsByEmailIgnoreCase(email)) { throw new ContactNotFoundException( - String.format("Contact with email [%s] is not found.", email)); + String.format("Contact with email [%s] is not found.", email) + ); } - contactRepository.updatePermissionSendingPrivateMessageByContactEmail( - email, isPermittedSendingPrivateMessage); + contactRepository.updatePermissionSendingPrivateMessageByContactEmail(email, messageByContactEmail); } @Transactional