From 64f6932b69707f16b09987314794920277bec134 Mon Sep 17 00:00:00 2001 From: Davide Di Modica Date: Thu, 19 Sep 2024 19:21:06 +0200 Subject: [PATCH] feat: Upload Data Store file --- .../src/api/endpoints/incidentManagement.ts | 16 ++- .../cases/CaseDataStore.vue | 118 ++++++++++++++++-- .../cases/CaseDataStoreItem.vue | 4 +- .../layouts/common/Toolbar/PinnedPages.vue | 44 ++----- 4 files changed, 140 insertions(+), 42 deletions(-) diff --git a/frontend/src/api/endpoints/incidentManagement.ts b/frontend/src/api/endpoints/incidentManagement.ts index d31989a4..950843e5 100644 --- a/frontend/src/api/endpoints/incidentManagement.ts +++ b/frontend/src/api/endpoints/incidentManagement.ts @@ -232,11 +232,25 @@ export default { `/incidents/db_operations/case/data-store/${caseId}` ) }, - downloadCaseDataStoreFileUrl(caseId: number, fileName: string) { + downloadCaseDataStoreFile(caseId: number, fileName: string) { return HttpClient.get(`/incidents/db_operations/case/data-store/download/${caseId}/${fileName}`, { responseType: "blob" }) }, + uploadCaseDataStoreFile(caseId: number, file: File) { + const form = new FormData() + form.append("file", new Blob([file], { type: file.type }), file.name) + + return HttpClient.post( + `/incidents/db_operations/case/data-store/upload`, + form, + { + params: { + case_id: caseId + } + } + ) + }, deleteCaseDataStoreFile(caseId: number, fileName: string) { return HttpClient.delete(`/incidents/db_operations/case/data-store/${caseId}/${fileName}`) }, diff --git a/frontend/src/components/incidentManagement/cases/CaseDataStore.vue b/frontend/src/components/incidentManagement/cases/CaseDataStore.vue index 32fc5724..a27e1d4c 100644 --- a/frontend/src/components/incidentManagement/cases/CaseDataStore.vue +++ b/frontend/src/components/incidentManagement/cases/CaseDataStore.vue @@ -1,6 +1,46 @@