From 41615b227f9afd6b7d52d94278dbe9dda6db2a66 Mon Sep 17 00:00:00 2001 From: Vladik-gif Date: Fri, 20 Sep 2024 13:13:58 +0300 Subject: [PATCH] fix: ContactService.java 2 --- .../com/chat/yourway/service/ContactService.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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