Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Slice<Card> findFeedExcludeBlocked(
SELECT c FROM Card c
JOIN Reaction r ON r.card = c
WHERE c.isDeleted = false
AND c.isShared = true
GROUP BY c
HAVING COUNT(r) >= 1

Choose a reason for hiding this comment

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

medium

하드코딩된 1 대신 파라미터를 사용하여 유연성을 높이는 것이 좋습니다. 코드 주석(//초기 테스트로 1개로 수정 (기존은 100개))을 보면 이 값은 향후 변경될 가능성이 있습니다. 값을 파라미터화하면 쿼리 자체를 수정하지 않고도 이 임계값을 쉽게 조정할 수 있습니다.

이 변경을 적용하려면 메서드 시그니처도 함께 업데이트해야 합니다:

List<Card> findCardsWithMinReactionCount(@Param("minReactionCount") long minReactionCount);

또한, 메서드 이름을 좀 더 일반적인 이름으로 변경하는 것을 고려해볼 수 있습니다.

Suggested change
HAVING COUNT(r) >= 1
HAVING COUNT(r) >= :minReactionCount

""")
Expand Down
Loading