Skip to content

Conversation

@MinJuTur
Copy link
Collaborator

@MinJuTur MinJuTur commented Sep 25, 2025

학번, 학과 필드 추가

  • authresponse
  • authcontroller

수정했습니다.

Summary by CodeRabbit

  • 새 기능
    • 회원가입/로그인 성공 시 응답 본문에 토큰 외에 학번(studentId)과 학과(department) 정보를 함께 제공합니다. 클라이언트는 로그인 직후 사용자 프로필 표시, 맞춤형 화면 구성 등에 즉시 활용할 수 있습니다. 기존 필드는 유지되며 추가 필드는 선택적으로 소비 가능합니다. 실패 응답 및 로그아웃/토큰 검증 흐름은 변경되지 않아 기존 동작에 영향이 없습니다.

@coderabbitai
Copy link

coderabbitai bot commented Sep 25, 2025

Walkthrough

회원가입/로그인 성공 응답에 토큰과 함께 학생번호(studentId), 학과(department)를 포함하도록 응답 스키마와 컨트롤러 호출부를 동기화했다. 실패/기타 응답 경로는 유지되며, 로그아웃/검증 로직의 성공 페이로드는 변경되지 않았다.

Changes

Cohort / File(s) Change Summary
DTO: AuthResponse 확장
src/main/java/com/team/grade_checklist/domain/user/dto/response/AuthResponse.java
응답 필드에 studentId, department 추가. 정적 팩토리 메서드 success(token, studentId, department) 신설. 기존 success(token)/failure(message)는 신규 필드를 null로 초기화.
컨트롤러: 성공 응답 인자 확대
src/main/java/com/team/grade_checklist/domain/user/controller/AuthController.java
회원가입/로그인에서 AuthResponse.success(token) 호출을 success(token, studentId, department)로 변경. 실패 처리 및 로그아웃/검증 플로우는 로직 변화 없음.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Client
  participant A as AuthController
  participant S as AuthService
  participant R as AuthResponse

  rect rgba(220,235,245,0.5)
    note over C,A: 로그인/회원가입 요청
    C->>A: POST /auth/login or /auth/register (credentials)
    A->>S: authenticate/register(credentials)
    S-->>A: token, studentId, department
    A->>R: success(token, studentId, department)
    R-->>A: AuthResponse
    A-->>C: 200 OK { token, studentId, department }
  end

  rect rgba(245,225,225,0.5)
    note over C,A: 실패 경로(변경 없음)
    C->>A: 요청
    A->>R: failure(message)
    R-->>A: AuthResponse
    A-->>C: 4xx { message }
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

🛠 Improving

Suggested reviewers

  • kilometer0107

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed PR 제목 “[fix] dto에 학번, 학과 필드 추가”는 주요 변경사항인 DTO에 학번과 학과 필드를 추가한 작업을 명확하고 간결하게 요약하고 있어 제목 기준을 충족합니다.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-2-pr

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
src/main/java/com/team/grade_checklist/domain/user/controller/AuthController.java (2)

37-37: department 직렬화 값 확인 필요
user.getDepartment().toString() 결과가 API 클라이언트가 기대하는 학과 표기(예: 사용자 친화적인 문자열)와 일치하는지 확인해 주세요. Department가 enum이 아니라 엔티티/VO라면 기본 toString()이 객체 식별자(com.foo.Department@1a2b3c) 형태로 내려갈 수 있어 응답 품질이 저하될 수 있습니다. 필요 시 명시적인 필드(예: user.getDepartment().getName())를 사용해 주세요.


53-53: 로그인 응답도 동일한 직렬화 이슈 가능성
위와 동일하게 user.getDepartment().toString()이 기대 문자열을 반환하는지 확인해 주세요. 필요하다면 명시적인 학과명 접근자 사용을 권장합니다.

src/main/java/com/team/grade_checklist/domain/user/dto/response/AuthResponse.java (1)

21-23: message를 호출 측에서 제어할 수 있도록 확장 고려
지금은 성공 응답 팩토리 두 곳 모두 메시지를 "인증 성공"으로 고정하고 있습니다. 다른 성공 시나리오(로그인/회원가입 등)에서 메시지를 달리 내려야 한다면 확장성이 떨어질 수 있어, 필요 시 메시지를 인자로 받는 오버로드도 검토해 주세요.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f08b2b0 and a2eec57.

📒 Files selected for processing (2)
  • src/main/java/com/team/grade_checklist/domain/user/controller/AuthController.java (3 hunks)
  • src/main/java/com/team/grade_checklist/domain/user/dto/response/AuthResponse.java (1 hunks)

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