Last atttribute change only for affected file

This commit is contained in:
Timo Bejan 2022-03-15 15:43:36 +02:00
parent 81d4970c7c
commit 4b6e959ce3
2 changed files with 3 additions and 3 deletions

View File

@ -162,7 +162,7 @@ public class FileStatusPersistenceService {
var fileAttributeEntities = convertFileAttributes(dossierId, file, fileAttributes);
fileAttributesRepository.saveAllAndFlush(fileAttributeEntities);
fileRepository.updateLastAttributeChangeDate(OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS));
fileRepository.updateLastAttributeChangeDate(fileId, OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS));
}, () -> {
throw new NotFoundException("Unknown file=" + fileId);

View File

@ -145,8 +145,8 @@ public interface FileRepository extends JpaRepository<FileEntity, String> {
List<FileEntity> getAllRelevantStatusesForReanalysisScheduler();
@Modifying(clearAutomatically = true)
@Query("update FileEntity f set f.lastFileAttributeChange = :date, f.lastUpdated = :date")
void updateLastAttributeChangeDate(OffsetDateTime date);
@Query("update FileEntity f set f.lastFileAttributeChange = :date, f.lastUpdated = :date where f.id = :fileId")
void updateLastAttributeChangeDate(String fileId, OffsetDateTime date);
@Query("select f from FileEntity f where f.deleted is not null and f.hardDeletedTime is null and f.dossierId in :dossierIds")
List<FileEntity> getSoftDeletedFiles(List<String> dossierIds);