Skip to content
Merged
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
Expand Up @@ -39,6 +39,8 @@ public class AuthService {
private final ApplicationEventPublisher eventPublisher;
private final NotificationUserClient notificationUserClient;
private final FilterRepository filterRepository;
private static final String TOKEN_PREFIX = "Bearer ";


@Transactional
public SignInResponse signIn(String socialAccessToken, SignInRequest request) {
Expand All @@ -61,11 +63,16 @@ public SignInResponse signIn(String socialAccessToken, SignInRequest request) {

@Transactional
public SignUpResponse signUp(String authId, SignUpRequest request) {
if (userRepository.existsByAuthIdAndAuthType(authId, request.authType())) {
String resolvedAuthId = authId;
if (resolvedAuthId != null && resolvedAuthId.startsWith(TOKEN_PREFIX)) {
resolvedAuthId = resolvedAuthId.substring(TOKEN_PREFIX.length());
}
Copy link

Copilot AI Aug 12, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider extracting the Bearer prefix removal logic into a separate private method like 'removeBearer(String authId)' to improve code readability and enable potential reuse in other methods.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

@jsoonworld jsoonworld Aug 12, 2025

Choose a reason for hiding this comment

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

리뷰 감사합니다! 좋은 제안을 주셨네요.

말씀해주신 것처럼 로직을 별도 메소드로 추출하는 것의 장점에 대해 충분히 공감합니다. 다만, 현재 이 로직이 매우 간단하고 signUp 메소드 내에서만 사용되고 있어서, 전체적인 흐름을 한눈에 파악하기 위해 메소드 내부에 두는 편이 더 낫다고 판단했습니다.

재사용 가능성에 대해서도 고려했지만, YAGNI(You Ain't Gonna Need It) 원칙에 따라 지금 당장 필요하지 않은 재사용을 위해 코드를 분리하기보다는 현재의 단순성을 유지하는 쪽을 선택했습니다.

물론 로직이 더 복잡해지거나 다른 곳에서도 필요해진다면, 말씀해주신 대로 메소드로 분리하는 것이 분명 좋은 리팩토링이 될 것 같습니다. 따라서 이 제안은 좋은 의견으로 참고하되, 현재 상태를 그대로 유지하도록 하겠습니다. 의견 감사합니다! 🙏


if (userRepository.existsByAuthIdAndAuthType(resolvedAuthId, request.authType())) {
throw new AuthException(AuthErrorCode.USER_ALREADY_EXIST);
}

User userToSave = User.from(authId, request);
User userToSave = User.from(resolvedAuthId, request);
userRepository.save(userToSave);

Token token = jwtProvider.generateTokens(userToSave.getId());
Expand Down
Loading