From f084eb3ff3b963eff4829192ac493aed62c98800 Mon Sep 17 00:00:00 2001 From: PicturePark1101 Date: Fri, 8 Nov 2024 13:32:04 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20=EB=94=94=EC=BD=94=20=EC=95=8C?= =?UTF-8?q?=EB=A6=BC=EB=A9=98=ED=8A=B8=20=EB=B3=80=EA=B2=BD=20#247?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../juinjang/external/discord/DiscordAlertProvider.java | 6 +++--- .../th/juinjang/external/discord/dto/DiscordAlert.java | 9 ++++----- .../java/umc/th/juinjang/service/auth/OAuthService.java | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/main/java/umc/th/juinjang/external/discord/DiscordAlertProvider.java b/src/main/java/umc/th/juinjang/external/discord/DiscordAlertProvider.java index ac38792..c2cc253 100644 --- a/src/main/java/umc/th/juinjang/external/discord/DiscordAlertProvider.java +++ b/src/main/java/umc/th/juinjang/external/discord/DiscordAlertProvider.java @@ -7,8 +7,8 @@ import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import umc.th.juinjang.apiPayload.code.status.ErrorStatus; -import umc.th.juinjang.apiPayload.code.status.SuccessStatus; import umc.th.juinjang.external.discord.dto.DiscordAlert; +import umc.th.juinjang.model.entity.Member; @RequiredArgsConstructor @Component @@ -18,9 +18,9 @@ public class DiscordAlertProvider { private final DiscordFeignClient discordFeignClient; private final Environment environment; - public void sendAlert(SuccessStatus successStatus) { + public void sendAlert(Member member) { if (Arrays.asList(environment.getActiveProfiles()).contains("prod")) { - sendAlertToDiscord(DiscordAlert.createAlert(successStatus.getMessage())); + sendAlertToDiscord(DiscordAlert.createAlert(member.getMemberId(), member.getProvider(), member.getNickname())); } } diff --git a/src/main/java/umc/th/juinjang/external/discord/dto/DiscordAlert.java b/src/main/java/umc/th/juinjang/external/discord/dto/DiscordAlert.java index 11a07e2..d7d80a7 100644 --- a/src/main/java/umc/th/juinjang/external/discord/dto/DiscordAlert.java +++ b/src/main/java/umc/th/juinjang/external/discord/dto/DiscordAlert.java @@ -1,10 +1,9 @@ package umc.th.juinjang.external.discord.dto; -public record DiscordAlert( - String content -) { +import umc.th.juinjang.model.entity.enums.MemberProvider; - public static DiscordAlert createAlert(String message) { - return new DiscordAlert(message); +public record DiscordAlert(String content) { + public static DiscordAlert createAlert(Long id, MemberProvider memberProvider, String nickname) { + return new DiscordAlert("주인장에 " +memberProvider+" "+id+"번째 유저 < "+nickname+" >님이 생겼어요!"); } } \ No newline at end of file diff --git a/src/main/java/umc/th/juinjang/service/auth/OAuthService.java b/src/main/java/umc/th/juinjang/service/auth/OAuthService.java index ee8c1ba..cc808ab 100644 --- a/src/main/java/umc/th/juinjang/service/auth/OAuthService.java +++ b/src/main/java/umc/th/juinjang/service/auth/OAuthService.java @@ -143,7 +143,7 @@ public LoginResponseDto kakaoSignUp (Long targetId, KakaoSignUpRequestDto kakaoS } // accessToken, refreshToken 발급 후 반환 - discordAlertProvider.sendAlert(SuccessStatus.DISCORD_ALERT_SIGN_IN); + discordAlertProvider.sendAlert(member); return createToken(member); } @@ -292,7 +292,7 @@ public LoginResponseDto appleSignUp(AppleSignUpRequestDto appleSignUpRequestDto) if(member == null) throw new MemberHandler(FAILED_TO_LOGIN); - discordAlertProvider.sendAlert(SuccessStatus.DISCORD_ALERT_SIGN_IN); + discordAlertProvider.sendAlert(member); return createToken(member); }