diff --git a/src/main/java/com/olympus/apollo/services/KSDocumentService.java b/src/main/java/com/olympus/apollo/services/KSDocumentService.java index 22a6741..24bb42c 100644 --- a/src/main/java/com/olympus/apollo/services/KSDocumentService.java +++ b/src/main/java/com/olympus/apollo/services/KSDocumentService.java @@ -51,7 +51,16 @@ public class KSDocumentService { User principal = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); try { - return ksdocRepo.findByProjectName(principal.getSelectedProject().getInternal_name(), Sort.by(Sort.Direction.DESC, "ingestionDate")); + List documents = ksdocRepo.findByProjectName(principal.getSelectedProject().getInternal_name(), Sort.by(Sort.Direction.DESC, "ingestionDate")); + + // Filtra i documenti: mostra solo quelli senza ingestionStatusV2 o con valore vuoto/nullo + if (documents != null) { + return documents.stream() + .filter(doc -> doc.getIngestionStatusV2() == null || doc.getIngestionStatusV2().trim().isEmpty()) + .collect(Collectors.toList()); + } + + return documents; } catch (Exception e) { logger.error("Error in findByProjectNameAndApplicationName function: " + e.getMessage()); } diff --git a/src/main/java/com/olympus/apollo/services/KSVideoService.java b/src/main/java/com/olympus/apollo/services/KSVideoService.java index d52eb75..2d87038 100644 --- a/src/main/java/com/olympus/apollo/services/KSVideoService.java +++ b/src/main/java/com/olympus/apollo/services/KSVideoService.java @@ -4,6 +4,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; +import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -40,7 +41,16 @@ public class KSVideoService { } public List findByGroupId(String groupId) { - return ksVideoRepository.findByGroupId(groupId, Sort.by(Sort.Direction.DESC, "ingestionDate")); + List videos = ksVideoRepository.findByGroupId(groupId, Sort.by(Sort.Direction.DESC, "ingestionDate")); + + // Filtra i video: mostra solo quelli senza ingestionStatusV2 o con valore vuoto/nullo + if (videos != null) { + return videos.stream() + .filter(video -> video.getIngestionStatusV2() == null || video.getIngestionStatusV2().trim().isEmpty()) + .collect(Collectors.toList()); + } + + return videos; } public ResponseEntity downloadKSVideo(KSVideo video) {