[feat] #17 - 프로필 조회 - #19
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Walkthrough인증된 사용자의 내 프로필 조회 API가 추가되었다. 사용자 프로필 응답 DTO와 조회 서비스, 성공 코드가 도입되었고, User의 language 타입이 enum으로 바뀌었다. 인증 사용자 ID 접근 경로와 Swagger 보안 스킴도 함께 변경되었다. Changes내 프로필 조회 기능
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)
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 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
⛔ Files ignored due to path filters (1)
src/main/java/com/Timo/Timo/domain/user/docs/UserControllerDocs.javais excluded by!**/docs/**
📒 Files selected for processing (7)
src/main/java/com/Timo/Timo/domain/user/controller/UserController.javasrc/main/java/com/Timo/Timo/domain/user/dto/response/UserProfileResponse.javasrc/main/java/com/Timo/Timo/domain/user/entity/User.javasrc/main/java/com/Timo/Timo/domain/user/enums/Language.javasrc/main/java/com/Timo/Timo/domain/user/exception/UserSuccessCode.javasrc/main/java/com/Timo/Timo/domain/user/service/UserService.javasrc/main/java/com/Timo/Timo/global/config/SwaggerConfig.java
laura-jung
left a comment
There was a problem hiding this comment.
코리로 말씀드린 부분만 수정해주시면 좋을 ㄱ럿 같습니다. docs로 따로 swagger 처리하는거 깔끔하고 좋네요. 다른 부분들도 이렇게 맞추면 좋을 것 같습니다. 수고하셨습니다.
| public ResponseEntity<BaseResponse<UserProfileResponse>> getMyProfile( | ||
| @AuthenticationPrincipal CustomUserDetails userDetails | ||
| ) { | ||
| Long userId = extractUserId(userDetails); |
There was a problem hiding this comment.
p3) 현재 userDetails에서 매번 userId는 추출해서 사용하는 형태입니다. userId는 사용하는 곳이 많기 때문에 CustomUserDetails 파일에 getUserId 함수를 만들어 두면 이후에 Long userId = userDetails.getUserId(); 이런식으로 간단하게 꺼내서 사용할 수 있을 것 같습니다.
There was a problem hiding this comment.
넹 감사합니다. 바로 반영했습니다!
|
|
||
| import com.Timo.Timo.domain.user.entity.User; | ||
|
|
||
| public record UserProfileResponse( |
laura-jung
left a comment
There was a problem hiding this comment.
어푸드립니다. userdetails 수정해주셔서 감사합니다아
| public ResponseEntity<BaseResponse<UserProfileResponse>> getMyProfile( | ||
| @AuthenticationPrincipal CustomUserDetails userDetails | ||
| ) { | ||
| Long userId = userDetails.getUserId(); |
관련 이슈 🛠
작업 내용 요약 ✏️
주요 변경 사항 🛠️
폴더 구조:
트러블 슈팅 ⚽️
테스트 결과 📄
없음.
스크린샷 📷
리뷰 요구사항 📢
📎 참고 자료 (선택)
없음
Summary by CodeRabbit
Summary by CodeRabbit