refactor(comment): promote CommentData to top-level record in comment package
Some checks failed
CI / Unit & Component Tests (push) Failing after 3m32s
CI / OCR Service Tests (push) Successful in 47s
CI / Backend Unit Tests (push) Has been cancelled
CI / Unit & Component Tests (pull_request) Failing after 3m32s
CI / OCR Service Tests (pull_request) Successful in 38s
CI / Backend Unit Tests (pull_request) Failing after 3m25s

Moves the nested `CommentData` record out of `CommentService` into its own
`document/comment/CommentData.java` file, removing the cross-domain coupling
where `DashboardService` depended on an inner type of `CommentService`.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-07 19:47:27 +02:00
parent abe8ab8668
commit 708fd9d63e
5 changed files with 10 additions and 7 deletions

View File

@@ -12,7 +12,7 @@ import org.raddatz.familienarchiv.document.Document;
import org.raddatz.familienarchiv.person.Person;
import org.raddatz.familienarchiv.document.transcription.TranscriptionBlock;
import org.raddatz.familienarchiv.document.comment.CommentService;
import org.raddatz.familienarchiv.document.comment.CommentService.CommentData;
import org.raddatz.familienarchiv.document.comment.CommentData;
import org.raddatz.familienarchiv.document.DocumentService;
import org.raddatz.familienarchiv.document.transcription.TranscriptionService;
import org.raddatz.familienarchiv.user.UserService;

View File

@@ -0,0 +1,5 @@
package org.raddatz.familienarchiv.document.comment;
import java.util.UUID;
public record CommentData(UUID annotationId, String preview) {}

View File

@@ -31,8 +31,6 @@ public class CommentService {
private static final int PREVIEW_MAX_CHARS = 120;
public record CommentData(UUID annotationId, String preview) {}
private final CommentRepository commentRepository;
private final UserService userService;
private final NotificationService notificationService;

View File

@@ -13,7 +13,7 @@ import org.raddatz.familienarchiv.user.AppUser;
import org.raddatz.familienarchiv.document.Document;
import org.raddatz.familienarchiv.document.transcription.TranscriptionBlock;
import org.raddatz.familienarchiv.document.comment.CommentService;
import org.raddatz.familienarchiv.document.comment.CommentService.CommentData;
import org.raddatz.familienarchiv.document.comment.CommentData;
import org.raddatz.familienarchiv.document.DocumentService;
import org.raddatz.familienarchiv.document.transcription.TranscriptionService;
import org.raddatz.familienarchiv.user.UserService;

View File

@@ -660,7 +660,7 @@ class CommentServiceTest {
.thenReturn(List.of(DocumentComment.builder().id(id)
.content("<p><strong>Hello</strong> world</p>").build()));
Map<UUID, CommentService.CommentData> result = commentService.findDataByIds(List.of(id));
Map<UUID, CommentData> result = commentService.findDataByIds(List.of(id));
assertThat(result.get(id).preview()).isEqualTo("Hello world");
}
@@ -710,7 +710,7 @@ class CommentServiceTest {
when(commentRepository.findAllById(List.of(present, deleted)))
.thenReturn(List.of(DocumentComment.builder().id(present).content("Hi").build()));
Map<UUID, CommentService.CommentData> result = commentService.findDataByIds(List.of(present, deleted));
Map<UUID, CommentData> result = commentService.findDataByIds(List.of(present, deleted));
assertThat(result).containsKey(present);
assertThat(result).doesNotContainKey(deleted);
@@ -724,7 +724,7 @@ class CommentServiceTest {
.thenReturn(List.of(DocumentComment.builder().id(id)
.annotationId(annotationId).content("Text").build()));
CommentService.CommentData data = commentService.findDataByIds(List.of(id)).get(id);
CommentData data = commentService.findDataByIds(List.of(id)).get(id);
assertThat(data.annotationId()).isEqualTo(annotationId);
assertThat(data.preview()).isEqualTo("Text");