Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package life.mosu.mosuserver.application.notify;

import life.mosu.mosuserver.domain.profile.repository.ProfileJpaRepository;
import life.mosu.mosuserver.domain.user.repository.UserJpaRepository;
import life.mosu.mosuserver.global.exception.CustomRuntimeException;
import life.mosu.mosuserver.global.exception.ErrorCode;
import life.mosu.mosuserver.infra.notify.DiscordNotifier;
Expand All @@ -21,7 +21,7 @@
@RequiredArgsConstructor
public class NotifyService {

private final ProfileJpaRepository profileJpaRepository;
private final UserJpaRepository userJpaRepository;
private final NotifySenderResolver senderResolver;
private final NotifyVariableFactory notifyVariableFactory;
private final DiscordNotifier discordNotifier;
Expand Down Expand Up @@ -55,7 +55,7 @@ public void recover(CustomRuntimeException exception, LunaNotificationEvent even
}

private String retrievePhoneNumberByUserId(Long userId) {
return profileJpaRepository.findByUserId(userId)
return userJpaRepository.findById(userId)

Choose a reason for hiding this comment

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

high

이 줄에서 userJpaRepository를 사용하도록 변경되었으므로, 관련 로직도 함께 수정되어야 합니다. 유저를 찾지 못했을 경우, 다음 줄에서 ErrorCode.PROFILE_NOT_FOUND 예외가 발생하는데, 이는 혼란을 줄 수 있습니다. ErrorCode.USER_NOT_FOUND를 사용하도록 수정하는 것이 좋습니다.

제안:
다음 줄의 .orElseThrow(...) 부분을 아래와 같이 수정해주세요.

.orElseThrow(() -> new CustomRuntimeException(ErrorCode.USER_NOT_FOUND))

.orElseThrow(() -> new CustomRuntimeException(ErrorCode.PROFILE_NOT_FOUND))
.getPhoneNumberWithoutHyphen();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,8 @@ public void changePassword(String newPassword) {
public String getPhoneNumber() {
return phoneNumber.replaceFirst("^[UG]", "");
}

public String getPhoneNumberWithoutHyphen() {
return getPhoneNumber().replaceAll("-", "");
}
}