main으로 develop의 최신 변경 내용 머지#42
Conversation
Summary of ChangesHello @ZaMan-O, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 Pull Request는 Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
이 PR은 EditMyPageReqDto와 SignupInformReqDto에서 profileImage 필드를 선택적으로 만들고 있습니다. SignupInformReqDto의 변경 사항은 회원가입 정보 입력 시 유연성을 더해주는 좋은 개선입니다. 하지만 EditMyPageReqDto의 변경은 현재 PATCH API 구현 방식과 맞물려 의도치 않게 사용자의 프로필 이미지를 삭제할 수 있는 잠재적인 문제를 가지고 있습니다. 이와 관련된 자세한 내용과 해결 방안을 리뷰 댓글로 남겼습니다.
| @NotNull String major, | ||
| @NotNull String introduce, | ||
| @NotNull String profileImage | ||
| String profileImage |
There was a problem hiding this comment.
프로필 이미지를 선택적 필드로 변경하면서 @NotNull 어노테이션을 제거한 것은 좋지만, 이로 인해 PATCH 요청 처리 시 데이터가 의도치 않게 손실될 위험이 있습니다.
현재 MyPageController의 editMyPage 엔드포인트는 @PatchMapping을 사용하지만, 서비스 로직은 DTO의 모든 필드로 사용자 정보를 덮어쓰고 있습니다. 이 때문에 클라이언트가 다른 정보만 수정하면서 profileImage 필드를 생략하면, 해당 필드가 null로 처리되어 기존 프로필 이미지가 삭제됩니다.
이를 방지하려면 서비스 레이어에서 null 값을 확인하고 선택적으로 필드를 업데이트해야 합니다. 예를 들어, profileImage가 null이면 기존 값을 유지하도록 할 수 있습니다.
수정 제안 예시 (EditMyPageService):
// ...
UserJpaEntity user = // ...
String finalProfileImage = reqDto.profileImage();
if (finalProfileImage == null) {
// profileImage가 요청에 포함되지 않은 경우, 기존 값을 유지합니다.
// 이렇게 하면 다른 필드를 업데이트할 때 이미지가 삭제되는 것을 방지할 수 있습니다.
finalProfileImage = user.getProfileImage();
}
// user.updateUserInformation(...) 호출 시 finalProfileImage 사용
// ...이러한 접근 방식은 이미지 삭제를 어떻게 처리할지에 대한 추가적인 고려가 필요합니다 (예: 빈 문자열을 삭제 신호로 사용). PATCH의 의미를 더 잘 살리려면 DTO 필드를 Optional로 감싸는 것도 좋은 대안입니다.
No description provided.