diff --git a/src/main/java/com/dnd/gooding/filestore/application/in/FileStoreUseCase.java b/src/main/java/com/dnd/gooding/filestore/application/in/FileStoreUseCase.java index bdf5e56..5fb8c2c 100644 --- a/src/main/java/com/dnd/gooding/filestore/application/in/FileStoreUseCase.java +++ b/src/main/java/com/dnd/gooding/filestore/application/in/FileStoreUseCase.java @@ -4,6 +4,7 @@ public interface FileStoreUseCase { - String putFile(String key, File file); - void deleteFile(String key); + String putFile(String key, File file); + + void deleteFile(String key); } diff --git a/src/main/java/com/dnd/gooding/filestore/infra/S3ServiceStore.java b/src/main/java/com/dnd/gooding/filestore/infra/S3ServiceStore.java index 9c20504..77e5a5a 100644 --- a/src/main/java/com/dnd/gooding/filestore/infra/S3ServiceStore.java +++ b/src/main/java/com/dnd/gooding/filestore/infra/S3ServiceStore.java @@ -1,13 +1,11 @@ package com.dnd.gooding.filestore.infra; +import com.dnd.gooding.filestore.application.in.FileStoreUseCase; import java.io.File; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FileUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; - -import com.dnd.gooding.filestore.application.in.FileStoreUseCase; - import software.amazon.awssdk.core.ResponseInputStream; import software.amazon.awssdk.core.sync.RequestBody; import software.amazon.awssdk.services.s3.S3Client; diff --git a/src/main/java/com/dnd/gooding/mail/application/adapter/EmailSender.java b/src/main/java/com/dnd/gooding/mail/application/adapter/EmailSender.java index a680bda..e33332f 100644 --- a/src/main/java/com/dnd/gooding/mail/application/adapter/EmailSender.java +++ b/src/main/java/com/dnd/gooding/mail/application/adapter/EmailSender.java @@ -2,5 +2,5 @@ public interface EmailSender { - void sendLoginSuccess(String toMail); + void sendLoginSuccess(String toMail); } diff --git a/src/main/java/com/dnd/gooding/mail/exception/EmailSendException.java b/src/main/java/com/dnd/gooding/mail/exception/EmailSendException.java index c178435..9065d65 100644 --- a/src/main/java/com/dnd/gooding/mail/exception/EmailSendException.java +++ b/src/main/java/com/dnd/gooding/mail/exception/EmailSendException.java @@ -1,7 +1,7 @@ package com.dnd.gooding.mail.exception; public class EmailSendException extends RuntimeException { - public EmailSendException(Exception e) { - super(e); - } + public EmailSendException(Exception e) { + super(e); + } } diff --git a/src/main/java/com/dnd/gooding/mail/infra/DefaultEmailEventAdapter.java b/src/main/java/com/dnd/gooding/mail/infra/DefaultEmailEventAdapter.java index fa21075..d815aca 100644 --- a/src/main/java/com/dnd/gooding/mail/infra/DefaultEmailEventAdapter.java +++ b/src/main/java/com/dnd/gooding/mail/infra/DefaultEmailEventAdapter.java @@ -1,7 +1,9 @@ package com.dnd.gooding.mail.infra; +import com.dnd.gooding.mail.application.adapter.EmailSender; +import com.dnd.gooding.mail.exception.EmailSendException; import javax.mail.internet.MimeMessage; - +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.MimeMessageHelper; @@ -9,47 +11,42 @@ import org.thymeleaf.context.Context; import org.thymeleaf.spring5.SpringTemplateEngine; -import com.dnd.gooding.mail.application.adapter.EmailSender; -import com.dnd.gooding.mail.exception.EmailSendException; - -import lombok.extern.slf4j.Slf4j; - @Slf4j @Component public class DefaultEmailEventAdapter implements EmailSender { - private final JavaMailSender mailSender; - private final SpringTemplateEngine springTemplateEngine; - @Value("${spring.mail.username}") - private String fromMail; - - public DefaultEmailEventAdapter(JavaMailSender mailSender, - SpringTemplateEngine springTemplateEngine) { - this.mailSender = mailSender; - this.springTemplateEngine = springTemplateEngine; - } - - @Override - public void sendLoginSuccess(String toMail) { - Context context = new Context(); - String text = springTemplateEngine.process(EmailMetaData.LOGIN_SUCCESS_TEMPLATE, context); - sendMail(EmailMetaData.LOGIN_SUCCESS_TITLE, toMail, text); - } - - private void sendMail(String subject, String toEmail, String text) { - try { - MimeMessage message = mailSender.createMimeMessage(); - MimeMessageHelper helper = new MimeMessageHelper(message, true); - - helper.setSubject(subject); - helper.setTo(toEmail); - helper.setText(text); - helper.setFrom(fromMail, "gooding"); - - mailSender.send(message); - } catch (Exception e) { - throw new EmailSendException(e); - } - - } + private final JavaMailSender mailSender; + private final SpringTemplateEngine springTemplateEngine; + + @Value("${spring.mail.username}") + private String fromMail; + + public DefaultEmailEventAdapter( + JavaMailSender mailSender, SpringTemplateEngine springTemplateEngine) { + this.mailSender = mailSender; + this.springTemplateEngine = springTemplateEngine; + } + + @Override + public void sendLoginSuccess(String toMail) { + Context context = new Context(); + String text = springTemplateEngine.process(EmailMetaData.LOGIN_SUCCESS_TEMPLATE, context); + sendMail(EmailMetaData.LOGIN_SUCCESS_TITLE, toMail, text); + } + + private void sendMail(String subject, String toEmail, String text) { + try { + MimeMessage message = mailSender.createMimeMessage(); + MimeMessageHelper helper = new MimeMessageHelper(message, true); + + helper.setSubject(subject); + helper.setTo(toEmail); + helper.setText(text); + helper.setFrom(fromMail, "gooding"); + + mailSender.send(message); + } catch (Exception e) { + throw new EmailSendException(e); + } + } } diff --git a/src/main/java/com/dnd/gooding/mail/infra/EmailMetaData.java b/src/main/java/com/dnd/gooding/mail/infra/EmailMetaData.java index e91bea9..05d2d7c 100644 --- a/src/main/java/com/dnd/gooding/mail/infra/EmailMetaData.java +++ b/src/main/java/com/dnd/gooding/mail/infra/EmailMetaData.java @@ -1,6 +1,6 @@ package com.dnd.gooding.mail.infra; public class EmailMetaData { - static String LOGIN_SUCCESS_TEMPLATE = "login-sucess"; - static String LOGIN_SUCCESS_TITLE = "gooding 서비스에 가입해주셔서 감사합니다."; + static String LOGIN_SUCCESS_TEMPLATE = "login-sucess"; + static String LOGIN_SUCCESS_TITLE = "gooding 서비스에 가입해주셔서 감사합니다."; } diff --git a/src/main/java/com/dnd/gooding/oauth/command/application/in/CreateOAuthUseCase.java b/src/main/java/com/dnd/gooding/oauth/command/application/in/CreateOAuthUseCase.java index f6ca6e8..a6814f0 100644 --- a/src/main/java/com/dnd/gooding/oauth/command/application/in/CreateOAuthUseCase.java +++ b/src/main/java/com/dnd/gooding/oauth/command/application/in/CreateOAuthUseCase.java @@ -4,5 +4,5 @@ public interface CreateOAuthUseCase { - Token create(String code); + Token create(String code); } diff --git a/src/main/java/com/dnd/gooding/oauth/command/application/out/OAuthMemberPort.java b/src/main/java/com/dnd/gooding/oauth/command/application/out/OAuthMemberPort.java index ec7ebc8..61544fb 100644 --- a/src/main/java/com/dnd/gooding/oauth/command/application/out/OAuthMemberPort.java +++ b/src/main/java/com/dnd/gooding/oauth/command/application/out/OAuthMemberPort.java @@ -2,5 +2,5 @@ public interface OAuthMemberPort { - void create(String id, String oAuthId); + void create(String id, String oAuthId); } diff --git a/src/main/java/com/dnd/gooding/oauth/command/domain/repository/OAuthRepository.java b/src/main/java/com/dnd/gooding/oauth/command/domain/repository/OAuthRepository.java index 5dfa2e3..c94cdc5 100644 --- a/src/main/java/com/dnd/gooding/oauth/command/domain/repository/OAuthRepository.java +++ b/src/main/java/com/dnd/gooding/oauth/command/domain/repository/OAuthRepository.java @@ -1,10 +1,9 @@ package com.dnd.gooding.oauth.command.domain.repository; -import java.util.Optional; -import org.springframework.data.repository.Repository; - import com.dnd.gooding.oauth.command.domain.OAuth; import com.dnd.gooding.oauth.command.domain.OAuthId; +import java.util.Optional; +import org.springframework.data.repository.Repository; public interface OAuthRepository extends Repository { diff --git a/src/main/java/com/dnd/gooding/oauth/command/domain/service/CreateOAuthService.java b/src/main/java/com/dnd/gooding/oauth/command/domain/service/CreateOAuthService.java index f4cb3d6..1ec5d5a 100644 --- a/src/main/java/com/dnd/gooding/oauth/command/domain/service/CreateOAuthService.java +++ b/src/main/java/com/dnd/gooding/oauth/command/domain/service/CreateOAuthService.java @@ -7,9 +7,8 @@ import com.dnd.gooding.oauth.command.application.out.OAuthTokenPort; import com.dnd.gooding.oauth.command.domain.OAuth; import com.dnd.gooding.oauth.command.domain.OAuthId; -import com.dnd.gooding.oauth.command.domain.repository.OAuthRepository; import com.dnd.gooding.oauth.command.domain.dto.OAuthMember; - +import com.dnd.gooding.oauth.command.domain.repository.OAuthRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -24,10 +23,11 @@ public class CreateOAuthService implements CreateOAuthUseCase { private final OAuthTokenPort oAuthTokenPort; - public CreateOAuthService(OAuthRepository oAuthRepository, - ExternalLoginPort externalLoginPort, - OAuthMemberPort oAuthMemberPort, - OAuthTokenPort oAuthTokenPort) { + public CreateOAuthService( + OAuthRepository oAuthRepository, + ExternalLoginPort externalLoginPort, + OAuthMemberPort oAuthMemberPort, + OAuthTokenPort oAuthTokenPort) { this.oAuthRepository = oAuthRepository; this.externalLoginPort = externalLoginPort; this.oAuthMemberPort = oAuthMemberPort; diff --git a/src/main/java/com/dnd/gooding/oauth/infra/ExternalGoogleLoginAdapter.java b/src/main/java/com/dnd/gooding/oauth/infra/ExternalGoogleLoginAdapter.java index e7f955e..2d77c63 100644 --- a/src/main/java/com/dnd/gooding/oauth/infra/ExternalGoogleLoginAdapter.java +++ b/src/main/java/com/dnd/gooding/oauth/infra/ExternalGoogleLoginAdapter.java @@ -1,8 +1,8 @@ package com.dnd.gooding.oauth.infra; -import com.dnd.gooding.oauth.exception.ConnectionException; import com.dnd.gooding.oauth.command.domain.dto.GoogleMember; import com.dnd.gooding.oauth.command.domain.dto.OAuthMember; +import com.dnd.gooding.oauth.exception.ConnectionException; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; diff --git a/src/main/java/com/dnd/gooding/oauth/infra/ExternalKakaoLoginAdapter.java b/src/main/java/com/dnd/gooding/oauth/infra/ExternalKakaoLoginAdapter.java index 9805f9e..a44b2ab 100644 --- a/src/main/java/com/dnd/gooding/oauth/infra/ExternalKakaoLoginAdapter.java +++ b/src/main/java/com/dnd/gooding/oauth/infra/ExternalKakaoLoginAdapter.java @@ -1,11 +1,11 @@ package com.dnd.gooding.oauth.infra; -import com.dnd.gooding.oauth.exception.ConnectionException; import com.dnd.gooding.oauth.command.application.out.ExternalLoginPort; import com.dnd.gooding.oauth.command.domain.dto.KakaoInfo; import com.dnd.gooding.oauth.command.domain.dto.KakaoMember; import com.dnd.gooding.oauth.command.domain.dto.KakaoResponse; import com.dnd.gooding.oauth.command.domain.dto.OAuthMember; +import com.dnd.gooding.oauth.exception.ConnectionException; import java.util.Objects; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; diff --git a/src/main/java/com/dnd/gooding/oauth/ui/OAuthLoginController.java b/src/main/java/com/dnd/gooding/oauth/ui/OAuthLoginController.java index 09f1156..55e76f1 100644 --- a/src/main/java/com/dnd/gooding/oauth/ui/OAuthLoginController.java +++ b/src/main/java/com/dnd/gooding/oauth/ui/OAuthLoginController.java @@ -2,7 +2,6 @@ import com.dnd.gooding.common.model.Token; import com.dnd.gooding.oauth.command.application.in.CreateOAuthUseCase; - import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/src/main/java/com/dnd/gooding/record/command/application/in/CreateRecordUseCase.java b/src/main/java/com/dnd/gooding/record/command/application/in/CreateRecordUseCase.java index fb6dae9..b876e42 100644 --- a/src/main/java/com/dnd/gooding/record/command/application/in/CreateRecordUseCase.java +++ b/src/main/java/com/dnd/gooding/record/command/application/in/CreateRecordUseCase.java @@ -1,10 +1,9 @@ package com.dnd.gooding.record.command.application.in; -import java.io.IOException; - import com.dnd.gooding.record.ui.dto.request.RecordRequest; +import java.io.IOException; public interface CreateRecordUseCase { - void create(RecordRequest recordRequest) throws IOException; + void create(RecordRequest recordRequest) throws IOException; } diff --git a/src/main/java/com/dnd/gooding/record/command/application/in/DeleteRecordUseCase.java b/src/main/java/com/dnd/gooding/record/command/application/in/DeleteRecordUseCase.java index fa8ffdf..cfd1cf6 100644 --- a/src/main/java/com/dnd/gooding/record/command/application/in/DeleteRecordUseCase.java +++ b/src/main/java/com/dnd/gooding/record/command/application/in/DeleteRecordUseCase.java @@ -2,5 +2,5 @@ public interface DeleteRecordUseCase { - void delete(String recordNo); + void delete(String recordNo); } diff --git a/src/main/java/com/dnd/gooding/record/command/application/out/RecordMemberPort.java b/src/main/java/com/dnd/gooding/record/command/application/out/RecordMemberPort.java index 9f0b448..e18b76d 100644 --- a/src/main/java/com/dnd/gooding/record/command/application/out/RecordMemberPort.java +++ b/src/main/java/com/dnd/gooding/record/command/application/out/RecordMemberPort.java @@ -5,5 +5,5 @@ public interface RecordMemberPort { - Recorder createRecorder(MemberId recorderMemberId); + Recorder createRecorder(MemberId recorderMemberId); } diff --git a/src/main/java/com/dnd/gooding/record/command/domain/repository/RecordRepository.java b/src/main/java/com/dnd/gooding/record/command/domain/repository/RecordRepository.java index 87ba2c3..f1c9b5c 100644 --- a/src/main/java/com/dnd/gooding/record/command/domain/repository/RecordRepository.java +++ b/src/main/java/com/dnd/gooding/record/command/domain/repository/RecordRepository.java @@ -1,13 +1,12 @@ package com.dnd.gooding.record.command.domain.repository; +import com.dnd.gooding.record.command.domain.Record; +import com.dnd.gooding.record.command.domain.RecordNo; import java.security.SecureRandom; import java.util.Date; import java.util.Optional; import org.springframework.data.repository.Repository; -import com.dnd.gooding.record.command.domain.Record; -import com.dnd.gooding.record.command.domain.RecordNo; - public interface RecordRepository extends Repository { Optional findById(RecordNo recordNo); diff --git a/src/main/java/com/dnd/gooding/record/command/domain/service/RecordService.java b/src/main/java/com/dnd/gooding/record/command/domain/service/RecordService.java index 530d641..aedbc0d 100644 --- a/src/main/java/com/dnd/gooding/record/command/domain/service/RecordService.java +++ b/src/main/java/com/dnd/gooding/record/command/domain/service/RecordService.java @@ -26,7 +26,9 @@ public class RecordService implements CreateRecordUseCase { private final RecordFilePort recordFilePort; public RecordService( - RecordRepository recordRepository, RecordMemberPort recordMemberPort, RecordFilePort recordFilePort) { + RecordRepository recordRepository, + RecordMemberPort recordMemberPort, + RecordFilePort recordFilePort) { this.recordRepository = recordRepository; this.recordMemberPort = recordMemberPort; this.recordFilePort = recordFilePort; diff --git a/src/main/java/com/dnd/gooding/record/query/application/RecordQueryService.java b/src/main/java/com/dnd/gooding/record/query/application/RecordQueryService.java index c8679be..29d46be 100644 --- a/src/main/java/com/dnd/gooding/record/query/application/RecordQueryService.java +++ b/src/main/java/com/dnd/gooding/record/query/application/RecordQueryService.java @@ -1,7 +1,7 @@ package com.dnd.gooding.record.query.application; -import com.dnd.gooding.record.exception.NoRecordException; import com.dnd.gooding.record.command.domain.RecordNo; +import com.dnd.gooding.record.exception.NoRecordException; import com.dnd.gooding.record.query.dao.ImageDataDao; import com.dnd.gooding.record.query.dao.RecordDataDao; import com.dnd.gooding.record.query.dto.ImageData; diff --git a/src/main/java/com/dnd/gooding/record/ui/RecordController.java b/src/main/java/com/dnd/gooding/record/ui/RecordController.java index e5dae6a..b4d4823 100644 --- a/src/main/java/com/dnd/gooding/record/ui/RecordController.java +++ b/src/main/java/com/dnd/gooding/record/ui/RecordController.java @@ -3,7 +3,6 @@ import com.dnd.gooding.record.command.application.in.CreateRecordUseCase; import com.dnd.gooding.record.command.application.in.DeleteRecordUseCase; import com.dnd.gooding.record.ui.dto.request.RecordRequest; -import com.dnd.gooding.record.command.domain.service.RecordService; import com.dnd.gooding.token.command.domain.dto.JwtAuthentication; import com.dnd.gooding.user.command.domain.MemberId; import java.io.IOException; @@ -21,8 +20,8 @@ public class RecordController { private final CreateRecordUseCase createRecordUseCase; private final DeleteRecordUseCase deleteRecordUseCase; - public RecordController(CreateRecordUseCase createRecordUseCase, - DeleteRecordUseCase deleteRecordUseCase) { + public RecordController( + CreateRecordUseCase createRecordUseCase, DeleteRecordUseCase deleteRecordUseCase) { this.createRecordUseCase = createRecordUseCase; this.deleteRecordUseCase = deleteRecordUseCase; } diff --git a/src/main/java/com/dnd/gooding/springconfig/log/MDCCopyTaskDecorator.java b/src/main/java/com/dnd/gooding/springconfig/log/MDCCopyTaskDecorator.java index ff731b5..47d64d4 100644 --- a/src/main/java/com/dnd/gooding/springconfig/log/MDCCopyTaskDecorator.java +++ b/src/main/java/com/dnd/gooding/springconfig/log/MDCCopyTaskDecorator.java @@ -1,24 +1,23 @@ package com.dnd.gooding.springconfig.log; import java.util.Map; - import org.slf4j.MDC; import org.springframework.core.task.TaskDecorator; public class MDCCopyTaskDecorator implements TaskDecorator { - @Override - public Runnable decorate(Runnable runnable) { - Map contextMap = MDC.getCopyOfContextMap(); - return () -> { - try { - if (contextMap != null) { - MDC.setContextMap(contextMap); - } - runnable.run(); - } finally { - MDC.clear(); - } - }; - } + @Override + public Runnable decorate(Runnable runnable) { + Map contextMap = MDC.getCopyOfContextMap(); + return () -> { + try { + if (contextMap != null) { + MDC.setContextMap(contextMap); + } + runnable.run(); + } finally { + MDC.clear(); + } + }; + } } diff --git a/src/main/java/com/dnd/gooding/springconfig/security/JwtAuthenticationFilter.java b/src/main/java/com/dnd/gooding/springconfig/security/JwtAuthenticationFilter.java index 642ab22..ac06e82 100644 --- a/src/main/java/com/dnd/gooding/springconfig/security/JwtAuthenticationFilter.java +++ b/src/main/java/com/dnd/gooding/springconfig/security/JwtAuthenticationFilter.java @@ -1,7 +1,7 @@ package com.dnd.gooding.springconfig.security; -import com.dnd.gooding.token.command.domain.service.TokenService; import com.dnd.gooding.token.command.domain.dto.JwtAuthenticationToken; +import com.dnd.gooding.token.command.domain.service.TokenService; import com.dnd.gooding.util.ExtractUtil; import java.io.IOException; import javax.servlet.FilterChain; diff --git a/src/main/java/com/dnd/gooding/springconfig/web/WebMvcConfig.java b/src/main/java/com/dnd/gooding/springconfig/web/WebMvcConfig.java index c631da4..5e0f173 100644 --- a/src/main/java/com/dnd/gooding/springconfig/web/WebMvcConfig.java +++ b/src/main/java/com/dnd/gooding/springconfig/web/WebMvcConfig.java @@ -1,11 +1,10 @@ package com.dnd.gooding.springconfig.web; +import com.dnd.gooding.springconfig.log.MDCLoggingInterceptor; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import com.dnd.gooding.springconfig.log.MDCLoggingInterceptor; - @Configuration public class WebMvcConfig implements WebMvcConfigurer { diff --git a/src/main/java/com/dnd/gooding/token/command/application/in/CreateTokenUseCase.java b/src/main/java/com/dnd/gooding/token/command/application/in/CreateTokenUseCase.java index fac62dc..4b4416d 100644 --- a/src/main/java/com/dnd/gooding/token/command/application/in/CreateTokenUseCase.java +++ b/src/main/java/com/dnd/gooding/token/command/application/in/CreateTokenUseCase.java @@ -4,6 +4,7 @@ public interface CreateTokenUseCase { - String getAccessTokensByRefreshToken(String refreshToken); - Token createTokens(String id); + String getAccessTokensByRefreshToken(String refreshToken); + + Token createTokens(String id); } diff --git a/src/main/java/com/dnd/gooding/token/command/application/in/LogoutTokenUseCase.java b/src/main/java/com/dnd/gooding/token/command/application/in/LogoutTokenUseCase.java index 8cd304b..2c5d1c8 100644 --- a/src/main/java/com/dnd/gooding/token/command/application/in/LogoutTokenUseCase.java +++ b/src/main/java/com/dnd/gooding/token/command/application/in/LogoutTokenUseCase.java @@ -2,5 +2,5 @@ public interface LogoutTokenUseCase { - void deleteRefreshToken(String refreshToken); + void deleteRefreshToken(String refreshToken); } diff --git a/src/main/java/com/dnd/gooding/token/command/domain/repository/RefreshTokenRepository.java b/src/main/java/com/dnd/gooding/token/command/domain/repository/RefreshTokenRepository.java index 4bbdf04..8eb1414 100644 --- a/src/main/java/com/dnd/gooding/token/command/domain/repository/RefreshTokenRepository.java +++ b/src/main/java/com/dnd/gooding/token/command/domain/repository/RefreshTokenRepository.java @@ -1,7 +1,6 @@ package com.dnd.gooding.token.command.domain.repository; -import org.springframework.data.repository.CrudRepository; - import com.dnd.gooding.token.command.domain.RefreshToken; +import org.springframework.data.repository.CrudRepository; public interface RefreshTokenRepository extends CrudRepository {} diff --git a/src/main/java/com/dnd/gooding/token/command/domain/service/TokenService.java b/src/main/java/com/dnd/gooding/token/command/domain/service/TokenService.java index 9b93133..ab31094 100644 --- a/src/main/java/com/dnd/gooding/token/command/domain/service/TokenService.java +++ b/src/main/java/com/dnd/gooding/token/command/domain/service/TokenService.java @@ -3,11 +3,10 @@ import com.dnd.gooding.common.model.Token; import com.dnd.gooding.token.command.application.in.CreateTokenUseCase; import com.dnd.gooding.token.command.domain.RefreshToken; -import com.dnd.gooding.token.command.domain.repository.RefreshTokenRepository; import com.dnd.gooding.token.command.domain.dto.JwtAuthentication; import com.dnd.gooding.token.command.domain.dto.JwtAuthenticationToken; +import com.dnd.gooding.token.command.domain.repository.RefreshTokenRepository; import com.dnd.gooding.token.exception.RefreshTokenNotFoundException; - import io.jsonwebtoken.Claims; import java.util.UUID; import org.springframework.beans.factory.annotation.Value; diff --git a/src/main/java/com/dnd/gooding/token/ui/TokenController.java b/src/main/java/com/dnd/gooding/token/ui/TokenController.java index e191607..d99d154 100644 --- a/src/main/java/com/dnd/gooding/token/ui/TokenController.java +++ b/src/main/java/com/dnd/gooding/token/ui/TokenController.java @@ -1,7 +1,6 @@ package com.dnd.gooding.token.ui; import com.dnd.gooding.token.command.application.in.CreateTokenUseCase; -import com.dnd.gooding.token.command.domain.service.TokenService; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.CookieValue; import org.springframework.web.bind.annotation.PostMapping; diff --git a/src/main/java/com/dnd/gooding/user/command/application/in/CreateMemberUseCase.java b/src/main/java/com/dnd/gooding/user/command/application/in/CreateMemberUseCase.java index 5ee6591..2968361 100644 --- a/src/main/java/com/dnd/gooding/user/command/application/in/CreateMemberUseCase.java +++ b/src/main/java/com/dnd/gooding/user/command/application/in/CreateMemberUseCase.java @@ -2,5 +2,5 @@ public interface CreateMemberUseCase { - void create(String id, String oAuthId); + void create(String id, String oAuthId); } diff --git a/src/main/java/com/dnd/gooding/user/command/application/in/UpdateMemberUseCase.java b/src/main/java/com/dnd/gooding/user/command/application/in/UpdateMemberUseCase.java index 67ffda8..7a79e39 100644 --- a/src/main/java/com/dnd/gooding/user/command/application/in/UpdateMemberUseCase.java +++ b/src/main/java/com/dnd/gooding/user/command/application/in/UpdateMemberUseCase.java @@ -4,5 +4,5 @@ public interface UpdateMemberUseCase { - void updateMember(MemberRequest memberRequest); + void updateMember(MemberRequest memberRequest); } diff --git a/src/main/java/com/dnd/gooding/user/command/domain/Member.java b/src/main/java/com/dnd/gooding/user/command/domain/Member.java index 29039c9..2255002 100644 --- a/src/main/java/com/dnd/gooding/user/command/domain/Member.java +++ b/src/main/java/com/dnd/gooding/user/command/domain/Member.java @@ -8,7 +8,6 @@ import com.dnd.gooding.common.model.InterestSet; import com.dnd.gooding.oauth.command.domain.OAuthId; import com.dnd.gooding.user.exception.IdPasswordNotMatchingException; - import java.security.SecureRandom; import java.util.Random; import java.util.Set; diff --git a/src/main/java/com/dnd/gooding/user/command/domain/repository/MemberRepository.java b/src/main/java/com/dnd/gooding/user/command/domain/repository/MemberRepository.java index adee875..2504d4b 100644 --- a/src/main/java/com/dnd/gooding/user/command/domain/repository/MemberRepository.java +++ b/src/main/java/com/dnd/gooding/user/command/domain/repository/MemberRepository.java @@ -1,10 +1,9 @@ package com.dnd.gooding.user.command.domain.repository; -import java.util.Optional; -import org.springframework.data.repository.Repository; - import com.dnd.gooding.user.command.domain.Member; import com.dnd.gooding.user.command.domain.MemberId; +import java.util.Optional; +import org.springframework.data.repository.Repository; public interface MemberRepository extends Repository { diff --git a/src/main/java/com/dnd/gooding/user/command/domain/service/MemberService.java b/src/main/java/com/dnd/gooding/user/command/domain/service/MemberService.java index cb66530..6d7d6c7 100644 --- a/src/main/java/com/dnd/gooding/user/command/domain/service/MemberService.java +++ b/src/main/java/com/dnd/gooding/user/command/domain/service/MemberService.java @@ -2,14 +2,13 @@ import com.dnd.gooding.common.model.UserRole; import com.dnd.gooding.oauth.command.domain.OAuthId; -import com.dnd.gooding.user.command.application.in.UpdateMemberUseCase; -import com.dnd.gooding.user.ui.dto.request.MemberRequest; import com.dnd.gooding.user.command.application.in.CreateMemberUseCase; +import com.dnd.gooding.user.command.application.in.UpdateMemberUseCase; import com.dnd.gooding.user.command.domain.Member; import com.dnd.gooding.user.command.domain.MemberId; import com.dnd.gooding.user.command.domain.repository.MemberRepository; import com.dnd.gooding.user.exception.NoMemberException; - +import com.dnd.gooding.user.ui.dto.request.MemberRequest; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/src/main/java/com/dnd/gooding/user/ui/MyMemberController.java b/src/main/java/com/dnd/gooding/user/ui/MyMemberController.java index 0607d18..8b906ec 100644 --- a/src/main/java/com/dnd/gooding/user/ui/MyMemberController.java +++ b/src/main/java/com/dnd/gooding/user/ui/MyMemberController.java @@ -1,17 +1,15 @@ package com.dnd.gooding.user.ui; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import com.dnd.gooding.token.command.application.in.LogoutTokenUseCase; import com.dnd.gooding.token.command.domain.dto.JwtAuthentication; import com.dnd.gooding.user.command.application.in.UpdateMemberUseCase; -import com.dnd.gooding.user.ui.dto.request.MemberRequest; import com.dnd.gooding.user.query.application.MemberQueryService; import com.dnd.gooding.user.query.dto.MemberData; +import com.dnd.gooding.user.ui.dto.request.MemberRequest; import com.dnd.gooding.util.CookieUtil; - +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.core.Authentication; @@ -27,9 +25,9 @@ public class MyMemberController { private final LogoutTokenUseCase logoutTokenUseCase; public MyMemberController( - MemberQueryService memberQueryService, - UpdateMemberUseCase updateMemberUseCase, - LogoutTokenUseCase logoutTokenUseCase) { + MemberQueryService memberQueryService, + UpdateMemberUseCase updateMemberUseCase, + LogoutTokenUseCase logoutTokenUseCase) { this.memberQueryService = memberQueryService; this.updateMemberUseCase = updateMemberUseCase; this.logoutTokenUseCase = logoutTokenUseCase; @@ -49,9 +47,9 @@ public ResponseEntity member(@RequestBody MemberRequest memberRequest) { @DeleteMapping("/logout") public ResponseEntity logout( - HttpServletRequest request, HttpServletResponse response, Authentication authentication) { + HttpServletRequest request, HttpServletResponse response, Authentication authentication) { String refreshToken = - CookieUtil.getCookie(request, "refreshToken").map(Cookie::getValue).orElseThrow(); + CookieUtil.getCookie(request, "refreshToken").map(Cookie::getValue).orElseThrow(); logoutTokenUseCase.deleteRefreshToken(refreshToken); SecurityContextLogoutHandler logoutHandler = new SecurityContextLogoutHandler(); logoutHandler.logout(request, response, authentication); diff --git a/src/test/java/com/dnd/gooding/integration/user/command/MemberServiceIntegrationTest.java b/src/test/java/com/dnd/gooding/integration/user/command/MemberServiceIntegrationTest.java index 229c9ef..77a00c8 100644 --- a/src/test/java/com/dnd/gooding/integration/user/command/MemberServiceIntegrationTest.java +++ b/src/test/java/com/dnd/gooding/integration/user/command/MemberServiceIntegrationTest.java @@ -2,11 +2,11 @@ import com.dnd.gooding.integration.IntegrationTest; import com.dnd.gooding.oauth.command.domain.OAuthId; -import com.dnd.gooding.user.command.domain.service.MemberService; -import com.dnd.gooding.user.exception.NoMemberException; import com.dnd.gooding.user.command.domain.Member; import com.dnd.gooding.user.command.domain.MemberId; import com.dnd.gooding.user.command.domain.repository.MemberRepository; +import com.dnd.gooding.user.command.domain.service.MemberService; +import com.dnd.gooding.user.exception.NoMemberException; import javax.persistence.EntityManager; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayName; diff --git a/src/test/java/com/dnd/gooding/unit/user/command/application/MemberServiceTest.java b/src/test/java/com/dnd/gooding/unit/user/command/application/MemberServiceTest.java index 1e72ef5..1956e8a 100644 --- a/src/test/java/com/dnd/gooding/unit/user/command/application/MemberServiceTest.java +++ b/src/test/java/com/dnd/gooding/unit/user/command/application/MemberServiceTest.java @@ -1,7 +1,7 @@ package com.dnd.gooding.unit.user.command.application; -import com.dnd.gooding.user.command.domain.service.MemberService; import com.dnd.gooding.user.command.domain.repository.MemberRepository; +import com.dnd.gooding.user.command.domain.service.MemberService; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test;