[feat] 유저 정보 조회 API 구현 #90
Conversation
Walkthrough유저의 상세 정보를 조회할 수 있는 새로운 GET Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant UserController
participant UserInfoService
participant UserRepository
Client->>UserController: GET /info (with auth)
UserController->>UserInfoService: getUserInfo(userId)
UserInfoService->>UserRepository: findById(userId)
UserRepository-->>UserInfoService: User Entity
UserInfoService-->>UserController: UserInfoResponseDto
UserController-->>Client: CommonResponse<UserInfoResponseDto>
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
Possibly related PRs
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (3)
src/main/java/com/wayble/server/user/dto/UserInfoResponseDto.java (3)
10-20: Swagger/Jackson 어노테이션 추가 권장
DTO가 외부로 직렬화-응답되는 용도라면@Schema(swagger-ui) 및@JsonInclude(Include.NON_NULL)를 붙여 null 필드가 노출되지 않도록 하는 편이 좋습니다.+import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; ... -@Getter -@Builder -public class UserInfoResponseDto { +@Getter +@Builder +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(description = "유저 상세 정보 응답 DTO") +public class UserInfoResponseDto {
17-18: List 필드 복수형 네이밍 권장
disabilityType,mobilityAid는 둘 다 다중 선택 값이므로 복수형(disabilityTypes,mobilityAids)이 더 직관적입니다. API 스펙과 맞춰 보시는 것을 권장합니다.
17-19: 빈 리스트 기본값 지정 고려
Builder를 통해 값이 주입되지 않으면 두 리스트가 null이 될 수 있습니다. 응답에서 null 대신 빈 배열을 내려주면 클라이언트 측 null-check 부담이 줄어듭니다.@Builder.Default와Collections.emptyList()사용을 검토해 주세요.- private List<String> disabilityType; // 복수 선택 가능 - private List<String> mobilityAid; // 복수 선택 가능 + @Builder.Default + private List<String> disabilityType = Collections.emptyList(); // 복수 선택 가능 + @Builder.Default + private List<String> mobilityAid = Collections.emptyList(); // 복수 선택 가능
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
src/main/java/com/wayble/server/user/controller/UserController.java(3 hunks)src/main/java/com/wayble/server/user/dto/UserInfoRegisterRequestDto.java(1 hunks)src/main/java/com/wayble/server/user/dto/UserInfoResponseDto.java(1 hunks)src/main/java/com/wayble/server/user/dto/UserInfoUpdateRequestDto.java(1 hunks)src/main/java/com/wayble/server/user/exception/UserErrorCase.java(1 hunks)src/main/java/com/wayble/server/user/service/UserInfoService.java(4 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: java에서 같은 패키지 내의 클래스들은 import 구문 없이 서로를 참조할 수 있다. com.wayble.server.user.entity 패키지 내의 클래스들은 명시적인 im...
Learnt from: seung-in-Yoo
PR: Wayble-Project/wayble-spring#37
File: src/main/java/com/wayble/server/user/entity/User.java:61-62
Timestamp: 2025-07-13T15:08:59.318Z
Learning: Java에서 같은 패키지 내의 클래스들은 import 구문 없이 서로를 참조할 수 있다. com.wayble.server.user.entity 패키지 내의 클래스들은 명시적인 import 없이 사용 가능하다.
Applied to files:
src/main/java/com/wayble/server/user/controller/UserController.javasrc/main/java/com/wayble/server/user/service/UserInfoService.java
🔇 Additional comments (5)
src/main/java/com/wayble/server/user/service/UserInfoService.java (2)
42-42: LGTM!사용자 등록 시 프로필 이미지 URL을 적절히 설정하고 있습니다.
84-87: LGTM!프로필 이미지 URL 업데이트 로직이 올바르게 구현되어 있으며, null 체크를 통해 선택적 업데이트를 지원합니다.
src/main/java/com/wayble/server/user/controller/UserController.java (3)
6-6: LGTM!새로운 응답 DTO 임포트가 적절히 추가되었습니다.
71-71: LGTM!어노테이션 포매팅 변경이 코드 가독성을 향상시킵니다.
91-105: 사용자 정보 조회 API 구현 완료새로운 GET
/info엔드포인트가 잘 구현되었습니다. 인증 처리, 에러 핸들링, Swagger 문서화가 모두 적절히 되어 있고 기존 패턴과 일관성을 유지하고 있습니다.
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (1)
src/main/java/com/wayble/server/user/service/UserInfoService.java (1)
30-30: 일관된 검증 로직으로 개선됨이전 리뷰 피드백을 바탕으로 닉네임뿐만 아니라 생년월일과 성별까지 포함한 포괄적인 검증 로직으로 개선되었습니다. 이는 부분적으로 등록된 사용자 정보를 더 정확하게 감지할 수 있게 합니다.
🧹 Nitpick comments (1)
src/main/java/com/wayble/server/user/service/UserInfoService.java (1)
106-122: 사용자 정보 조회 메서드 구현 검토새로 추가된
getUserInfo메서드가 적절히 구현되었으나, 몇 가지 개선 사항이 있습니다:
- 일관된 검증 로직: registerUserInfo와 동일한 검증 로직을 사용하여 일관성을 유지하고 있습니다.
- null 체크 중복: Line 115에서
user.getBirthDate() != null체크가 불필요합니다. Line 110에서 이미 null 체크를 완료했기 때문입니다.다음과 같이 개선할 수 있습니다:
return UserInfoResponseDto.builder() .nickname(user.getNickname()) - .birthDate(user.getBirthDate() != null ? user.getBirthDate().toString() : null) + .birthDate(user.getBirthDate().toString()) .gender(user.getGender()) .userType(user.getUserType()) .disabilityType(user.getDisabilityType()) .mobilityAid(user.getMobilityAid()) .profileImageUrl(user.getProfileImageUrl()) .build();
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/main/java/com/wayble/server/user/dto/UserInfoRegisterRequestDto.java(2 hunks)src/main/java/com/wayble/server/user/dto/UserInfoUpdateRequestDto.java(2 hunks)src/main/java/com/wayble/server/user/exception/UserErrorCase.java(1 hunks)src/main/java/com/wayble/server/user/service/UserInfoService.java(5 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- src/main/java/com/wayble/server/user/dto/UserInfoUpdateRequestDto.java
- src/main/java/com/wayble/server/user/exception/UserErrorCase.java
- src/main/java/com/wayble/server/user/dto/UserInfoRegisterRequestDto.java
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: java에서 같은 패키지 내의 클래스들은 import 구문 없이 서로를 참조할 수 있다. com.wayble.server.user.entity 패키지 내의 클래스들은 명시적인 im...
Learnt from: seung-in-Yoo
PR: Wayble-Project/wayble-spring#37
File: src/main/java/com/wayble/server/user/entity/User.java:61-62
Timestamp: 2025-07-13T15:08:59.318Z
Learning: Java에서 같은 패키지 내의 클래스들은 import 구문 없이 서로를 참조할 수 있다. com.wayble.server.user.entity 패키지 내의 클래스들은 명시적인 import 없이 사용 가능하다.
Applied to files:
src/main/java/com/wayble/server/user/service/UserInfoService.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: run-docker-image-on-ec2
🔇 Additional comments (3)
src/main/java/com/wayble/server/user/service/UserInfoService.java (3)
6-6: 새로운 DTO import 추가 확인됨UserInfoResponseDto import가 새로 추가되어 getUserInfo 메서드에서 사용될 준비가 되었습니다.
42-42: 프로필 이미지 URL 설정 추가됨사용자 등록 시 프로필 이미지 URL을 설정하는 로직이 추가되었습니다.
updateProfileImageUrl메서드를 사용하여 적절한 캡슐화를 유지하고 있습니다.
84-87: 조건부 프로필 이미지 업데이트 로직프로필 이미지 URL이 제공된 경우에만 업데이트하는 조건부 로직이 적절하게 구현되었습니다. null 체크를 통해 불필요한 업데이트를 방지합니다.
✔️ 연관 이슈
📝 작업 내용
🖼️ 스크린샷 (선택)
유저 정보 조회 성공
💬 리뷰 요구사항 (선택)
Summary by CodeRabbit
신규 기능
버그 수정
기타