Skip to content
Extraits de code Groupes Projets
Valider afc188d8 rédigé par Mohamed Lemine BAILLAHI's avatar Mohamed Lemine BAILLAHI
Parcourir les fichiers

Merge branch 'feature/VSN-505' into 'develop'

VSN-505/Adding some changes in the document return values

Closes VSN-505

See merge request !39
parents 574dae59 39d810a5
Branches
Étiquettes v0.0.27
1 requête de fusion!39VSN-505/Adding some changes in the document return values
Pipeline #20113 réussi avec l'étape
in 21 secondes
## [0.0.28]
-
## [0.0.27]
-
## [0.0.26]
......
......@@ -18,7 +18,7 @@
<dependency>
<groupId>com.marketingconfort</groupId>
<artifactId>vsn-common</artifactId>
<version>0.0.66-RELEASE</version>
<version>0.0.84-RELEASE</version>
</dependency>
</dependencies>
<properties>
......
......@@ -23,6 +23,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.List;
import java.util.Objects;
@RestController
@RequestMapping(Paths.DOCUMENT_BASE)
......@@ -36,11 +37,14 @@ public class DocumentController {
public ResponseEntity<String> uploadDocument(
@RequestParam("file") MultipartFile file,
AddDocumentRequest request) throws FunctionalException, IOException, S3FunctionalException {
String documentId;
if (request.getFolderId() != null) {
documentService.importDocument(file, request);
documentId = documentService.importDocument(file, request);
} else {
documentService.importDocumentToRoot(file, request);
documentId = documentService.importDocumentToRoot(file, request);
}
if (!Objects.equals(documentId, "")) {
return ResponseEntity.ok(documentId);
}
return ResponseEntity.ok(MessageConstants.SUCCESSFUL_UPLOAD);
}
......@@ -67,7 +71,7 @@ public class DocumentController {
}
@GetMapping(Paths.GET_DOWNLOAD_URL)
public ResponseEntity<String> getDocumentDownloadLink(@RequestParam Long documentId,@RequestParam Long ownerId) throws FunctionalException {
public ResponseEntity<String> getDocumentDownloadLink(@RequestParam Long documentId, @RequestParam Long ownerId) throws FunctionalException {
String downloadUrl = documentService.getDocumentDownloadLink(documentId, ownerId);
return ResponseEntity.ok(downloadUrl);
}
......@@ -131,8 +135,8 @@ public class DocumentController {
@PostMapping(Paths.BULK_SHARE_DOCUMENTS)
public ResponseEntity<Void> bulkShareDocument(@RequestBody BulkDocumentRequest bulkDocumentRequest) throws S3FunctionalException, FunctionalException {
documentService.bulkShareDocuments(bulkDocumentRequest.getDocumentIds(), bulkDocumentRequest.getOwnerId());
return ResponseEntity.ok().build();
documentService.bulkShareDocuments(bulkDocumentRequest.getDocumentIds(), bulkDocumentRequest.getOwnerId());
return ResponseEntity.ok().build();
}
......
......@@ -20,8 +20,8 @@ import java.util.List;
public interface DocumentService {
@Transactional
void importDocument(MultipartFile file, AddDocumentRequest request) throws FunctionalException, IOException, S3FunctionalException;
void importDocumentToRoot(MultipartFile file,AddDocumentRequest request) throws FunctionalException, IOException, S3FunctionalException;
String importDocument(MultipartFile file, AddDocumentRequest request) throws FunctionalException, IOException, S3FunctionalException;
String importDocumentToRoot(MultipartFile file,AddDocumentRequest request) throws FunctionalException, IOException, S3FunctionalException;
List<DocumentDTO> getDocumentsByOwnerId(Long ownerId) throws FunctionalException;
DocumentDTO getDocumentByIdAndOwner(Long documentId, Long ownerId) throws FunctionalException;
List<DocumentDTO> getRootDocumentsByOwnerId(Long ownerId);
......
......@@ -60,7 +60,7 @@ public class DocumentServiceImpl implements DocumentService {
@Transactional
@Override
public void importDocument(MultipartFile file, AddDocumentRequest request) throws FunctionalException, IOException, S3FunctionalException {
public String importDocument(MultipartFile file, AddDocumentRequest request) throws FunctionalException, IOException, S3FunctionalException {
Folder folder = null;
if (request.getFolderId() != null) {
folder = folderRepository.findById(request.getFolderId())
......@@ -97,13 +97,14 @@ public class DocumentServiceImpl implements DocumentService {
folderRepository.save(folder);
}
documentRepository.save(document);
Document doc = documentRepository.save(document);
return String.valueOf(doc.getId());
}
@Override
@Transactional
public void importDocumentToRoot(MultipartFile file,AddDocumentRequest request) throws FunctionalException, IOException, S3FunctionalException {
importDocument(file, request);
public String importDocumentToRoot(MultipartFile file,AddDocumentRequest request) throws FunctionalException, IOException, S3FunctionalException {
return importDocument(file, request);
}
@Override
......
0% ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter