Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore: ✏️ Append WHERE condition in readNotification Query #197

Merged
merged 3 commits into from
Nov 12, 2024

Conversation

psychology50
Copy link
Member

작업 이유

image

  • We had three types of notices, but the designer wants to display only Announce type notifications.

작업 사항

@Transactional(readOnly = true)
public Slice<Notification> readNotificationsSlice(Long userId, Pageable pageable, NoticeType noticeType) {
    Predicate predicate = notification.receiver.id.eq(userId)
            .and(notification.readAt.isNotNull())
            .and(notification.type.eq(noticeType));

    QueryHandler queryHandler = query -> query
            .offset(pageable.getOffset())
            .limit(pageable.getPageSize() + 1);

    Sort sort = pageable.getSort();

    return SliceUtil.toSlice(notificationRepository.findList(predicate, queryHandler, sort), pageable);
}

@Transactional(readOnly = true)
public List<Notification> readUnreadNotifications(Long userId, NoticeType noticeType) {
    Predicate predicate = notification.receiver.id.eq(userId)
            .and(notification.readAt.isNull())
            .and(notification.type.eq(noticeType));

    return notificationRepository.findList(predicate, null, null);
}
  • Add a NoticeType parameter to the domain service’s read method.

리뷰어가 중점적으로 확인해야 하는 부분

  • none

발견한 이슈

  • none

@psychology50 psychology50 self-assigned this Nov 12, 2024
@psychology50 psychology50 added the fix 기능 수정 label Nov 12, 2024
@psychology50 psychology50 merged commit 6694609 into dev Nov 12, 2024
1 check passed
@psychology50 psychology50 deleted the fix/notification-type-filtering branch November 12, 2024 11:55
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.

1 participant