Created call api's in 2 steps and for update call

This commit is contained in:
rajesh
2024-08-28 01:52:25 +05:30
parent e7fa11f35e
commit 22e72f6cd4
20 changed files with 287 additions and 119 deletions

View File

@@ -18,7 +18,6 @@ import net.gepafin.tendermanagement.enums.DocumentTypeEnum;
import net.gepafin.tendermanagement.model.response.DocumentResponseBean;
import net.gepafin.tendermanagement.repositories.DocumentRepository;
import net.gepafin.tendermanagement.service.AmazonS3Service;
import net.gepafin.tendermanagement.util.Utils;
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
@@ -48,6 +47,7 @@ public class DocumentDao {
documentEntity.setFileName(fileName);
documentEntity.setType(fileType.getValue());
documentEntity.setFilePath(filepath);
documentEntity.setIsDeleted(false);
documentEntities.add(documentEntity);
} catch (IOException e) {}
}
@@ -62,9 +62,8 @@ public class DocumentDao {
.orElseThrow(() -> new ResourceNotFoundException(Status.VALIDATION_ERROR,
Translator.toLocale(GepafinConstant.DOCUMENT_NOT_FOUND)));
String fileName = Utils.extractFileName(documentEntity.getFilePath());
amazonS3Service.delete(fileName);
documentRepository.delete(documentEntity);
documentEntity.setIsDeleted(true);
documentRepository.save(documentEntity);
}
}