@@ -168,13 +168,13 @@ public class FileEntityService {
|
||||
fileEntity.setImageHash(null);
|
||||
}
|
||||
|
||||
fileEntity.setStatus(FileStatus.DELETED);
|
||||
fileEntity.setStatus(FileStatus.REMOVED);
|
||||
fileEntity.setUpdatedAt(LocalDateTime.now());
|
||||
fileEntity.setProtectionStatus(ProtectionStatus.NOT_PROTECTED);
|
||||
// fileEntity.setProtectionStatus(ProtectionStatus.NOT_PROTECTED);
|
||||
|
||||
Path path = Paths.get(fileEntity.getProtectedFilePath());
|
||||
Files.deleteIfExists(path);
|
||||
fileEntity.setProtectedFilePath("");
|
||||
// Path path = Paths.get(fileEntity.getProtectedFilePath());
|
||||
// Files.deleteIfExists(path);
|
||||
// fileEntity.setProtectedFilePath("");
|
||||
|
||||
fileEntityRepository.save(fileEntity);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import ru.soune.nocopy.repository.FileEntityRepository;
|
||||
import ru.soune.nocopy.repository.ModerationLogRepository;
|
||||
import ru.soune.nocopy.service.file.FileEntityService;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -76,6 +77,12 @@ public class ModerationService {
|
||||
appeal.setResolvedAt(LocalDateTime.now());
|
||||
fileAppealRepository.save(appeal);
|
||||
});
|
||||
} else if (request.getNewStatus() == FileStatus.REMOVED) {
|
||||
try {
|
||||
fileEntityService.softDeleteFileWithHash(file);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user