Skip to content

refactor: 사용자 구조를 팀 레포지토리 기반 아키텍처에 맞게 정렬#12

Merged
buddle031 merged 2 commits into
mainfrom
feature/auth-login-clean
Apr 19, 2026
Merged

refactor: 사용자 구조를 팀 레포지토리 기반 아키텍처에 맞게 정렬#12
buddle031 merged 2 commits into
mainfrom
feature/auth-login-clean

Conversation

@buddle031
Copy link
Copy Markdown
Collaborator

✨ 작업 내용 한 줄 요약

  • 팀의 실용형 JPA 중심 구조에 맞게 과분리된 user 레이어를 정리하고, 사용자 권한(UserRole) 매핑을 복구했습니다

🛠️ 작업 내용

  • 도메인/JPA 완전 분리 구조를 팀 합의 방향(JPA 엔티티 활용)으로 정렬
  • Reader/Store, EntityMapper, persistence 분리 파일 제거 및 참조 정리
  • JpaRepository 중심 흐름으로 단순화
  • UserRole(USER, ADMIN) 복구
  • User 엔티티 role 필드/기본값 처리 복구
  • OAuth 로그인 및 토큰 재발급 시 role 반영 로직 복구
  • LayerDependencyTest, AuthFlowIntegrationTest를 현재 구조 기준으로 정렬
  • 예외 응답 구조 통일 작업(feat/api-response-exception-unify)은 본 브랜치 범위에서 제외

📚 참고 자료 (선택)

👀 리뷰 포인트 (선택)

Copy link
Copy Markdown
Contributor

@zxcv9203 zxcv9203 left a comment

Choose a reason for hiding this comment

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

기존 코드를 바로 머지하셔서 말씀을 못드렸는데 특정 기능을 개발하실 때는 어떤 기획적 요구사항이 있었고, 그걸 풀기 위해 어떤 점들을 고려하셨는지 PR 본문에 적어주셔야 리뷰어가 이해하고 리뷰를 진행할 수 있습니다.

리뷰어는 작성자가 어떤 요구사항을 어떻게 해석해서 풀어냈는지 알 수 없기 때문에, PR 본문만 보고도 충분히 맥락을 이해할 수 있도록 적어주시면 좋겠습니다.

Comment on lines +42 to +43
@DisplayName("application does not depend on entrypoint")
void application_should_not_depend_on_entrypoint() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

제가 작성했던 테스트 DisplayName을 영문으로 변경하셨는데 변경하신 이유가 있을까요?

별도의 이유가 없다면 한글로 작성하는게 이해하기 좋을 것 같습니다.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

별도 의도는 없었고 제 실수였습니다. 한글로 복원하겠습니다..!

Comment on lines +31 to +32
private final UserJpaRepository userJpaRepository;
private final SocialAccountJpaRepository socialAccountJpaRepository;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Repository 네이밍에 JPA라는 기술을 사용한다는걸 명시적으로 알려줄 필요는 없을 것 같아요

private final UserJpaRepository userJpaRepository;
private final SocialAccountJpaRepository socialAccountJpaRepository;

public UserProfileResponse getProfile(Long userId) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

아키텍처 규칙상 Application Layer에서 바로 Response를 반환하면 안됩니다.

별도의 DTO로 변환 후 컨트롤러에서 Response로 변환해주세요.

Comment on lines +65 to +67
if (this.role == null) {
this.role = UserRole.USER;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

onCreate, onUpdate에서 유저 권한을 할당하는 이유를 모르겠습니다.

할당하는 이유가 무엇일까요? 🤔

Comment on lines +64 to +65
new OAuth2Error("invalid_user_info"),
registrationId + " 사용자 식별자(providerUserId) 가져오지 못했습니다."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

이부분은 사용자에게 어떻게 핸들링되서 내려가게 되나요?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

현재 OAuth2 실패 핸들러는 별도 등록하지 않아 Spring Security 기본 failure flow(리다이렉트)로 처리되고 있습니다.
반면 성공은 OAuth2SuccessHandler에서 JSON을 직접 내려주고 있어 성공/실패 응답 방식이 혼재된 상태입니다.

응답 일관성을 위해 OAuth2 성공/실패를 한 방식으로 통일하는 게 맞다고 생각합니다.. 놓친부분 확인해 주셔서 감사합니다! 현재 브라우저 기반 소셜 로그인 흐름을 고려하면 리다이렉트 방식으로 맞추는 방향이 더 자연스럽다고 보고 있습니다.
리뷰 의견 주시면 성공 처리도 리다이렉트 기반으로 정리해 반영하겠습니다.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

넵 그리고 리다이렉트시에 어디로 보낼지는 프론트와 협의가 필요한 부분이니 이야기 나눠보시면 좋을 것 같습니다.

@buddle031 buddle031 merged commit be75dba into main Apr 19, 2026
2 of 3 checks passed
buddle031 added a commit that referenced this pull request Apr 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants