-
Notifications
You must be signed in to change notification settings - Fork 8
fix: 프로필 수정 API에서 닉네임, 이미지 부분 업데이트 가능하도록 수정 #268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: 프로필 수정 API에서 닉네임, 이미지 부분 업데이트 가능하도록 수정 #268
Conversation
Walkthrough
Suggested reviewers
✨ Finishing Touches
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:
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/main/java/com/example/solidconnection/siteuser/service/MyPageService.java (1)
49-66: 전체 업데이트 메서드 리뷰PATCH 요청의 특성을 잘 반영한 업데이트입니다! 부분 업데이트가 가능해졌습니다.
전체 메서드 흐름 개선
- 닉네임과 이미지 각각 독립적으로 업데이트 가능
- 변경 사항이 없을 때도 안전하게 처리
코드 효율성 제안
- 두 매개변수가 모두 null이거나 이미지가 비어있는 경우
siteUserRepository.save()호출을 건너뛰는 최적화를 고려해 보세요.boolean isUpdated = false; if (nickname != null) { // 기존 코드... isUpdated = true; } if (imageFile != null && !imageFile.isEmpty()) { // 기존 코드... isUpdated = true; } if (isUpdated) { siteUserRepository.save(siteUser); }이 개선 사항은 필수는 아니지만, 불필요한 데이터베이스 작업을 줄일 수 있습니다.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/main/java/com/example/solidconnection/siteuser/controller/MyPageController.java(1 hunks)src/main/java/com/example/solidconnection/siteuser/service/MyPageService.java(1 hunks)src/test/java/com/example/solidconnection/siteuser/service/MyPageServiceTest.java(0 hunks)
💤 Files with no reviewable changes (1)
- src/test/java/com/example/solidconnection/siteuser/service/MyPageServiceTest.java
🔇 Additional comments (3)
src/main/java/com/example/solidconnection/siteuser/controller/MyPageController.java (1)
34-35: 선택적 매개변수 업데이트로 API 유연성 개선!변경사항을 통해 프로필 수정 API가 더 유연해졌네요! 이제 사용자는 닉네임이나 이미지 중 하나만 선택적으로 수정할 수 있게 되었습니다.
이미지 파일 매개변수
required = false추가
- 이미지 변경 없이 닉네임만 변경 가능
닉네임 매개변수
required = false추가
- 닉네임 변경 없이 이미지만 변경 가능
PATCH 메서드의 의미에 맞게 부분 업데이트를 지원하도록 개선한 좋은 변경입니다! 👍
src/main/java/com/example/solidconnection/siteuser/service/MyPageService.java (2)
50-55: 닉네임 조건부 업데이트 로직 추가!이제 닉네임이 제공된 경우에만 업데이트하도록 변경되었네요! 명확한 조건 분기로 코드가 더 견고해졌습니다.
- null 체크 조건 추가
- 닉네임이 제공된 경우에만 유효성 검사 및 업데이트 실행
- 불필요한 검증 로직 스킵으로 성능 향상
한 가지 제안: 닉네임이 현재 값과 동일한 경우에도 불필요한 업데이트를 피하는 추가 체크를 고려해보세요.
57-64: 이미지 처리 로직 개선!이미지 파일 처리 로직이 더 견고해졌습니다! 조건부 처리와 기본 이미지 보존 로직이 잘 구현되었네요.
null 및 빈 파일 체크 추가
- 이미지가 제공된 경우에만 업로드 로직 실행
기본 이미지 보존 로직 추가
- 기본 이미지가 아닌 경우에만 기존 프로필 이미지 삭제
- 불필요한 S3 삭제 작업 방지로 리소스 절약
유연하고 효율적인 이미지 처리 방식으로 개선되었습니다! 👏
wibaek
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
관련 이슈
작업 내용
PATCH 메서드에 따라 전송한 리소스만 변경되게 수정하였습니다.
특이 사항
지원자 조회 e2e 테스트가 실패했는데 이건 영서님이 ci pr에서 수정하신 거 같습니다.
리뷰 요구사항 (선택)