mirror of
https://github.com/RoastSlav/quickdrop.git
synced 2026-05-04 03:19:25 -05:00
fix for not working scheduled deleting job
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.rostislav.quickdrop.repository;
|
||||
|
||||
import jakarta.transaction.Transactional;
|
||||
import org.rostislav.quickdrop.entity.DownloadLog;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
@@ -17,6 +18,7 @@ public interface DownloadLogRepository extends JpaRepository<DownloadLog, Long>
|
||||
List<DownloadLog> findByFileUuid(String fileUUID);
|
||||
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query("DELETE FROM DownloadLog dl WHERE dl.file.id = :id")
|
||||
void deleteByFileId(Long id);
|
||||
}
|
||||
|
||||
@@ -56,8 +56,8 @@ public class ScheduleService {
|
||||
logger.info("Deleting file: {}", file);
|
||||
boolean deleted = fileService.deleteFileFromFileSystem(file.uuid);
|
||||
if (deleted) {
|
||||
fileRepository.delete(file);
|
||||
downloadLogRepository.deleteByFileId(file.id);
|
||||
fileRepository.delete(file);
|
||||
} else {
|
||||
logger.error("Failed to delete file: {}", file);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user