Skip to content

[feat] #17 - 프로필 조회 - #19

Merged
aneykrap merged 4 commits into
developfrom
feat/#17-get-my-profile
Jul 7, 2026
Merged

aneykrap merged 4 commits into
developfrom
feat/#17-get-my-profile

Conversation

@aneykrap

@aneykrap aneykrap commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

관련 이슈 🛠

작업 내용 요약 ✏️

  • 사용자 프로필 조회 API를 구현하고 Swagger 명세를 별도 인터페이스로 분리했습니다.

주요 변경 사항 🛠️

  • GET /user 내 프로필 조회 API 구현
  • JWT 인증 정보에서 사용자 ID 추출
  • 사용자 조회 및 UserProfileResponse 변환 로직 구현
  • 사용자 미존재 시 USER_404 예외 처리
  • Swagger Bearer 인증 설정 추가
  • Swagger 명세 작성
  • UserControllerDocs로 Swagger 문서와 Controller 로직 분리
  • User 엔티티 language 필드 타입 enum으로 변경

폴더 구조:

  domain/user/
  ├── controller/
  │   ├── UserController.java
  │   └── UserProfileBaseResponse.java
  ├── docs/
  │   └── UserControllerDocs.java
  ├── dto/response/
  │   └── UserProfileResponse.java
  ├── entity/
  │   └── User.java
  ├── exception/code/
  │   ├── UserErrorCode.java
  │   └── UserSuccessCode.java
  └── service/
      └── UserService.java

트러블 슈팅 ⚽️

  • 가독성 문제로 프로필 조회 명세를 UserControllerDocs 인터페이스로 분리해 Controller에는 요청 처리 로직만 남겼습니다!
  • Authentication 객체가 Swagger 요청 파라미터로 노출되지 않도록 @parameter(hidden = true)를 적용했습니다.

테스트 결과 📄

없음.

스크린샷 📷

  • Access Token 이 아직 입력되지 않아 401 나옵니당
스크린샷 2026-07-06 오후 11 23 32

리뷰 요구사항 📢

  • 프로필 조회 API의 전체적인 패키지 구조와 계층별 책임 분리가 적절한지 확인 부탁드립니당
  • 예외 처리와 응답 구조가 프로젝트의 컨벤션과 일관되는지 확인 부탁드립니당 (저도 한번 확인해보긴 했는데 더블 체크 해주시면 감사하겠습니당)

📎 참고 자료 (선택)

없음

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • 로그인한 사용자가 내 프로필을 조회할 수 있는 엔드포인트가 추가되었습니다.
    • 프로필 응답에 사용자 식별 정보와 언어/캘린더 연결 상태가 포함됩니다.
  • Improvements
    • 사용자 언어 설정을 KO/EN enum 기반으로 정리했습니다.
    • Swagger 문서에서 Bearer(JWT) 보안 스킴이 표시되도록 업데이트했습니다.
    • 인증 성공 시 사용자 식별 정보 처리 방식이 정돈되었습니다.

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 690a4693-762a-4db0-86e8-b3dab3011c0e

📥 Commits

Reviewing files that changed from the base of the PR and between 2f1cdd2 and 2cf206c.

📒 Files selected for processing (3)
  • src/main/java/com/Timo/Timo/domain/user/controller/UserController.java
  • src/main/java/com/Timo/Timo/global/auth/handler/OAuthSuccessHandler.java
  • src/main/java/com/Timo/Timo/global/auth/principal/CustomUserDetails.java

Walkthrough

인증된 사용자의 내 프로필 조회 API가 추가되었다. 사용자 프로필 응답 DTO와 조회 서비스, 성공 코드가 도입되었고, User의 language 타입이 enum으로 바뀌었다. 인증 사용자 ID 접근 경로와 Swagger 보안 스킴도 함께 변경되었다.

Changes

내 프로필 조회 기능

Layer / File(s) Summary
User 엔티티 language 필드 타입 변경
.../entity/User.java, .../enums/Language.java
language 필드가 String에서 Language(KO, EN) enum으로 변경되고 @Enumerated, @Column 매핑이 명시됐으며, 다른 필드들의 컬럼 속성도 재정의됐다.
프로필 응답 DTO 및 서비스 구현
.../dto/response/UserProfileResponse.java, .../exception/UserSuccessCode.java, .../service/UserService.java
UserProfileResponse record와 from(User) 변환 메서드, UserSuccessCode.PROFILE_RETRIEVED, UserService.getMyProfile이 추가되어 사용자 조회 및 응답 변환을 처리한다.
인증 사용자 ID 조회 경로 변경
.../auth/principal/CustomUserDetails.java, .../auth/handler/OAuthSuccessHandler.java
CustomUserDetails.getUserId()가 추가되고, OAuth 성공 처리에서 사용자 식별자를 새 접근자로 읽도록 변경됐다.
프로필 조회 엔드포인트
.../controller/UserController.java
GET /api/v1/users에서 인증 사용자 ID를 읽어 UserService를 호출하고 BaseResponse로 감싸 반환한다.
Swagger 보안 스킴 설정
.../global/config/SwaggerConfig.java
customOpenAPI()bearerAuth HTTP bearer(JWT) 보안 스킴이 components.securitySchemes에 등록됐다.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant UserController
  participant CustomUserDetails
  participant UserService
  participant UserRepository

  Client->>UserController: GET /api/v1/users (with auth)
  UserController->>CustomUserDetails: getUserId()
  CustomUserDetails-->>UserController: userId
  UserController->>UserService: getMyProfile(userId)
  UserService->>UserRepository: findById(userId)
  UserRepository-->>UserService: User
  UserService-->>UserController: UserProfileResponse
  UserController-->>Client: BaseResponse(200 OK)
Loading

Possibly related PRs

  • Team-Timo/Timo-Server#14: CustomUserDetails.getUserId()OAuthSuccessHandler의 사용자 식별자 조회 변경이 이 PR의 인증 사용자 ID 경로 변경과 직접 연결된다.

Suggested reviewers: laura-jung

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목이 프로필 조회 기능 추가라는 핵심 변경을 간결하게 잘 요약합니다.
Linked Issues check ✅ Passed #17의 프로필 조회 기능 요구를 API, 서비스, DTO 추가로 충족합니다.
Out of Scope Changes check ✅ Passed Swagger 인증 설정과 엔티티 enum 변경도 프로필 조회 기능을 지원하는 범위로 보여 추가적인 무관 변경은 보이지 않습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/#17-get-my-profile

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/main/java/com/Timo/Timo/domain/user/controller/UserController.java (1)

42-53: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

인증 사용자 ID 추출 로직 재사용성 고려

extractUserId는 이 컨트롤러에만 존재하는 로직인데, 향후 다른 도메인 컨트롤러에서도 인증 사용자 정보를 추출해야 할 가능성이 높습니다. HandlerMethodArgumentResolver나 커스텀 @CurrentUserId 어노테이션으로 추출해두면 중복을 줄이고 재사용성을 높일 수 있습니다. 필수는 아니며, 현재 단일 사용처에서는 문제없습니다.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/java/com/Timo/Timo/domain/user/controller/UserController.java`
around lines 42 - 53, The user ID extraction logic in
UserController.extractUserId is currently controller-local and may be duplicated
in future controllers. Consider moving this into a reusable mechanism such as a
HandlerMethodArgumentResolver or a custom `@CurrentUserId` annotation, so other
controllers can inject the authenticated user ID directly. Keep the existing
null/unauthorized handling behavior, but centralize the extraction logic in a
shared component instead of leaving it only in UserController.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/main/java/com/Timo/Timo/domain/user/controller/UserController.java`:
- Around line 42-53: The user ID extraction logic in
UserController.extractUserId is currently controller-local and may be duplicated
in future controllers. Consider moving this into a reusable mechanism such as a
HandlerMethodArgumentResolver or a custom `@CurrentUserId` annotation, so other
controllers can inject the authenticated user ID directly. Keep the existing
null/unauthorized handling behavior, but centralize the extraction logic in a
shared component instead of leaving it only in UserController.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9e7843df-6f68-4748-aa6c-9e6fc525c30e

📥 Commits

Reviewing files that changed from the base of the PR and between cfa847a and 2f1cdd2.

⛔ Files ignored due to path filters (1)
  • src/main/java/com/Timo/Timo/domain/user/docs/UserControllerDocs.java is excluded by !**/docs/**
📒 Files selected for processing (7)
  • src/main/java/com/Timo/Timo/domain/user/controller/UserController.java
  • src/main/java/com/Timo/Timo/domain/user/dto/response/UserProfileResponse.java
  • src/main/java/com/Timo/Timo/domain/user/entity/User.java
  • src/main/java/com/Timo/Timo/domain/user/enums/Language.java
  • src/main/java/com/Timo/Timo/domain/user/exception/UserSuccessCode.java
  • src/main/java/com/Timo/Timo/domain/user/service/UserService.java
  • src/main/java/com/Timo/Timo/global/config/SwaggerConfig.java

@laura-jung laura-jung left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

코리로 말씀드린 부분만 수정해주시면 좋을 ㄱ럿 같습니다. docs로 따로 swagger 처리하는거 깔끔하고 좋네요. 다른 부분들도 이렇게 맞추면 좋을 것 같습니다. 수고하셨습니다.

public ResponseEntity<BaseResponse<UserProfileResponse>> getMyProfile(
@AuthenticationPrincipal CustomUserDetails userDetails
) {
Long userId = extractUserId(userDetails);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

p3) 현재 userDetails에서 매번 userId는 추출해서 사용하는 형태입니다. userId는 사용하는 곳이 많기 때문에 CustomUserDetails 파일에 getUserId 함수를 만들어 두면 이후에 Long userId = userDetails.getUserId(); 이런식으로 간단하게 꺼내서 사용할 수 있을 것 같습니다.

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.

넹 감사합니다. 바로 반영했습니다!


import com.Timo.Timo.domain.user.entity.User;

public record UserProfileResponse(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

레코드 사용 좋습니다앙

@Jy000n Jy000n left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

고생하셨습니다-!!
스웨거도 엄청 꼼꼼히 적어주셨네요..!! 저도 참고해서 반영해야겠어요ㅎㅎ
(다른 코리 하나는 대면으로 여쭤보면서 해결돼서 지웠습니다..!! 제가 잘못 이해하고 있었어욯)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

옹 제가 놓쳤던 부분들 추가해주셔서 감사합니당 :)

@aneykrap
aneykrap requested review from Jy000n and laura-jung July 6, 2026 17:19

@laura-jung laura-jung left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

어푸드립니다. userdetails 수정해주셔서 감사합니다아

public ResponseEntity<BaseResponse<UserProfileResponse>> getMyProfile(
@AuthenticationPrincipal CustomUserDetails userDetails
) {
Long userId = userDetails.getUserId();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

구욷 좋습니다앙

@github-actions github-actions Bot added the slack-approval-notified Slack 승인 완료 알림 중복 방지용 라벨 label Jul 7, 2026
@aneykrap
aneykrap merged commit 1bcea6d into develop Jul 7, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ feat slack-approval-notified Slack 승인 완료 알림 중복 방지용 라벨 🌵 예나

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] 내 프로필 조회 (구글 계정 정보) API 구현

3 participants