new appeals change involvment to appellant

This commit is contained in:
2024-11-29 13:11:26 +00:00
parent 202aa3cdb6
commit 0f8fc932e7
3 changed files with 43 additions and 10 deletions
@@ -1,9 +1,10 @@
import { hashAPIPath } from "../../../actions";
import { hashAPIPath, updateAccount } from "../../../actions";
import {
createCaseCompleteMessage,
getProgressBlobs,
downloadProgressFile,
createBlob,
getCaseBlob,
} from "../../../actions/azurestorage";
import nextConnect from "next-connect";
@@ -34,9 +35,15 @@ ApiProxy.get(async (req, res) => {
return downloadProgressFile(containerName, data.path, tempCaseRef);
});
Object.assign(blobProgress, {
"appealComplete": tempCaseRef,
});
const caseObj = await downloadProgressFile(
containerName,
tempCaseRef + "/" + tempCaseRef + "_case.json",
tempCaseRef
);
// Object.assign(blobProgress, {
// "appealComplete": tempCaseRef,
// });
delete blobProgress["pinswg_name"];
@@ -44,9 +51,31 @@ ApiProxy.get(async (req, res) => {
await createBlob(JSON.stringify(blobProgress), containerName, tempCaseRef)
.then(() => {
createCaseCompleteMessage(containerName, tempCaseRef);
return res.status(200).json({
status: "success",
//update case.json with lpa ref and description
Object.assign(caseObj, {
"pinswg_lpareference":
blobProgress.pinswg_lpaapplicationreference,
"description": blobProgress.pinswg_developmentdescription,
});
//send update case.json and then create queue message
getCaseBlob(containerName, tempCaseRef, caseObj).then(() => {
let contactId = caseObj["customerid_contact@odata.bind"];
contactId = contactId.match(/\(([^)]+)\)/);
updateAccount(
contactId[1],
{
"pinswg_typeofinvolvement": 846040001,
},
true
).then((data) => {
console.log("uopdated account: ", data);
});
createCaseCompleteMessage(containerName, tempCaseRef);
return res.status(200).json({
status: "success",
});
});
})
.catch((error) => {