Conversation
- GET /notice/** permitAll 추가 - 상세조회를 서비스 레이어로 이동하여 LAZY 로딩 문제 해결 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello @k3vin7, 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은 공지사항 상세 조회 시 발생할 수 있는 500 에러를 해결하고 사용자 접근성을 개선합니다. 비로그인 사용자도 공지사항을 조회할 수 있도록 보안 설정을 완화하고, 상세 조회 로직을 서비스 계층으로 옮겨 지연 로딩 관련 문제를 방지합니다. 이를 통해 시스템의 안정성과 사용 편의성이 향상됩니다. 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. Changelog
Activity
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은 공지사항 상세 조회 시 발생하던 500 에러를 수정하고, 비로그인 사용자도 공지사항을 조회할 수 있도록 접근 권한을 변경하는 것을 목표로 합니다. 상세 조회 로직을 컨트롤러에서 서비스 계층으로 이동하여 트랜잭션 내에서 지연 로딩된 연관 엔티티에 접근하도록 변경함으로써 LazyInitializationException 문제를 해결한 점이 좋습니다. 또한, 테스트 코드도 이러한 변경에 맞게 잘 수정되었습니다.
리뷰에서는 테스트 코드의 재현성을 높이기 위한 개선점과, 공지사항 상세 조회 시 발생할 수 있는 N+1 쿼리 문제에 대한 성능 개선 방안을 제안했습니다. 전반적으로 PR의 목적을 잘 달성했으며, 코드 구조도 개선되었습니다.
| } | ||
|
|
||
| public NoticeDetailResponse getNoticeDetail(Long noticeId) { | ||
| Notice notice = entityUtils.getEntity(noticeId, Notice.class); |
There was a problem hiding this comment.
현재 구현은 Notice 엔티티를 조회한 후, NoticeDetailResponse로 변환하는 과정에서 notice.getUser()를 접근할 때 지연 로딩으로 인해 추가적인 쿼리가 발생할 수 있습니다. 이는 N+1 문제로 이어질 수 있습니다. Notice를 조회할 때 fetch join을 사용하여 연관된 User 엔티티를 함께 가져오는 것이 성능상 더 효율적입니다.
NoticeQueryRepository에 fetch join을 사용하는 새로운 조회 메서드(예: findByIdWithUser)를 추가하고, entityUtils.getEntity() 대신 해당 메서드를 사용하도록 수정하는 것을 고려해보세요.
| NoticeDetailResponse response = new NoticeDetailResponse( | ||
| 1L, "관리자", "https://example.com/profile.jpg", | ||
| "공지사항 제목", "공지사항 상세 내용입니다.", | ||
| List.of("https://example.com/image1.jpg"), LocalDateTime.now() | ||
| ); |
There was a problem hiding this comment.
테스트의 재현성을 보장하기 위해 LocalDateTime.now() 대신 고정된 시간 값을 사용하는 것이 좋습니다. 이렇게 하면 테스트 실행 시점과 관계없이 항상 동일한 응답을 기대할 수 있어 테스트 안정성이 향상됩니다.
| NoticeDetailResponse response = new NoticeDetailResponse( | |
| 1L, "관리자", "https://example.com/profile.jpg", | |
| "공지사항 제목", "공지사항 상세 내용입니다.", | |
| List.of("https://example.com/image1.jpg"), LocalDateTime.now() | |
| ); | |
| NoticeDetailResponse response = new NoticeDetailResponse( | |
| 1L, "관리자", "https://example.com/profile.jpg", | |
| "공지사항 제목", "공지사항 상세 내용입니다.", | |
| List.of("https://example.com/image1.jpg"), LocalDateTime.of(2024, 1, 1, 12, 0, 0) | |
| ); |
Summary
Test plan
🤖 Generated with Claude Code