sendemail function for gov notify

This commit is contained in:
2022-11-17 13:16:57 +00:00
parent b0a9b721a3
commit 6fe3fc51a6
9 changed files with 100 additions and 54 deletions
+9 -2
View File
@@ -328,6 +328,10 @@ export const uploadFile = async (formContent, containerName, foldername) => {
const tags = {
containerid: containerName,
caseID: foldername,
documentType: files[prop][0].fieldName.slice(
0,
files[prop][0].fieldName.indexOf("_")
),
};
const withTags = await blockBlobClient.setTags(tags);
const withMeta = await blockBlobClient.setMetadata(tags);
@@ -362,10 +366,13 @@ export const downloadProgressFile = async (
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
const containerClient = new ContainerClient(sasUrl);
const blobClient = containerClient.getBlobClient(blobName);
const downloadedBlob = await blobClient.download(0);
const downloadedBlob = await blobClient.download();
const downloaded = await streamToBuffer(downloadedBlob.readableStreamBody);
return downloaded;
console.log("Downloaded blob content:", downloaded.toString());
return JSON.parse(downloaded.toString());
};
export const downloadAllProgressFiles = async (
+9 -9
View File
@@ -1371,19 +1371,19 @@ export const getProgressFromBlob = async (containerName, casereference) => {
};
export const sendEmail = async (
emailToAddress,
emailSubject,
emailContentTitle,
emailContent
templateId,
emailAddress,
personalisation,
reference
) => {
var mailData = {
"email": emailToAddress,
"subject": emailSubject,
"emailcontenttitle": emailContentTitle,
"emailcontent": emailContent,
"templateId": templateId,
"emailAddress": emailAddress,
"reference": reference,
"personalisation": personalisation,
};
var queryUrl = "/api/email";
var queryUrl = "/api/email/notify";
var config = {
method: "post",