feat(timeline): add PersonService.getPersonsByGeneration + DocumentService.getAllForTimeline
PersonRepository.findByGeneration(Integer) — boxed to match nullable entity field. DocumentRepository.findAllForTimeline() — Document.list entity-graph, single query. Both services delegate with one-liner methods. Refs #777 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -56,6 +56,11 @@ public interface DocumentRepository extends JpaRepository<Document, UUID>, JpaSp
|
||||
// Prüft effizient, ob ein Dateiname schon existiert (gibt true/false zurück)
|
||||
boolean existsByOriginalFilename(String originalFilename);
|
||||
|
||||
// Bulk-fetch for global timeline path — single query with sender+receivers eager-loaded.
|
||||
@EntityGraph("Document.list")
|
||||
@Query("SELECT d FROM Document d")
|
||||
List<Document> findAllForTimeline();
|
||||
|
||||
// lazy – @BatchSize(50) fallback active; see ADR-022
|
||||
@EntityGraph("Document.full")
|
||||
List<Document> findBySenderId(UUID senderId);
|
||||
|
||||
@@ -1051,6 +1051,10 @@ public class DocumentService {
|
||||
return documentRepository.findDocumentsWithoutVersions();
|
||||
}
|
||||
|
||||
public List<Document> getAllForTimeline() {
|
||||
return documentRepository.findAllForTimeline();
|
||||
}
|
||||
|
||||
public List<Document> getDocumentsBySender(UUID senderId) {
|
||||
return documentRepository.findBySenderId(senderId);
|
||||
}
|
||||
|
||||
@@ -242,4 +242,7 @@ public interface PersonRepository extends JpaRepository<Person, UUID> {
|
||||
)
|
||||
""", nativeQuery = true)
|
||||
void insertMissingReceiverReference(@Param("source") UUID source, @Param("target") UUID target);
|
||||
|
||||
// Boxed Integer — matches the nullable person.generation column (primitive int would reject null rows).
|
||||
List<Person> findByGeneration(Integer generation);
|
||||
}
|
||||
|
||||
@@ -210,6 +210,10 @@ public class PersonService {
|
||||
return personRepository.findByFamilyMemberTrueOrderByLastNameAscFirstNameAsc();
|
||||
}
|
||||
|
||||
public List<Person> getPersonsByGeneration(Integer generation) {
|
||||
return personRepository.findByGeneration(generation);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Person setFamilyMember(UUID personId, boolean familyMember) {
|
||||
Person person = getById(personId);
|
||||
|
||||
Reference in New Issue
Block a user