Skip to content

Commit 7eca472

Browse files
committed
CLAP-381 Fix : 삭제된 task에 대한 알림은 불러오지 않도록 설정 및 fetch join 추가
1 parent a2b2daa commit 7eca472

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/main/java/clap/server/adapter/outbound/persistense/repository/notification/NotificationRepository.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import org.springframework.data.domain.Pageable;
66
import org.springframework.data.domain.Slice;
77
import org.springframework.data.jpa.repository.JpaRepository;
8+
import org.springframework.data.jpa.repository.Query;
9+
import org.springframework.data.repository.query.Param;
810
import org.springframework.stereotype.Repository;
911

1012
import java.util.List;
@@ -13,7 +15,14 @@
1315
@Repository
1416
public interface NotificationRepository extends JpaRepository<NotificationEntity, Long> {
1517

16-
Slice<NotificationEntity> findAllByReceiver_MemberIdOrderByCreatedAtDesc(Long receiverId, Pageable pageable);
18+
@Query("SELECT n FROM NotificationEntity n " +
19+
"JOIN FETCH n.task t " +
20+
"JOIN FETCH n.receiver r " +
21+
"WHERE n.receiver.memberId = :receiverId " +
22+
"AND t.isDeleted = false " +
23+
"ORDER BY n.createdAt DESC")
24+
Slice<NotificationEntity> findAllByReceiver_MemberIdOrderByCreatedAtDesc(
25+
@Param("receiverId") Long receiverId, Pageable pageable);
1726

1827
List<NotificationEntity> findAllByReceiver_MemberId(Long memberId);
1928

0 commit comments

Comments
 (0)