From a773bd34c067779aee1e50750899cafe36ceb841 Mon Sep 17 00:00:00 2001 From: Vladik-gif Date: Fri, 11 Oct 2024 22:14:20 +0300 Subject: [PATCH] fix: refactor --- .../service/EmailMessageFactoryService.java | 14 +++++++++----- .../chat/yourway/service/EmailSenderService.java | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/chat/yourway/service/EmailMessageFactoryService.java b/src/main/java/com/chat/yourway/service/EmailMessageFactoryService.java index ac944989..9b744935 100644 --- a/src/main/java/com/chat/yourway/service/EmailMessageFactoryService.java +++ b/src/main/java/com/chat/yourway/service/EmailMessageFactoryService.java @@ -14,12 +14,16 @@ @Slf4j public class EmailMessageFactoryService { public EmailMessageDto generateEmailMessage(EmailMessageInfoDto emailMessageInfoDto) { - String path = emailMessageInfoDto.path(); - UUID uuidToken = emailMessageInfoDto.uuidToken(); - EmailMessageType emailMessageType = emailMessageInfoDto.emailMessageType(); - String link = generateLink(path, uuidToken, emailMessageType); + final var path = emailMessageInfoDto.path(); + final var uuidToken = emailMessageInfoDto.uuidToken(); + final var emailMessageType = emailMessageInfoDto.emailMessageType(); + final var link = generateLink(path, uuidToken, emailMessageType); + log.info("Generated link: {}", link); - String messageBody = String.format(emailMessageType.getMessageBody(), emailMessageInfoDto.username(), link); + + final var messageBody = String.format( + emailMessageType.getMessageBody(), emailMessageInfoDto.username(), link + ); return new EmailMessageDto(emailMessageInfoDto.email(), emailMessageType.getSubject(), messageBody); } diff --git a/src/main/java/com/chat/yourway/service/EmailSenderService.java b/src/main/java/com/chat/yourway/service/EmailSenderService.java index 7f4031f4..4184bec0 100644 --- a/src/main/java/com/chat/yourway/service/EmailSenderService.java +++ b/src/main/java/com/chat/yourway/service/EmailSenderService.java @@ -18,7 +18,7 @@ public class EmailSenderService { @Value("${spring.mail.username}") - private String emailAddressFrom; + private final String emailAddressFrom; private final JavaMailSender javaMailSender; @Async