Conversation
🚑 validator 누락 수정
🚑 openjdk17 폐기로 인한 이미지 변경
🚑 충돌 해결 시 발생한 코드 중복 수정
[FIX] merge to main
[FIX] cors security에 적용
merge to main
🚑 post 2개 이상인 경우 추가
merge to main
merge to main
🚑 if문 논리 오류 수정
로그인 배포로 병합
merge develop to main
bugfix : myreview exhibitionName
merge to main
merge to main
merge to main
✅ refresh토큰 2시간
[Release] merge to main
Summary of ChangesHello @jiminnimij, 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! 이 PR은 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은 Exhibition 엔티티에 @Setter를 추가하고 CommentErrorCode 파일의 서식을 정리하는 변경 사항을 포함합니다.
JPA 엔티티에 @Setter를 무분별하게 추가하는 것은 캡슐화를 해치고 객체의 일관성을 깨뜨릴 수 있어 일반적으로 권장되지 않습니다. 엔티티의 상태 변경은 비즈니스 로직을 포함하는 특정 메서드를 통해 이루어져야 합니다. 이에 대한 자세한 피드백을 Exhibition.java 파일에 남겼습니다.
또한, 불필요한 공백 라인을 제거하는 간단한 서식 수정에 대한 의견도 제시했습니다.
|
|
||
| @Entity | ||
| @Getter | ||
| @Setter |
There was a problem hiding this comment.
JPA 엔티티에 @Setter를 사용하는 것은 객체의 캡슐화를 깨뜨릴 수 있어 신중해야 합니다. 엔티티의 상태는 외부에서 직접 변경하는 것이 아니라, 명확한 의도를 가진 비즈니스 메서드를 통해 변경하는 것이 좋습니다. 예를 들어, increaseScrapCount()와 같은 메서드는 좋은 예시입니다.
@Setter를 사용하면 ExhibitionService의 updateExhibition 메서드처럼 어디서든 엔티티의 필드를 제약 없이 수정할 수 있게 되어, 객체의 일관성이 깨지거나 예기치 않은 버그가 발생할 수 있습니다.
@Setter를 제거하고, ExhibitionService에서 필요한 업데이트 로직을 Exhibition 엔티티 내의 메서드로 옮기는 것을 권장합니다. 이렇게 하면 Exhibition 엔티티가 자신의 상태 변경을 직접 제어하게 되어 더 견고하고 유지보수하기 좋은 코드가 됩니다.
예를 들어, Exhibition 엔티티에 다음과 같은 업데이트 메서드를 추가할 수 있습니다.
// In Exhibition.java
public void updateExhibitionName(String exhibitionName) {
this.exhibitionName = exhibitionName;
}
public void updatePosterUrl(String posterUrl) {
this.posterUrl = posterUrl;
}
// ... 다른 필드에 대한 업데이트 메서드들그리고 ExhibitionService에서는 이 메서드들을 호출합니다.
// In ExhibitionService.java
// ... in updateExhibition method
updateIfPresent(request.getExhibitionName(), exhibition::updateExhibitionName);
updateIfPresent(request.getPosterUrl(), url -> exhibition.updatePosterUrl(s3UrlHandler.extractKeyFromUrl(url)));
// ...이 방식은 각 필드 변경에 대한 명시적인 메서드를 제공하여 코드의 의도를 더 명확하게 만듭니다.
|
|
||
|
|
#️⃣ 연관된 이슈
#️⃣ 작업 내용
#️⃣ 테스트 결과
#️⃣ 변경 사항 체크리스트
#️⃣ 스크린샷 (선택)
#️⃣ 리뷰 요구사항 (선택)
📎 참고 자료 (선택)