awaiting submissions from storage acc

This commit is contained in:
2022-09-05 16:46:30 +01:00
parent b0dde836b0
commit c66883b4c5
25 changed files with 653 additions and 69 deletions
+93 -6
View File
@@ -3,7 +3,8 @@ import https from "https";
import CryptoJS from "crypto-js";
import HmacSHA256 from "crypto-js/hmac-sha256";
import { getFormCollection } from "../components/utils";
import { downloadFile } from "./azurestorage";
import { downloadFile, getCaseBlob } from "./azurestorage";
let BASE_URL;
const port = parseInt(process.env.PORT, 10) || 3000;
@@ -132,7 +133,6 @@ export const azureHeadersPagedCustom = (access_token, showNumberOfRecords) => {
};
export const hashAPIPath = (queryPath) => {
console.log(queryPath);
var hashlink = CryptoJS.HmacSHA256(
queryPath,
CryptoJS.enc.Hex.parse(WORDKEY)
@@ -744,6 +744,11 @@ export const getAwaitingSubmissionProxy = (loggedInUserId) => {
};
export const getAwaitingSubmission = (loggedInUserId) => {
console.log(
BASE_URL +
"/api/endpoint/getawaitingsubmission_api?loggedInUserId=" +
loggedInUserId
);
return axios
.get(
BASE_URL +
@@ -758,6 +763,25 @@ export const getAwaitingSubmission = (loggedInUserId) => {
});
};
export const getAwaitingSubmissionFromBlob = (containerName) => {
return axios
.get(
BASE_URL +
"/api/file/getawaitingsubmissionfromblob?container=" +
containerName +
hashAPIPath(
"/api/file/getawaitingsubmissionfromblob?container=" +
containerName
)
)
.then((res) => {
return res.data;
})
.catch((error) => {
//console.log("API call error", error);
});
};
export const getPortalModuleDetails = (appealType, caseReference) => {
//console.log(
// BASE_URL +
@@ -864,7 +888,13 @@ export const createWatchedCases = (formValues) => {
});
};
export const createNewCase = (appealTypeId, lpaID, contactid, createBody) => {
export const createNewCase = (
appealTypeId,
lpaID,
contactid,
createBody,
containerName
) => {
appealTypeId = parseInt(appealTypeId);
var data = createBody;
@@ -875,7 +905,9 @@ export const createNewCase = (appealTypeId, lpaID, contactid, createBody) => {
"&lpaID=" +
lpaID +
"&contactid=" +
contactid;
contactid +
"&containername=" +
containerName;
var config = {
method: "post",
@@ -1004,6 +1036,31 @@ export const deleteAwaitingSubmissions = (incidentID) => {
});
};
export const deleteAwaitingSubmissionsFromBlob = (
containerID,
casefolderID
) => {
var queryUrl =
"/api/file/deleteawaitingsubmissionsfromblob?container=" +
containerID +
"&casefolderID=" +
casefolderID;
var config = {
method: "get",
url: queryUrl,
};
//console.log(config);
return axios(config)
.then((res) => {
//console.log("deleted ", res.data);
return res.data;
})
.catch((error) => {
console.log("this serror", error);
});
};
export const deleteWatchedCases = (watchedCaseID) => {
var queryUrl =
"/api/endpoint/deletewatchedcases_api?watchedCaseID=" + watchedCaseID;
@@ -1165,7 +1222,7 @@ export const downloadBlob = (containerName, blobName) => {
{ responseType: "blob" }
)
.then((response) => {
console.log("Downloaded blob content:www");
console.log("Downloaded blob content:");
res.setHeader(
"content-disposition",
@@ -1181,7 +1238,6 @@ export const downloadBlob = (containerName, blobName) => {
};
export const getProgressFromBlob = async (containerName, casereference) => {
console.log("cont:", containerName);
try {
const res = await axios.get(
BASE_URL +
@@ -1201,3 +1257,34 @@ export const getProgressFromBlob = async (containerName, casereference) => {
console.log("this serror", error);
}
};
export const sendEmail = async (
emailToAddress,
emailSubject,
emailContentTitle,
emailContent
) => {
var mailData = {
"email": emailToAddress,
"subject": emailSubject,
"emailcontenttitle": emailContentTitle,
"emailcontent": emailContent,
};
var queryUrl = "/api/email";
var config = {
method: "post",
url: queryUrl,
data: mailData,
};
return axios(config)
.then((res) => {
//console.log("posted ", res.data);
return res.data;
})
.catch((error) => {
console.log("this serror", error);
});
};