update controller chunk endpoints
Test Workflow / test (push) Successful in 3s

This commit is contained in:
vladp
2025-12-17 22:31:30 +07:00
parent 11a7ab6a73
commit a030837d45
21 changed files with 740 additions and 163 deletions
@@ -510,8 +510,8 @@ public class FileUploadServiceImpl implements FileUploadService {
FileUploadSession session = sessionRepository.findById(uploadId)
.orElseThrow(() -> new UploadSessionNotFoundException(uploadId));
if (session.getStatus() == UploadStatus.COMPLETED) {
throw new FileUploadException("Cannot cancel completed upload");
if (session.getStatus() == UploadStatus.COMPLETED || session.getStatus() == UploadStatus.CANCELLED) {
throw new FileUploadException("Cannot cancel completed or cancelled upload");
}
session.setStatus(UploadStatus.CANCELLED);
@@ -539,6 +539,7 @@ public class FileUploadServiceImpl implements FileUploadService {
session.setStatus(UploadStatus.UPLOADING);
session.setRetryCount(session.getRetryCount() + 1);
session.setLastError(null);
sessionRepository.save(session);
if (session.getChunksUploaded().equals(session.getTotalChunks())) {