-
Notifications
You must be signed in to change notification settings - Fork 0
fix: 제휴 지도 & 신고 기능 수정 사항 (20250930) #249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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은 제휴 지도에서 유효한 제휴 관계가 없는 식당을 필터링하여 사용자에게 정확한 정보를 제공하고, 리뷰 신고 기능에 24시간 재신고 제한을 도입하여 시스템의 오용을 방지하며, 신고 요청의 명확성을 높이는 개선 사항을 포함합니다. Highlights
Ignored Files
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
이 PR은 제휴 지도에서 제휴가 없는 식당을 필터링하고, 리뷰 신고 기능을 24시간에 한 번으로 제한하는 수정을 포함하고 있습니다. 전반적으로 PR의 목적에 맞게 코드가 잘 수정되었습니다. 몇 가지 개선점을 제안합니다. ReportRepository의 JPQL 쿼리에서 데이터베이스에 따라 동작이 달라질 수 있는 날짜 계산 방식을 수정하고, ReportService에서 스타일 가이드에 맞지 않는 와일드카드 import를 수정하는 것을 제안합니다. 자세한 내용은 각 파일의 주석을 참고해주세요.
| @Query(""" | ||
| SELECT CASE WHEN COUNT(r) > 0 THEN true ELSE false END | ||
| FROM Report r | ||
| WHERE r.user.id = :userId | ||
| AND r.review.id = :reviewId | ||
| AND r.createdDate >= CURRENT_TIMESTAMP - 1 | ||
| """) | ||
| boolean existsRecentReport(@Param("userId") Long userId, | ||
| @Param("reviewId") Long reviewId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JPQL 쿼리에 두 가지 개선점을 제안합니다.
SELECT CASE WHEN COUNT(r) > 0 THEN true ELSE false END구문은SELECT COUNT(r) > 0으로 단순화할 수 있습니다. Spring Data JPA가 이 결과를boolean으로 올바르게 처리합니다.- 더 중요한 점은,
r.createdDate >= CURRENT_TIMESTAMP - 1과 같은 날짜/시간 연산은 JPQL 표준이 아니며, 사용하는 데이터베이스(H2, MySQL, PostgreSQL 등)에 따라 다르게 동작할 수 있어 이식성을 해칠 수 있습니다. 서비스 레이어에서 시간 임계값(예: 24시간 전)을 계산하여 파라미터로 전달하는 것이 더 안정적이고 명확한 방법입니다.
아래와 같이 메서드 시그니처와 쿼리를 수정하는 것을 권장합니다. 이 변경은 ReportService에서의 호출 방식 수정도 필요합니다.
@Query("""
SELECT count(r) > 0
FROM Report r
WHERE r.user.id = :userId
AND r.review.id = :reviewId
AND r.createdDate >= :threshold
""")
boolean existsRecentReport(@Param("userId") Long userId,
@Param("reviewId") Long reviewId,
@Param("threshold") LocalDateTime threshold);| if(reportRepository.existsRecentReport(user.getId(),review.getId())){ | ||
| throw new BaseException(RECENT_REPORT_ON_REVIEW); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ReportRepository에 제안된 변경사항과 일관성을 맞추기 위해, existsRecentReport 메서드를 호출할 때 24시간 전의 시간 임계값을 파라미터로 전달하도록 수정해야 합니다. 이렇게 하면 시간 계산 로직이 서비스 레이어로 이동하여, 데이터베이스에 독립적이고 명확한 코드가 됩니다. 이 변경을 적용하려면 java.time.LocalDateTime을 import해야 할 수 있습니다.
| if(reportRepository.existsRecentReport(user.getId(),review.getId())){ | |
| throw new BaseException(RECENT_REPORT_ON_REVIEW); | |
| } | |
| if(reportRepository.existsRecentReport(user.getId(), review.getId(), java.time.LocalDateTime.now().minusHours(24))){ | |
| throw new BaseException(RECENT_REPORT_ON_REVIEW); | |
| } |
|
|
||
| import static ssu.eatssu.global.handler.response.BaseResponseStatus.NOT_FOUND_REVIEW; | ||
| import static ssu.eatssu.global.handler.response.BaseResponseStatus.NOT_FOUND_USER; | ||
| import static ssu.eatssu.global.handler.response.BaseResponseStatus.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
스타일 가이드 3번 규칙에 따라 와일드카드(*) import는 사용하지 않는 것이 좋습니다.1 코드의 가독성을 높이고 불필요한 클래스가 네임스페이스에 포함되는 것을 방지하기 위해, 필요한 static 멤버만 명시적으로 import하는 것을 권장합니다.
| import static ssu.eatssu.global.handler.response.BaseResponseStatus.*; | |
| import static ssu.eatssu.global.handler.response.BaseResponseStatus.NOT_FOUND_REVIEW; | |
| import static ssu.eatssu.global.handler.response.BaseResponseStatus.NOT_FOUND_USER; | |
| import static ssu.eatssu.global.handler.response.BaseResponseStatus.RECENT_REPORT_ON_REVIEW; |
Style Guide References
Footnotes
-
Do not use wildcard when importing libraries ↩
#️⃣ Issue Number
📝 요약(Summary)
제휴 지도에서 제휴가 없는 식당이 보이지 않도록 수정했습니다.
신고 기능과 관련된 기능을 수정했습니다 ( 24시간에 한 번 제약, 슬랙 업데이트 )
💬 공유사항 to 리뷰어
✅ PR Checklist
PR이 다음 요구 사항을 충족하는지 확인하세요.