From 9ec049629caadd6fbf7cd347a272e18bd4041c2b Mon Sep 17 00:00:00 2001 From: sunwoong Date: Fri, 19 Apr 2024 20:22:01 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EA=B0=80=EC=9E=85=EC=9E=90=20=EC=88=98?= =?UTF-8?q?=20=EC=B9=B4=EC=9A=B4=ED=8C=85=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20&=20event=20publisher=20=EC=9D=98=EC=A1=B4=EC=84=B1?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD=20(#160)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/doorip/user/service/UserService.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/doorip-api/src/main/java/org/doorip/user/service/UserService.java b/doorip-api/src/main/java/org/doorip/user/service/UserService.java index 36e55ff..828d13e 100644 --- a/doorip-api/src/main/java/org/doorip/user/service/UserService.java +++ b/doorip-api/src/main/java/org/doorip/user/service/UserService.java @@ -4,6 +4,7 @@ import org.doorip.auth.jwt.JwtProvider; import org.doorip.auth.jwt.JwtValidator; import org.doorip.auth.jwt.Token; +import org.doorip.event.SignUpEvent; import org.doorip.exception.ConflictException; import org.doorip.exception.EntityNotFoundException; import org.doorip.exception.InvalidValueException; @@ -11,14 +12,10 @@ import org.doorip.message.ErrorMessage; import org.doorip.message.EventMessage; import org.doorip.openfeign.apple.AppleOAuthProvider; -import org.doorip.openfeign.discord.DiscordMessageProvider; import org.doorip.openfeign.kakao.KakaoOAuthProvider; +import org.doorip.publisher.EventPublisher; import org.doorip.user.domain.*; -import org.doorip.user.dto.request.ResultUpdateRequest; -import org.doorip.user.dto.request.UserReissueRequest; -import org.doorip.user.dto.request.UserSignInRequest; -import org.doorip.user.dto.request.UserSignUpRequest; -import org.doorip.user.dto.request.ProfileUpdateRequest; +import org.doorip.user.dto.request.*; import org.doorip.user.dto.response.ProfileGetResponse; import org.doorip.user.dto.response.UserSignInResponse; import org.doorip.user.dto.response.UserSignUpResponse; @@ -46,7 +43,7 @@ public class UserService { private final JwtValidator jwtValidator; private final AppleOAuthProvider appleOAuthProvider; private final KakaoOAuthProvider kakaoOAuthProvider; - private final DiscordMessageProvider discordMessageProvider; + private final EventPublisher eventPublisher; @Transactional(readOnly = true) public void splash(Long userId) { @@ -71,7 +68,8 @@ public UserSignUpResponse signUp(String token, UserSignUpRequest request) { User savedUser = saveUser(request, platformId, enumPlatform); Token issueToken = jwtProvider.issueToken(savedUser.getId()); updateRefreshToken(issueToken.refreshToken(), savedUser); - discordMessageProvider.sendMessage(EventMessage.SIGN_UP_EVENT); + int userCount = userRepository.countUser(); + eventPublisher.publishSignUpEvent(SignUpEvent.of(EventMessage.SIGN_UP_EVENT, savedUser.getName(), userCount)); return UserSignUpResponse.of(issueToken, savedUser.getId()); }