Skip to content

Commit

Permalink
Merge pull request #210 from bankidz/dev
Browse files Browse the repository at this point in the history
fix: 알림리스트 페이지네이션 오류 수정
  • Loading branch information
sanbonai06 authored Sep 8, 2022
2 parents c893848 + d6d0107 commit 04ac65e
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,27 @@ public NotificationListDTO readNotificationList(User user, Long lastId) {
List<NotificationDTO> notificationDTOS = byUserIdOrderByIdDesc.stream()
.map(NotificationDTO::new)
.collect(Collectors.toList());
NotificationDTO lastNotification = notificationDTOS.get(notificationDTOS.size() - 1);
Long lastNotificationId = lastNotification.getId();
if (notificationDTOS.size() == 11L) {
NotificationDTO lastNotification = notificationDTOS.get(
notificationDTOS.size() - 1);
Long lastNotificationId = lastNotification.getId();
notificationDTOS.remove(10);
return new NotificationListDTO(lastNotificationId, false, notificationDTOS);
} else if (notificationDTOS.size() < 11L) {
return new NotificationListDTO(lastNotificationId, true, notificationDTOS);
return new NotificationListDTO(null, true, notificationDTOS);
}
}
List<NotificationDTO> notificationDTOList = notificationRepository.findByIdLessThanEqualAndUserIdOrderByIdDesc(
lastId, user.getId(), pageRequest).stream()
.map(NotificationDTO::new).collect(Collectors.toList());
NotificationDTO lastNotification = notificationDTOList.get(notificationDTOList.size() - 1);
Long last = lastNotification.getId();
if (notificationDTOList.size() == 11L) {
NotificationDTO lastNotification = notificationDTOList.get(
notificationDTOList.size() - 1);
Long last = lastNotification.getId();
notificationDTOList.remove(10);
return new NotificationListDTO(last, false, notificationDTOList);
} else {
return new NotificationListDTO(last, true, notificationDTOList);
return new NotificationListDTO(null, true, notificationDTOList);
}
}

Expand Down

0 comments on commit 04ac65e

Please sign in to comment.