hotfix: @Where 어노테이션 임시 수정#239
Conversation
Summary of ChangesHello @yongjun0511, 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은 Partnership 엔티티의 @where 어노테이션을 임시로 수정하는 핫픽스입니다. 기존에 start_date와 end_date를 모두 고려하던 조건에서 start_date 조건을 제거하여, 현재 날짜 이후에 종료되는 모든 파트너십이 올바르게 조회되도록 변경했습니다. 이는 특정 시나리오에서 파트너십 조회가 제대로 이루어지지 않던 문제를 해결하기 위한 임시 조치로 보입니다. HighlightsUsing 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
|
| @Builder | ||
| @AllArgsConstructor | ||
| @Where(clause = "start_date <= CURRENT_DATE AND end_date >= CURRENT_DATE") | ||
| @Where(clause = "end_date >= CURRENT_DATE") |
There was a problem hiding this comment.
이 변경으로 인해 아직 시작되지 않은 제휴도 조회 결과에 포함되게 됩니다. 이는 의도된 동작으로 보입니다.
다만 @Where 어노테이션은 해당 엔티티에 대한 모든 조회 쿼리에 전역적으로 필터 조건을 추가하므로, 의도치 않은 부작용을 일으킬 수 있습니다. 예를 들어, 관리자가 만료된 제휴 정보를 조회하거나 수정해야 할 경우, @Where 조건 때문에 엔티티를 불러오지 못하는 문제가 발생할 수 있습니다.
장기적으로는 @Where를 사용하는 대신, 다음과 같은 방법을 고려해 보시는 것을 추천합니다:
- 각각의 조회 요구사항에 맞는 별도의 리포지토리 메소드를 작성 (예:
findActivePartnerships,findAllIncludingFuturePartnerships) - JPA Specification이나 QueryDSL을 사용하여 동적으로 쿼리 조건을 조합
추가적으로, 이 변경으로 인해 PartnershipRepository의 findRestaurantsWithMyPartnerships 쿼리에 있는 p.endDate >= current_date 조건이 중복됩니다. @Where가 적용되므로 해당 쿼리 내의 조건은 제거해도 동일하게 동작할 것입니다. 이는 @Where가 코드베이스 전반에 미치는 영향을 보여주는 좋은 예시입니다.
이 수정이 임시 조치임을 감안할 때, 추후 리팩토링을 위한 이슈를 생성해두는 것도 좋은 방법입니다.
No description provided.