Skip to content

Conversation

@yongjun0511
Copy link
Collaborator

@yongjun0511 yongjun0511 commented Sep 30, 2025

#️⃣ Issue Number

📝 요약(Summary)

제휴 지도에서 제휴가 없는 식당이 보이지 않도록 수정했습니다.

신고 기능과 관련된 기능을 수정했습니다 ( 24시간에 한 번 제약, 슬랙 업데이트 )

💬 공유사항 to 리뷰어

✅ PR Checklist

PR이 다음 요구 사항을 충족하는지 확인하세요.

  • 커밋 메시지 컨벤션에 맞게 작성했습니다.
  • 변경 사항에 대한 테스트를 했습니다.(버그 수정/기능에 대한 테스트).

@yongjun0511 yongjun0511 self-assigned this Sep 30, 2025
@yongjun0511 yongjun0511 added the fix 고치기 label Sep 30, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @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

  • 제휴 지도 필터링 개선: 제휴가 없는 식당이 제휴 지도에 표시되지 않도록 쿼리 로직을 LEFT JOIN에서 JOIN으로 변경하여 수정했습니다.
  • 신고 기능 강화: 동일한 리뷰에 대해 24시간 이내에 중복 신고를 할 수 없도록 제한하는 로직을 추가했으며, 신고 요청 DTO의 스키마 예시를 업데이트하여 신고 타입과 내용에 대한 설명을 명확히 했습니다.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/deploy.yml
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@yongjun0511 yongjun0511 linked an issue Sep 30, 2025 that may be closed by this pull request
Copy link

@gemini-code-assist gemini-code-assist bot left a 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를 수정하는 것을 제안합니다. 자세한 내용은 각 파일의 주석을 참고해주세요.

Comment on lines 12 to 20
@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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

JPQL 쿼리에 두 가지 개선점을 제안합니다.

  1. SELECT CASE WHEN COUNT(r) > 0 THEN true ELSE false END 구문은 SELECT COUNT(r) > 0으로 단순화할 수 있습니다. Spring Data JPA가 이 결과를 boolean으로 올바르게 처리합니다.
  2. 더 중요한 점은, 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);

Comment on lines 39 to 41
if(reportRepository.existsRecentReport(user.getId(),review.getId())){
throw new BaseException(RECENT_REPORT_ON_REVIEW);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

ReportRepository에 제안된 변경사항과 일관성을 맞추기 위해, existsRecentReport 메서드를 호출할 때 24시간 전의 시간 임계값을 파라미터로 전달하도록 수정해야 합니다. 이렇게 하면 시간 계산 로직이 서비스 레이어로 이동하여, 데이터베이스에 독립적이고 명확한 코드가 됩니다. 이 변경을 적용하려면 java.time.LocalDateTime을 import해야 할 수 있습니다.

Suggested change
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.*;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

스타일 가이드 3번 규칙에 따라 와일드카드(*) import는 사용하지 않는 것이 좋습니다.1 코드의 가독성을 높이고 불필요한 클래스가 네임스페이스에 포함되는 것을 방지하기 위해, 필요한 static 멤버만 명시적으로 import하는 것을 권장합니다.

Suggested change
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

  1. Do not use wildcard when importing libraries

@yongjun0511 yongjun0511 merged commit 9c25193 into develop Sep 30, 2025
@yongjun0511 yongjun0511 deleted the fix/#246-partnership-report-error-fix branch September 30, 2025 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix 고치기

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: 제휴 지도 & 신고 기능 수정 사항

2 participants