add filter doc/videos
This commit is contained in:
@@ -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<KSDocument> 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());
|
||||
}
|
||||
|
||||
@@ -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<KSVideo> findByGroupId(String groupId) {
|
||||
return ksVideoRepository.findByGroupId(groupId, Sort.by(Sort.Direction.DESC, "ingestionDate"));
|
||||
List<KSVideo> 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<Resource> downloadKSVideo(KSVideo video) {
|
||||
|
||||
Reference in New Issue
Block a user