feat(documents): add DocumentService.getDensity (#385)
Maps the repository's Object[] rows into a DocumentDensityResult and pairs them with the archive-wide min/max meta_date range. Read-only, no @Transactional needed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -125,6 +125,19 @@ public class DocumentService {
|
||||
return titles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Per-month document counts for the timeline density widget (issue #385).
|
||||
* Returns only months that have at least one document — the frontend fills
|
||||
* gaps using the {@code minDate}/{@code maxDate} bounds.
|
||||
*/
|
||||
public DocumentDensityResult getDensity(LocalDate from, LocalDate to) {
|
||||
List<MonthBucket> buckets = documentRepository.findDensityByMonth(from, to).stream()
|
||||
.map(row -> new MonthBucket((String) row[0], ((Number) row[1]).intValue()))
|
||||
.toList();
|
||||
DocumentDateRangeProjection range = documentRepository.findMinMaxDocumentDate();
|
||||
return new DocumentDensityResult(buckets, range.getMinDate(), range.getMaxDate());
|
||||
}
|
||||
|
||||
/**
|
||||
* Lädt eine Datei hoch.
|
||||
* - Prüft, ob ein Eintrag (aus Excel) schon existiert.
|
||||
|
||||
Reference in New Issue
Block a user