From 9e0b72bc10680639cd7f5070086519c835a498ed Mon Sep 17 00:00:00 2001 From: Marcel Date: Sun, 19 Apr 2026 17:05:14 +0200 Subject: [PATCH] feat(dashboard): remove deprecated /incomplete and /recent-activity endpoints GET /api/documents/incomplete and GET /api/documents/recent-activity are superseded by the new dashboard endpoints (GET /api/dashboard/activity etc.) Co-Authored-By: Claude Sonnet 4.6 --- .../controller/DocumentController.java | 13 ---- .../controller/DocumentControllerTest.java | 72 +++---------------- 2 files changed, 8 insertions(+), 77 deletions(-) diff --git a/backend/src/main/java/org/raddatz/familienarchiv/controller/DocumentController.java b/backend/src/main/java/org/raddatz/familienarchiv/controller/DocumentController.java index 493fa046..bbef336d 100644 --- a/backend/src/main/java/org/raddatz/familienarchiv/controller/DocumentController.java +++ b/backend/src/main/java/org/raddatz/familienarchiv/controller/DocumentController.java @@ -17,7 +17,6 @@ import org.raddatz.familienarchiv.dto.DocumentSearchResult; import org.raddatz.familienarchiv.dto.DocumentUpdateDTO; import org.raddatz.familienarchiv.dto.TagOperator; import org.raddatz.familienarchiv.dto.DocumentVersionSummary; -import org.raddatz.familienarchiv.dto.IncompleteDocumentDTO; import org.raddatz.familienarchiv.exception.DomainException; import org.raddatz.familienarchiv.exception.ErrorCode; import org.raddatz.familienarchiv.model.Document; @@ -198,12 +197,6 @@ public class DocumentController { return Map.of("count", documentService.getIncompleteCount()); } - @GetMapping("/incomplete") - public List getIncomplete( - @Parameter(description = "Maximum number of results") @RequestParam(defaultValue = "10") int size) { - return documentService.findIncompleteDocuments(size); - } - @GetMapping("/incomplete/next") public ResponseEntity getNextIncomplete(@RequestParam UUID excludeId) { return documentService.findNextIncompleteDocument(excludeId) @@ -211,12 +204,6 @@ public class DocumentController { .orElse(ResponseEntity.noContent().build()); } - @GetMapping("/recent-activity") - public ResponseEntity> getRecentActivity( - @RequestParam(defaultValue = "5") int size) { - return ResponseEntity.ok(documentService.getRecentActivity(size)); - } - @GetMapping("/search") public ResponseEntity search( @RequestParam(required = false) String q, diff --git a/backend/src/test/java/org/raddatz/familienarchiv/controller/DocumentControllerTest.java b/backend/src/test/java/org/raddatz/familienarchiv/controller/DocumentControllerTest.java index 36b86449..f8aaf5dd 100644 --- a/backend/src/test/java/org/raddatz/familienarchiv/controller/DocumentControllerTest.java +++ b/backend/src/test/java/org/raddatz/familienarchiv/controller/DocumentControllerTest.java @@ -3,7 +3,6 @@ package org.raddatz.familienarchiv.controller; import org.junit.jupiter.api.Test; import org.raddatz.familienarchiv.dto.DocumentSearchResult; import org.raddatz.familienarchiv.dto.DocumentVersionSummary; -import org.raddatz.familienarchiv.dto.IncompleteDocumentDTO; import org.raddatz.familienarchiv.exception.DomainException; import org.raddatz.familienarchiv.exception.ErrorCode; import org.raddatz.familienarchiv.model.Document; @@ -390,47 +389,14 @@ class DocumentControllerTest { .andExpect(jsonPath("$.count").value(3)); } - // ─── GET /api/documents/incomplete ─────────────────────────────────────── - - @Test - void getIncomplete_returns401_whenUnauthenticated() throws Exception { - mockMvc.perform(get("/api/documents/incomplete")) - .andExpect(status().isUnauthorized()); - } + // ─── GET /api/documents/incomplete (removed — superseded by dashboard) ──── @Test @WithMockUser - void getIncomplete_returns200_withDTOList() throws Exception { - UUID id = UUID.randomUUID(); - IncompleteDocumentDTO dto = new IncompleteDocumentDTO(id, "Unvollständig"); - when(documentService.findIncompleteDocuments(anyInt())).thenReturn(List.of(dto)); - + void getIncomplete_endpointRemoved() throws Exception { + // The path hits /{id} and fails UUID conversion — not a 200 anymore mockMvc.perform(get("/api/documents/incomplete")) - .andExpect(status().isOk()) - .andExpect(jsonPath("$[0].id").value(id.toString())) - .andExpect(jsonPath("$[0].title").value("Unvollständig")); - } - - @Test - @WithMockUser - void getIncomplete_withSizeParam_passesItToService() throws Exception { - when(documentService.findIncompleteDocuments(5)).thenReturn(List.of()); - - mockMvc.perform(get("/api/documents/incomplete").param("size", "5")) - .andExpect(status().isOk()); - - verify(documentService).findIncompleteDocuments(5); - } - - @Test - @WithMockUser - void getIncomplete_usesDefaultSizeWhenNotSpecified() throws Exception { - when(documentService.findIncompleteDocuments(anyInt())).thenReturn(List.of()); - - mockMvc.perform(get("/api/documents/incomplete")) - .andExpect(status().isOk()); - - verify(documentService).findIncompleteDocuments(10); + .andExpect(status().is4xxClientError()); } // ─── GET /api/documents/incomplete/next ────────────────────────────────── @@ -467,36 +433,14 @@ class DocumentControllerTest { .andExpect(status().isNoContent()); } - // ─── GET /api/documents/recent-activity ────────────────────────────────── - - @Test - void getRecentActivity_returns401_whenUnauthenticated() throws Exception { - mockMvc.perform(get("/api/documents/recent-activity")) - .andExpect(status().isUnauthorized()); - } + // ─── GET /api/documents/recent-activity (removed — superseded by dashboard) @Test @WithMockUser - void getRecentActivity_returnsOkWithDocuments() throws Exception { - Document doc1 = Document.builder().id(UUID.randomUUID()).title("Alpha").originalFilename("a.pdf").build(); - Document doc2 = Document.builder().id(UUID.randomUUID()).title("Beta").originalFilename("b.pdf").build(); - when(documentService.getRecentActivity(5)).thenReturn(List.of(doc1, doc2)); - - mockMvc.perform(get("/api/documents/recent-activity").param("size", "5")) - .andExpect(status().isOk()) - .andExpect(jsonPath("$[0].title").value("Alpha")) - .andExpect(jsonPath("$[1].title").value("Beta")); - } - - @Test - @WithMockUser - void getRecentActivity_appliesDefaultSizeOfFive_whenSizeParamOmitted() throws Exception { - when(documentService.getRecentActivity(5)).thenReturn(List.of()); - + void getRecentActivity_endpointRemoved() throws Exception { + // The path hits /{id} and fails UUID conversion — not a 200 anymore mockMvc.perform(get("/api/documents/recent-activity")) - .andExpect(status().isOk()); - - verify(documentService).getRecentActivity(5); + .andExpect(status().is4xxClientError()); } // ─── GET /api/documents/{id}/versions ────────────────────────────────────