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 @@ -24,6 +24,8 @@ public interface CardRepository extends JpaRepository<Card, Long> {
@Query("""
SELECT c FROM Card c
WHERE (:cursor IS NULL OR c.id > :cursor)
AND c.isDeleted = false
AND c.isShared = true
ORDER BY c.id ASC
""")
Slice<Card> findByCursor(@Param("cursor") Long cursor, Pageable pageable);
Comment on lines 24 to 31

Choose a reason for hiding this comment

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

medium

쿼리에 isDeleted = falseisShared = true 조건을 추가하여 삭제되거나 공유되지 않은 카드만 필터링하도록 수정한 것은 데이터 정확성 측면에서 좋은 개선입니다.

다만, 몇 가지 개선점을 제안합니다:

  1. 성능 최적화: cards 테이블의 데이터가 많아질 경우 성능 저하가 발생할 수 있습니다. (is_deleted, is_shared, id) 컬럼에 대한 복합 인덱스를 추가하면 WHERE 절과 ORDER BY 절의 성능을 크게 향상시킬 수 있습니다. Card 엔티티의 @Table 어노테이션에 인덱스를 정의하는 것을 고려해 보세요.
  2. 메서드 이름 명확화: 쿼리의 역할이 더 명확해졌으므로, 메서드 이름도 이를 반영하도록 변경하는 것이 좋습니다. 예를 들어, findByCursor 대신 findSharedCardsByCursor와 같이 변경하면 코드의 가독성과 유지보수성이 향상될 것입니다.

Expand Down
Loading