[Feat] 유저 정보 조회 및 수정 API 추가 - #20
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough내 정보 조회와 수정 API가 Changes내 정보 조회/수정 API
인증 실패 JSON 응답
Sequence Diagram(s)sequenceDiagram
participant Client
participant UserController
participant CustomUserDetails
participant UserService
participant UserRepository
participant User
Client->>UserController: GET /api/users/me
UserController->>CustomUserDetails: getId()
CustomUserDetails-->>UserController: userId
UserController->>UserService: getMyInfo(userId)
UserService->>UserRepository: findById(userId)
UserRepository-->>UserService: User
UserService-->>UserController: UserResponseDto
UserController-->>Client: ApiResponse.success(...)
Client->>UserController: PATCH /api/users/me
UserController->>CustomUserDetails: getId()
CustomUserDetails-->>UserController: userId
UserController->>UserService: updateMyInfo(userId, request)
UserService->>UserRepository: findById(userId)
UserRepository-->>UserService: User
UserService->>User: updateInfo(nickname, phone)
UserService-->>UserController: UserResponseDto
UserController-->>Client: ApiResponse.success(...)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/java/com/ilson/spotwork/domain/user/entity/User.java (1)
42-44: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win
updateInfo에서 공백 문자열 업데이트를 차단하는 게 안전합니다.현재는
""/" "도 유효 업데이트로 반영됩니다. 도메인 메서드에서hasText기준으로 막아두는 편이 무결성에 유리합니다.예시 수정안
+import org.springframework.util.StringUtils; public void updateInfo(String nickname, String phone) { - if (nickname != null) this.nickname = nickname; - if (phone != null) this.phone = phone; + if (StringUtils.hasText(nickname)) this.nickname = nickname.trim(); + if (StringUtils.hasText(phone)) this.phone = phone.trim(); }🤖 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/ilson/spotwork/domain/user/entity/User.java` around lines 42 - 44, The User.updateInfo method currently accepts empty or whitespace-only values as valid updates, so tighten the checks in updateInfo(String nickname, String phone) to ignore blank input by using a hasText-style condition before assigning nickname and phone. Keep the change localized to the User entity’s updateInfo logic so only meaningful non-empty values are applied and existing non-null behavior remains intact.
🤖 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.
Inline comments:
In `@src/main/java/com/ilson/spotwork/domain/user/dto/UserUpdateRequestDto.java`:
- Around line 5-10: `UserUpdateRequestDto`의 `nickname`과 `phone`에 필드 검증 어노테이션이 없어
`@Valid`가 실제로 동작하지 않습니다. `LoginRequestDto`, `SignupRequestDto`처럼 이 DTO에도 각 필드에
문자열 비어있음/형식 불일치를 막는 제약조건을 추가하고, `UserUpdateRequestDto`의 두 필드에 적절한 검증 어노테이션을 붙여
일관된 요청 검증이 되도록 수정하세요.
---
Nitpick comments:
In `@src/main/java/com/ilson/spotwork/domain/user/entity/User.java`:
- Around line 42-44: The User.updateInfo method currently accepts empty or
whitespace-only values as valid updates, so tighten the checks in
updateInfo(String nickname, String phone) to ignore blank input by using a
hasText-style condition before assigning nickname and phone. Keep the change
localized to the User entity’s updateInfo logic so only meaningful non-empty
values are applied and existing non-null behavior remains intact.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 7e659101-952e-4a46-9f2a-335497a4fbdf
📒 Files selected for processing (5)
src/main/java/com/ilson/spotwork/domain/user/controller/UserController.javasrc/main/java/com/ilson/spotwork/domain/user/dto/UserResponseDto.javasrc/main/java/com/ilson/spotwork/domain/user/dto/UserUpdateRequestDto.javasrc/main/java/com/ilson/spotwork/domain/user/entity/User.javasrc/main/java/com/ilson/spotwork/domain/user/service/UserService.java
관련 이슈
closes #9
구현 내용
내 정보 조회 및 수정 로직 구현
변경 사항
UserController 작성 (내 정보 조회, 수정)
UserResponseDto 작성
UserUpdateRequestDto 작성
UserService 작성
체크리스트
Summary by CodeRabbit