Skip to content

Conversation

@jiwon1217
Copy link
Collaborator

@jiwon1217 jiwon1217 commented Jul 14, 2025

🛰️ Issue Number

🪐 작업 내용

  • UserMapper 사용해서 SignupResponseDto 변환
  • UserService 리팩토링
    • 예외 메시지 수정
    • @transactional을 명시
    • validateDuplicateNickname 메서드를 validateNickname 내부에 위치시켜도 좋을 것 같다는 리뷰 사항에 대해 DB를 거치는 로직과 그렇지 않은 로직을 구별하기 위해서 분리했습니다. 그래서 조금 더 동작이 명확하게 드러나도록 각 메서드의 이름을 수정했습니다.
private void validateNicknameFormat(String nickname) {
        if (nickname == null || nickname.trim().isEmpty()) {
            throw new RuntimeException("E400002: 닉네임은 필수 입력입니다.");
        }
        if (nickname.length() > 6) {
            throw new RuntimeException("E400003: 닉네임은 6글자 이하로 입력해야 합니다.");
        }
        if (!nickname.matches("^[가-힣a-zA-Z0-9]+$")) {
            throw new RuntimeException("E400004: 한글, 영문, 숫자만 입력해주세요.");
        }
    }

    @Transactional(readOnly = true)
    public void validateNicknameDuplicate(String nickname) {
        if (userRepository.existsUserByNickname(nickname)) {
            throw new RuntimeException("E409001: 중복된 닉네임입니다.");
        }
    }
  • UserPrincipal 클래스 필드 수정
    • User -> AuthenticationUser
    • 필요한 사용자 정보만 담은 Dto로 수정
  • 인증 정보를 SecurityContextHolder에서 꺼내는 방식으로 분리
    • getCurrentUserPrincipal() 메서드 추가

📚 Reference

✅ Check List

  • 코드가 정상적으로 컴파일되나요?
  • 테스트 코드를 통과했나요?
  • merge할 브랜치의 위치를 확인했나요?
  • Label을 지정했나요?

@jiwon1217 jiwon1217 self-assigned this Jul 14, 2025
@jiwon1217 jiwon1217 added the refactoring 코드 리팩토링 label Jul 14, 2025
Copy link
Collaborator

@sehee123 sehee123 left a comment

Choose a reason for hiding this comment

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

제가 리뷰드렸던 내용이 알차게 반영되었네요. 수고하셨습니다 😇

@LimKangHyun
Copy link
Collaborator

고생하셨습니다!

Copy link
Collaborator

@silver-eunjoo silver-eunjoo left a comment

Choose a reason for hiding this comment

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

굉장합니다. 메서드 네이밍 덕분에 바로 어떤 로직을 수행하는 메서든지 파악하기 쉬워진 것 같습니다. 그리고 유틸 메서드도 감사합니다 ! :)

@dlsrks1021
Copy link
Collaborator

리뷰 반영 내용 확인했습니다!

이번 PR의 경우 같은 기능에 대해 feat과 refactor로 PR이 나눠진 것 같은데,
PR을 분리하는 것보다 feat에서 리뷰 사항을 반영하는 것도 좋았을 것 같습니다.

고생하셨습니다!

@dlsrks1021
Copy link
Collaborator

CI Test 실패 기록이 있는데, 확인할 필요가 있어보입니다.
또한 git emoji 잊지 말아주세요~

@jiwon1217 jiwon1217 merged commit 3699062 into prgrms-web-devcourse-final-project:dev Jul 14, 2025
@jiwon1217 jiwon1217 deleted the refactor/25 branch July 14, 2025 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring 코드 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants