Skip to content

[feat] 유저 정보 조회 API 구현 #90

Merged
seung-in-Yoo merged 9 commits into
mainfrom
feature/seungin
Jul 31, 2025
Merged

[feat] 유저 정보 조회 API 구현 #90
seung-in-Yoo merged 9 commits into
mainfrom
feature/seungin

Conversation

@seung-in-Yoo

@seung-in-Yoo seung-in-Yoo commented Jul 31, 2025

Copy link
Copy Markdown
Member

✔️ 연관 이슈

📝 작업 내용

  • 유저 정보 조회 API 구현 (GET /api/v1/users/info)
  • 인증된 유저의 상세 정보(닉네임, 생년월일, 성별, 유저타입, 장애유형, 이동보조수단, 프로필이미지) 조회 기능 추가
  • 등록/수정/조회 시 profileImageUrl 필드를 반영할 수 있도록 추가

🖼️ 스크린샷 (선택)

유저 정보 조회 성공

유저정보조회성공(1)

💬 리뷰 요구사항 (선택)

프론트에서 작업하게 구현해달라고 해서 바로 main으로 넘기겠습니다.

Summary by CodeRabbit

  • 신규 기능

    • 현재 인증된 사용자의 상세 정보를 조회할 수 있는 GET /info 엔드포인트가 추가되었습니다.
    • 사용자 정보 응답에 프로필 이미지 URL이 포함됩니다.
    • 사용자 프로필 이미지 URL이 등록 및 수정 시 반영됩니다.
  • 버그 수정

    • 사용자 정보가 존재하지 않을 때의 오류 메시지가 추가되었습니다.
  • 기타

    • 사용자 정보 등록 및 수정 시 프로필 이미지 URL 입력 필드가 임시로 추가되었습니다.

@seung-in-Yoo seung-in-Yoo self-assigned this Jul 31, 2025
@seung-in-Yoo seung-in-Yoo added the 💡 feature 기능 구현 및 개발 label Jul 31, 2025
@coderabbitai

coderabbitai Bot commented Jul 31, 2025

Copy link
Copy Markdown

Walkthrough

유저의 상세 정보를 조회할 수 있는 새로운 GET /info 엔드포인트가 UserController에 추가되었습니다. 이를 위해 UserInfoResponseDto가 새로 도입되었고, 서비스 및 DTO 계층에 프로필 이미지 URL 필드가 반영되었습니다. 예외 케이스 및 Swagger 명세도 보강되었습니다.

Changes

Cohort / File(s) Change Summary
User 정보 조회 API 및 컨트롤러 확장
src/main/java/com/wayble/server/user/controller/UserController.java
GET /info 엔드포인트 추가, Swagger 명세 보강, UserInfoResponseDto import 추가, 기존 PATCH 엔드포인트의 어노테이션 포맷 정리
User 정보 응답 DTO 신설
src/main/java/com/wayble/server/user/dto/UserInfoResponseDto.java
UserInfoResponseDto 클래스 신설, 유저 정보 응답 필드 및 Lombok 어노테이션 추가
User 정보 등록/수정 DTO 확장
src/main/java/com/wayble/server/user/dto/UserInfoRegisterRequestDto.java, src/main/java/com/wayble/server/user/dto/UserInfoUpdateRequestDto.java
profileImageUrl 필드 추가(임시), 관련 주석 추가
User 예외 케이스 확장
src/main/java/com/wayble/server/user/exception/UserErrorCase.java
USER_INFO_NOT_EXISTS 예외 케이스 추가(404, 1011)
User 정보 서비스 로직 확장
src/main/java/com/wayble/server/user/service/UserInfoService.java
getUserInfo(Long userId) 메서드 추가, 프로필 이미지 URL 처리 추가, 예외 처리 로직 추가 및 응답 DTO 매핑

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>
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Assessment against linked issues

Objective Addressed Explanation
유저 정보 조회 API 구현 및 명세 (#89)
예외 로직 구성 및 Swagger 명세 보강 (#89)
유저 정보 수정 API 명세 작성 (#89) 본 PR은 조회 API에 집중되어 있으며, 수정 API 명세에 대한 직접적 변경은 없음
유저 정보 수정 기능 구현 (#89) 수정 API 관련 직접적인 기능 추가는 없음

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
profileImageUrl 필드 추가 (src/main/java/com/wayble/server/user/dto/UserInfoRegisterRequestDto.java, src/main/java/com/wayble/server/user/dto/UserInfoUpdateRequestDto.java) 프로필 이미지 등록/수정은 본 이슈의 명확한 요구사항에는 포함되어 있지 않으나, 유저 정보 응답의 일환으로 간접적으로 관련될 수 있음. 다만, 명확히 명시된 목표는 아님.

Possibly related PRs

Poem

🐰
유저 정보 쏙쏙, GET으로 확인해요
닉네임, 생일, 이미지까지 담았죠
예외 처리 꼼꼼하게, Swagger로 친절하게
코드리뷰 달려와요, 토끼도 신나게!
🥕✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/seungin

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@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.

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.DefaultCollections.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

📥 Commits

Reviewing files that changed from the base of the PR and between a2ca784 and 40ed8a5.

📒 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.java
  • src/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 문서화가 모두 적절히 되어 있고 기존 패턴과 일관성을 유지하고 있습니다.

Comment thread src/main/java/com/wayble/server/user/exception/UserErrorCase.java Outdated
Comment thread src/main/java/com/wayble/server/user/service/UserInfoService.java

@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.

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 메서드가 적절히 구현되었으나, 몇 가지 개선 사항이 있습니다:

  1. 일관된 검증 로직: registerUserInfo와 동일한 검증 로직을 사용하여 일관성을 유지하고 있습니다.
  2. 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

📥 Commits

Reviewing files that changed from the base of the PR and between 40ed8a5 and 4266165.

📒 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 체크를 통해 불필요한 업데이트를 방지합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💡 feature 기능 구현 및 개발

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] 유저 정보 조회 API 구현

1 participant