Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REFACTOR] DiscordAlarmSender -> DiscordService interface로 교체 #282

Merged
merged 3 commits into from
May 8, 2024

Conversation

unanchoi
Copy link
Contributor

@unanchoi unanchoi commented May 7, 2024

Related issue 🚀

Work Description 💚

  • external module DiscordAlarmSender를 DiscordService interface를 정의하고 구현하도록 수정했습니다.
  • api module에서 DiscordService 인터페이스에 의존하도록 수정했습니다.
  • Social 로그인 부분은 조금 더 고민해보고 리팩토링 진행하겠습니다 ...!

@unanchoi unanchoi added REFACTOR New feature or request UNAN🐻 Unan 작업 labels May 7, 2024
@unanchoi unanchoi requested a review from thguss May 7, 2024 14:55
@unanchoi unanchoi self-assigned this May 7, 2024
Copy link
Member

@thguss thguss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다~

Comment on lines 53 to 64
@Transactional
public MemberUpdateServiceResponse updateUserProfile(final MemberServiceUpdateUserProfileRequest request) {
checkMemberDuplicate(request.username());
val member = memberFinder.findById(request.memberId());
updateTermAccepted(member, request);
@Transactional
public MemberUpdateServiceResponse updateUserProfile(final MemberServiceUpdateUserProfileRequest request) {
checkMemberDuplicate(request.username());
val member = memberFinder.findById(request.memberId());
updateTermAccepted(member, request);

ArrayList<Badge> badges = new ArrayList<>();
if (isNewMember(member)) {
addWelcomeBadge(member, badges);
discordAlarmSender.send(SIGN_IN_MESSAGE + member.getId(), INFO);
}
member.updateUsername(request.username());
ArrayList<Badge> badges = new ArrayList<>();
if (isNewMember(member)) {
addWelcomeBadge(member, badges);
discordService.send(SIGN_IN_MESSAGE + member.getId(), INFO);
}
member.updateUsername(request.username());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거 탭 사이즈가 안 맞는 것 같네용 🥹

@@ -0,0 +1,5 @@
package com.smeem.external.discord;

public interface DiscordService {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

인터페이스의 목적 중 하나가 계층 간 의존성을 줄이기 위함이라고 생각해요.
Discord라는 의존성을 드러내는 대신, AlarmService와 같이 목적성을 나타내는 네이밍은 어떤가요!?
Ex. 푸시알람은 NotificationService 인터페이스와 FcmNotificationService 구현체를 사용하고 있습니다!

Copy link
Contributor Author

@unanchoi unanchoi May 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NotificationService의 구현방향 통일성을 위해 수정하겠습니다 ~
그리고 리뷰에 대한 의견으로 AlarmService로 바꾸는 것이 코드적으로는 조금 더 추상화되어 있는 방향인 것에는 동의하는데, 프로젝트 관점에서는 DiscordService로 이후에 만약 알람 기능이 크게 확장되거나, 다른 알람이 추가 될 때 적용하는 방향도 고려해보면 좋을 것 같다는 생각이 들었습니다~
현재는 Discord 알람만 사용하고 있기 때문에, API module의 Service 계층과 ExceptionHandler에서 DiscordAlarm이라는 구체화된 의존성을 명시하고, 이후에 AlarmService 인터페이스를 구현한 다른 구현체가 추가 되는 등 확장을 고려했을 때 적절하게 인터페이스를 다시 정의하는 방향으로 고려해보는 것도 좋을 것 같다는 의견입니다~

@unanchoi unanchoi merged commit d30e709 into develop May 8, 2024
1 check passed
@unanchoi unanchoi deleted the unan#280 branch May 8, 2024 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
REFACTOR New feature or request UNAN🐻 Unan 작업
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REFACTOR] external module 인터페이스 분리
2 participants