refactor(documents): change DocumentBatchMetadataDTO.tags from String to List<String> tagNames

Replaces comma-delimited String with a proper JSON array field — callers no
longer need to pre-serialise. Service drops the split/trim/filter step and
passes tagNames directly to updateDocumentTags().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-24 20:28:12 +02:00
committed by marcel
parent 763f1990cd
commit b8e6fe9ec9
3 changed files with 27 additions and 5 deletions

View File

@@ -13,6 +13,6 @@ public class DocumentBatchMetadataDTO {
private List<UUID> receiverIds;
private LocalDate documentDate;
private String location;
private String tags;
private List<String> tagNames;
private Boolean metadataComplete;
}

View File

@@ -166,11 +166,9 @@ public class DocumentService {
if (metadata.getMetadataComplete() != null) {
doc.setMetadataComplete(metadata.getMetadataComplete());
}
if (metadata.getTags() != null && !metadata.getTags().isBlank()) {
List<String> tagNames = Arrays.stream(metadata.getTags().split(","))
.map(String::trim).filter(s -> !s.isEmpty()).toList();
if (metadata.getTagNames() != null && !metadata.getTagNames().isEmpty()) {
UUID docId = doc.getId();
updateDocumentTags(docId, tagNames);
updateDocumentTags(docId, metadata.getTagNames());
doc = documentRepository.findById(docId)
.orElseThrow(() -> DomainException.notFound(ErrorCode.DOCUMENT_NOT_FOUND, "Not found after batch metadata: " + docId));
}