[BUG] ALL,HOT,HOME, FESTIVAL 에서 축제 기간을 고려하여 조회#356
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates several JPQL queries in CommunityRepository.java to filter out STORE and FESTIVAL community types unless they have an active event associated with their pin. The reviewer suggests replacing the direct use of CURRENT_TIMESTAMP in these queries with a :now parameter passed from the application. This change would prevent potential timezone mismatch issues between the application and database servers and improve the testability of the queries.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| select 1 | ||
| from EventPin ep | ||
| where ep.pin = p | ||
| and CURRENT_TIMESTAMP between ep.eventStartTime and ep.eventEndTime |
There was a problem hiding this comment.
CURRENT_TIMESTAMP를 JPQL에서 직접 사용하면 다음과 같은 문제가 발생할 수 있습니다:
- 시간대(Timezone) 불일치: 애플리케이션 서버(예: KST)와 데이터베이스 서버(예: UTC)의 시간 설정이 다를 경우, 의도치 않은 시간 차이로 인해 조회 결과가 달라질 수 있습니다.
- 테스트 용이성 저하: 특정 시점의 데이터를 조회하는 단위 테스트나 통합 테스트를 작성할 때, 현재 시간을 제어하기 어려워 테스트가 불안정해집니다.
따라서 애플리케이션에서 LocalDateTime.now()를 파라미터(예: :now)로 전달받아 비교하는 방식을 권장합니다.
주의: 이 제안을 적용하려면 해당 메서드(findFeedByTypeAndRegion)의 시그니처에 @Param("now") LocalDateTime now 파라미터를 추가해야 합니다.
| and CURRENT_TIMESTAMP between ep.eventStartTime and ep.eventEndTime | |
| and :now between ep.eventStartTime and ep.eventEndTime |
| select 1 | ||
| from EventPin ep | ||
| where ep.pin = p | ||
| and CURRENT_TIMESTAMP between ep.eventStartTime and ep.eventEndTime |
There was a problem hiding this comment.
CURRENT_TIMESTAMP 대신 애플리케이션에서 전달한 시간 파라미터 :now를 사용하여 시간대 불일치 문제를 방지하고 테스트 용이성을 높이는 것을 권장합니다.
주의: 이 제안을 적용하려면 해당 메서드(findFeedByTypesAndRegion)의 시그니처에 @Param("now") LocalDateTime now 파라미터를 추가해야 합니다.
| and CURRENT_TIMESTAMP between ep.eventStartTime and ep.eventEndTime | |
| and :now between ep.eventStartTime and ep.eventEndTime |
| select 1 | ||
| from EventPin ep | ||
| where ep.pin = p | ||
| and CURRENT_TIMESTAMP between ep.eventStartTime and ep.eventEndTime |
There was a problem hiding this comment.
CURRENT_TIMESTAMP 대신 애플리케이션에서 전달한 시간 파라미터 :now를 사용하여 시간대 불일치 문제를 방지하고 테스트 용이성을 높이는 것을 권장합니다.
주의: 이 제안을 적용하려면 해당 메서드(findFeedByRegionOrGlobalTypes)의 시그니처에 @Param("now") LocalDateTime now 파라미터를 추가해야 합니다.
| and CURRENT_TIMESTAMP between ep.eventStartTime and ep.eventEndTime | |
| and :now between ep.eventStartTime and ep.eventEndTime |
| select 1 | ||
| from EventPin ep | ||
| where ep.pin = p | ||
| and CURRENT_TIMESTAMP between ep.eventStartTime and ep.eventEndTime |
There was a problem hiding this comment.
CURRENT_TIMESTAMP 대신 애플리케이션에서 전달한 시간 파라미터 :now를 사용하여 시간대 불일치 문제를 방지하고 테스트 용이성을 높이는 것을 권장합니다.
주의: 이 제안을 적용하려면 해당 메서드(findHotFeedByRegionOrGlobalTypes)의 시그니처에 @Param("now") LocalDateTime now 파라미터를 추가해야 합니다.
| and CURRENT_TIMESTAMP between ep.eventStartTime and ep.eventEndTime | |
| and :now between ep.eventStartTime and ep.eventEndTime |
🔗 Related Issue
✨ 작업 개요
체크리스트
📷 이미지 첨부 (선택)
🧐 집중 리뷰 요청