feat(notifications): add documentTitle to NotificationDTO via DocumentService lookup
Notification rows in the history page need the document title. Added findTitlesByIds(Collection<UUID>) to DocumentService (one query via a new JPQL projection on DocumentRepository). NotificationService.getNotifications() now fetches all titles for the page in a single extra query and maps them into the DTO. documentTitle is null when the document has been deleted. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -75,7 +75,7 @@ class NotificationControllerTest {
|
||||
AppUser user = AppUser.builder().id(USER_ID).username("testuser").build();
|
||||
NotificationDTO dto = new NotificationDTO(
|
||||
UUID.randomUUID(), NotificationType.REPLY, UUID.randomUUID(),
|
||||
UUID.randomUUID(), null, false, LocalDateTime.now(), "Anna Smith");
|
||||
UUID.randomUUID(), null, false, LocalDateTime.now(), "Anna Smith", "Testdokument");
|
||||
|
||||
when(userService.findByUsername("testuser")).thenReturn(user);
|
||||
when(notificationService.getNotifications(eq(USER_ID), any(), any(), any()))
|
||||
@@ -123,6 +123,20 @@ class NotificationControllerTest {
|
||||
.andExpect(status().isBadRequest());
|
||||
}
|
||||
|
||||
@Test
|
||||
@WithMockUser(username = "testuser", authorities = {"READ_ALL"})
|
||||
void getNotifications_returns400_whenSizeExceedsMaximum() throws Exception {
|
||||
mockMvc.perform(get("/api/notifications").param("size", "200"))
|
||||
.andExpect(status().isBadRequest());
|
||||
}
|
||||
|
||||
@Test
|
||||
@WithMockUser(username = "testuser", authorities = {"READ_ALL"})
|
||||
void getNotifications_returns400_whenSizeIsZero() throws Exception {
|
||||
mockMvc.perform(get("/api/notifications").param("size", "0"))
|
||||
.andExpect(status().isBadRequest());
|
||||
}
|
||||
|
||||
// ─── POST /api/notifications/read-all ────────────────────────────────────
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user