Skip to content

Commit

Permalink
fix: 알람 목록 조회 시 특정 유저의 알림이 아닌 모든 유저의 알림이 조회되는 문제 해결
Browse files Browse the repository at this point in the history
- 특정 유저 id를 조건에 추가하여 현재 로그인한 유저에게 온 알림만 조회하도록 수정
  • Loading branch information
JadeKim042386 committed Jul 20, 2024
1 parent 92d69a0 commit 32aafc4
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public class CustomAlarmRepositoryImpl implements CustomAlarmRepository {
public Page<Alarm> findAllByMember_Id(Long memberId, Boolean isRead, Pageable pageable) {
QAlarm alarm = QAlarm.alarm;
// where
Predicate predicate = isRead ? alarm.readAt.isNotNull() : alarm.readAt.isNull();
Predicate predicate = isRead
? alarm.readAt.isNotNull().and(alarm.memberId.eq(memberId))
: alarm.readAt.isNull().and(alarm.memberId.eq(memberId));
// count
Long NotReadAlarmCount = jpaQueryFactory
.select(alarm.count())
Expand Down

0 comments on commit 32aafc4

Please sign in to comment.