feat: add paginated notifications and unread endpoint

This commit is contained in:
Tim
2025-08-19 18:20:26 +08:00
parent 77856ff9af
commit 73168c1859
7 changed files with 96 additions and 26 deletions

View File

@@ -65,12 +65,12 @@ class NotificationServiceTest {
when(uRepo.findByUsername("bob")).thenReturn(Optional.of(user));
Notification n = new Notification();
when(nRepo.findByUserOrderByCreatedAtDesc(user)).thenReturn(List.of(n));
when(nRepo.findByUser(eq(user), any())).thenReturn(new org.springframework.data.domain.PageImpl<>(List.of(n)));
List<Notification> list = service.listNotifications("bob", null);
List<Notification> list = service.listNotifications("bob", null, 0, 50);
assertEquals(1, list.size());
verify(nRepo).findByUserOrderByCreatedAtDesc(user);
verify(nRepo).findByUser(eq(user), any());
}
@Test