Skip to content

Commit

Permalink
feat : 디코 알림멘트 변경 #247
Browse files Browse the repository at this point in the history
  • Loading branch information
PicturePark1101 committed Nov 8, 2024
1 parent a485903 commit f084eb3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()));
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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+" >님이 생겼어요!");
}
}
4 changes: 2 additions & 2 deletions src/main/java/umc/th/juinjang/service/auth/OAuthService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit f084eb3

Please sign in to comment.