decopled crm for new appeals - all made on storage

This commit is contained in:
2022-09-28 10:13:36 +01:00
parent bfcd0329c6
commit 745b51839a
15 changed files with 451 additions and 99 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ RELAYPATH = "dev-pedw-hc"
GOOGLE_TAG_MANAGER = GTM-T78CBC3
SHOWLOGIN = "false"
SHOWLOGIN = "true"
SHOWREPRESENTATIONS = false
SHOWFILEUPLOAD = "false"
SHOWMAPS = "true"
+37 -7
View File
@@ -78,6 +78,7 @@ export const getBlobs = async (containerName, casefolderID) => {
"path": blob.name,
"documentType": blobDocumentType,
"versionId": blob.versionId,
"caseObj": casefolderID + "/" + casefolderID + "_case.json",
"isCurrentVersion": blob.isCurrentVersion,
"contentLength": blob.properties.contentLength,
"contentType": blob.contentType,
@@ -137,7 +138,7 @@ export const createBlob = async (formContent, containerName, caseref) => {
let caseID = formContent.pinswg_name;
const content = JSON.stringify(formContent);
const blobName = caseID + "/" + caseID + ".json";
const blobName = caseID + "/" + caseID + "_appeal.json";
console.log("blobName:", blobName);
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
@@ -280,6 +281,8 @@ export const downloadAllProgressFiles = async (
let blobClient = {};
let downloadedBlob = {};
let downloaded = "";
let caseBlob = {};
let caseDownloaded = "";
let blobCount = 0;
for (const prop in progressBlobObj) {
@@ -295,8 +298,29 @@ export const downloadAllProgressFiles = async (
downloaded = downloaded.substring(0, downloaded.length - 1);
//console.log(downloaded);
return '{ "@odata.count": ' + blobCount + ',"value": [' + downloaded + "]}";
for (const prop in progressBlobObj) {
//console.log(`${prop}: ${progressBlobObj[prop].caseObj}`);
blobClient = containerClient.getBlobClient(
progressBlobObj[prop].caseObj
);
caseBlob = await blobClient.download(0);
caseDownloaded =
caseDownloaded +
(await streamToBuffer(caseBlob.readableStreamBody)) +
",";
}
caseDownloaded = caseDownloaded.substring(0, caseDownloaded.length - 1);
return (
'{ "@odata.count": ' +
blobCount +
',"value": [' +
downloaded +
'],"case":[' +
caseDownloaded +
"]}"
);
};
const streamToBuffer = async (readableStream) => {
@@ -324,7 +348,6 @@ export const getCaseBlob = async (
creds
);
console.log("have got to create case");
containerClient.createIfNotExists();
let blobCount = 0;
@@ -335,7 +358,7 @@ export const getCaseBlob = async (
}
const content = JSON.stringify(formContent);
const blobName = caseReference + "/case/" + caseReference + ".json";
const blobName = caseReference + "/case/" + caseReference + "_case.json";
console.log("blobName:", blobName);
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
@@ -365,16 +388,18 @@ export const getProgressBlobs = async (containerName, caseReference) => {
blobCount++;
}
//console.log("this is the caasefolder:", caseReference, blobCount);
console.log("this is the caasefolder:", caseReference, blobCount);
let blobObj = [];
for await (const blob of containerClient.listBlobsFlat({
prefix: caseReference + "/" + caseReference + ".json",
prefix: caseReference + "/" + caseReference + "_appeal.json",
})) {
console.log("in here");
blobObj.push({
"name": blob.name.split("/")[1],
"path": blob.name,
"versionId": blob.versionId,
"caseObj": caseReference + "/" + caseReference + "_case.json",
"isCurrentVersion": blob.isCurrentVersion,
"contentLength": blob.properties.contentLength,
"contentType": blob.contentType,
@@ -444,6 +469,11 @@ export const getAllProgressBlobs = async (containerName) => {
"name": blob.name.split("/")[1],
"path": blob.name,
"versionId": blob.versionId,
"caseObj":
blob.name.split("/")[0] +
"/case/" +
blob.name.split("/")[0] +
"_case.json",
"isCurrentVersion": blob.isCurrentVersion,
"contentLength": blob.properties.contentLength,
"contentType": blob.contentType,
+93 -16
View File
@@ -743,21 +743,6 @@ export const getAwaitingSubmissionProxy = (loggedInUserId) => {
});
};
export const getAwaitingSubmissionFromBlobProxy = (containerName) => {
return axios
.get(
BASE_URL +
"/api/file/getawaitingsubmissionfromblob?container=" +
containerName
)
.then((res) => {
return res.data;
})
.catch((error) => {
//console.log("API call error", error);
});
};
export const getAwaitingSubmission = (loggedInUserId) => {
return axios
.get(
@@ -792,6 +777,21 @@ export const getAwaitingSubmissionFromBlob = (containerName) => {
});
};
export const getAwaitingSubmissionFromBlobProxy = (containerName) => {
return axios
.get(
BASE_URL +
"/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 +
@@ -934,6 +934,45 @@ export const createNewCase = (
});
};
export const createNewCaseBlob = (
appealTypeId,
lpaID,
contactid,
createBody,
containerName,
lpaName
) => {
appealTypeId = parseInt(appealTypeId);
var data = createBody;
data.pinswg_lpaname = lpaName;
var queryUrl =
"/api/file/createcase_api?appealTypeId=" +
appealTypeId +
"&lpaID=" +
lpaID +
"&contactid=" +
contactid +
"&containername=" +
containerName;
var config = {
method: "post",
url: BASE_URL + queryUrl,
data: data,
};
return axios(config)
.then((res) => {
return res.data;
})
.catch((error) => {
console.log("this serror", error);
});
};
export const updateCase = async (
incidentId,
updateBody,
@@ -972,6 +1011,44 @@ export const updateCase = async (
});
};
export const updateCaseBlob = async (
incidentId,
updateBody,
updateFormCollection,
primaryAttribute,
caseReference
) => {
var data = updateBody;
var appealObj = await getAppealID(
caseReference,
updateFormCollection,
primaryAttribute
);
var queryUrl =
"/api/file/updatecase_api?updateFormCollection=" +
updateFormCollection +
"&appealObj=" +
appealObj;
var config = {
method: "post",
url: queryUrl,
data: updateBody,
};
//console.log(data);
return axios(config)
.then((res) => {
return res.data;
})
.catch((error) => {
//console.log("API call error", error);
});
};
export const patchCase = async (incidentid) => {
var queryUrl = "/api/endpoint/patchcase_api?incidentid=" + incidentid;
var config = {
@@ -1232,7 +1309,7 @@ export const downloadBlob = (containerName, blobName) => {
{ responseType: "blob" }
)
.then((response) => {
console.log("Downloaded blob content:");
//console.log("Downloaded blob content:");
res.setHeader(
"content-disposition",
+2 -2
View File
@@ -94,7 +94,7 @@ const MyPortal = (props) => {
<div className="flex-container grid-row govuk-body ">
<MakeNewAppeal />
<SearchCases />
{props.awaitingSubmission.awaitingSubmission[
{/* {props.awaitingSubmission.awaitingSubmission[
"@odata.count"
] > 0 && (
<AwaitingSubmission
@@ -102,7 +102,7 @@ const MyPortal = (props) => {
props.awaitingSubmission
}
/>
)}
)} */}
{props.awaitingSubmission
.awaitingSubmissionFromBlob["@odata.count"] >
0 && (
@@ -3,7 +3,12 @@ import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import TopThree from "./topthree";
import { connect } from "react-redux";
import { setCurrentView } from "../../store/currentView/action";
import {
setCurrentView,
setCurrentReference,
} from "../../store/currentView/action";
import jsonpath from "jsonpath";
import transLookup from "../../data/lookuptranslations.json";
import {
deleteAwaitingSubmissionsFromBlob,
getAwaitingSubmissionFromBlobProxy,
@@ -21,6 +26,7 @@ const AwaitingSubmissionFromBlob = (props) => {
let topthreeRow = [];
let showTopThreeArr = props.awaitingSubmissionFromBlob.value;
let showTopThreeArrDets = props.awaitingSubmissionFromBlob.case;
const deleteCaseItem = (containerID, caseID) => {
let cookies = parseCookies();
@@ -40,6 +46,13 @@ const AwaitingSubmissionFromBlob = (props) => {
let topThreeOnlyArr = showTopThreeArr;
console.log(showTopThreeArr);
Object.keys(topThreeOnlyArr).map((key, index) => {
console.log(key, showTopThreeArr[key].pinswg_appealcasetype);
console.log("subsssss:", showTopThreeArr[key]);
let urlname = getFormCollectionByID(
showTopThreeArr[key].pinswg_appealcasetype
).UrlName;
topthreeRow.push(
<div className="cardModuleItem" key={index}>
<div className="cardModuleDetails">
@@ -52,10 +65,7 @@ const AwaitingSubmissionFromBlob = (props) => {
? "/fymhorth/parhauigyflwyno"
: "/myportal" +
"/" +
getFormCollectionByID(
showTopThreeArr[key]
.pinswg_appealcasetype
).UrlName +
urlname +
"?lpa=" +
showTopThreeArr[key][
"_pinswg_associatedlpa_value"
@@ -73,25 +83,14 @@ const AwaitingSubmissionFromBlob = (props) => {
className="govuk-link--no-underline"
data-id={index}
onClick={() => {
setCurrentReference({
props.setCurrentReference({
"currentReference":
topThreeType != "watchedCases"
? topThreeType !=
"myRepresentations"
? showTopThreeArr[key]
.ticketnumber
: showTopThreeArr[key][
"_pinswg_case_value@OData.Community.Display.V1.FormattedValue"
]
: showTopThreeArr[key][
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
],
"currentType": topThreeType,
showTopThreeArr[key].ticketnumber,
"incidentid": getIncidentId(
topThreeType,
showTopThreeArr[key]
),
"currentType": "awaitingSubmission",
"incidentid":
showTopThreeArr[key].incidentid,
"appealType":
showTopThreeArr[key]
@@ -103,6 +102,14 @@ const AwaitingSubmissionFromBlob = (props) => {
</a>
</Link>
</div>
<div>
<b>Appeal type:</b>{" "}
{
getFormCollectionByID(
showTopThreeArr[key].pinswg_appealcasetype
).value
}
</div>
<div className="carModuleAddress">
<b>{t("myportal:case-address")}:</b>{" "}
{_.isEmpty(showTopThreeArr)
@@ -131,6 +138,42 @@ const AwaitingSubmissionFromBlob = (props) => {
.pinswg_siteaddresstown
: "")}
</div>
{showTopThreeArrDets[key].pinswg_appellantagent != null && (
<div>
{showTopThreeArrDets[key].pinswg_appellantagent !=
846040000 && <b>Raised by: </b>}
{showTopThreeArrDets[key].pinswg_appellantagent !=
846040000 &&
(showTopThreeArrDets[key]
.pinswg_agentcompanyname != null &&
showTopThreeArrDets[key]
.pinswg_agentcompanyname + ", ") +
showTopThreeArrDets[key]
.pinswg_agentfirstname +
" " +
showTopThreeArrDets[key]
.pinswg_agentlastname}
</div>
)}
{showTopThreeArrDets[key].pinswg_appellantfirstname !=
null && (
<div>
<b>On behalf of: </b>
{showTopThreeArrDets[key]
.pinswg_appellantfirstname +
" " +
showTopThreeArrDets[key]
.pinswg_appellantlastname}
</div>
)}
{router.locale == "cy"
? jsonpath.query(
transLookup,
'$..[?(@.value=="' +
showTopThreeArrDets[key]["pinswg_lpaname"] +
'")].value_cy'
)
: showTopThreeArrDets[key]["pinswg_lpaname"] || ""}
</div>
<div className="">
<a
@@ -196,6 +239,9 @@ const mapDispatchToProps = (dispatch) => {
setCurrentView: (currentView) => {
dispatch(setCurrentView(currentView));
},
setCurrentReference: (currentReference) => {
dispatch(setCurrentReference(currentReference));
},
setAwaitingSubmissionFromBlob: (awaitingSubmission) => {
dispatch(setAwaitingSubmissionFromBlob(awaitingSubmission));
},
+7 -7
View File
@@ -177,13 +177,13 @@ let BuildSection = (props) => {
let updateFormCollection = appTypeCollection.LogicalCollectionName;
let primaryAttribute = appTypeCollection.PrimaryIdAttribute;
updateCase(
incidentId,
updateBody,
updateFormCollection,
primaryAttribute,
props.appealType.caseReference.ticketnumber
);
// updateCase(
// incidentId,
// updateBody,
// updateFormCollection,
// primaryAttribute,
// props.appealType.caseReference.ticketnumber
// );
sendSavedEmail == true &&
sendEmail(
+14 -6
View File
@@ -14,7 +14,7 @@ import {
import { getFormCollectionByID } from "../utils";
import FileUpload from "./fileupload";
import Aboutyou from "./aboutyou";
import { createNewCase, consoleLogger } from "../../actions";
import { createNewCase, createNewCaseBlob, consoleLogger } from "../../actions";
import { FieldsTranslations } from "../elements";
let CreateCase = (props) => {
@@ -448,14 +448,22 @@ let CreateCase = (props) => {
delete values.confirmHASCAS;
console.log(appTypeCollection);
createNewCase(
// createNewCase(
// appTypeCollection.appealTypeID,
// values.lpaTypes,
// props.loggedInUser,
// values,
// props.containerID
// )
createNewCaseBlob(
appTypeCollection.appealTypeID,
values.lpaTypes,
props.loggedInUser,
values,
props.containerID
props.containerID,
props1.LPAData.LPAData.value.filter((obj) => {
return obj.accountid === values.lpaTypes;
})[0].name
)
.then((data) => {
router.replace(
@@ -467,7 +475,7 @@ let CreateCase = (props) => {
"&apt=" +
whichAppealType +
"&id=" +
data.incidentid
data.ticketnumber
);
return data;
})
+16
View File
@@ -1,4 +1,5 @@
import jsonpath from "jsonpath";
import { v4 as uuidv4 } from "uuid";
import data from "../../data/collections.json";
import {
getBasicSearchDetails,
@@ -341,3 +342,18 @@ export const getProgressObj = (
//console.log(progObj);
return progObj;
};
export const getTempCaseRef = () => {
function randomString(length) {
return Math.random().toString(36).substr(2, length);
}
const randomGUID = uuidv4();
return (
"TMP-" +
randomString(5).toUpperCase() +
"-" +
randomString(6).toUpperCase()
);
};
+56 -28
View File
@@ -7,7 +7,8 @@
"UrlName": "dns",
"MetadataId": "36f07225-4a82-eb11-aac0-00224800be9c",
"appealTypeID": "846040011",
"NavigationProperty": "pinswg_DNSIds"
"NavigationProperty": "pinswg_DNSIds",
"value": "Developments of National Significance"
},
{
"LogicalCollectionName": "pinswg_planningobligationappeals106s",
@@ -16,7 +17,8 @@
"UrlName": "planningobligationappeals106",
"MetadataId": "cb8beeae-8f81-eb11-aac0-00224800be9c",
"appealTypeID": "846040003",
"NavigationProperty": "pinswg_PlanningObligationAppealS106Ids"
"NavigationProperty": "pinswg_PlanningObligationAppealS106Ids",
"value": "Planning Obligation Appeal - S106"
},
{
"LogicalCollectionName": "pinswg_planningconditionss73s79s",
@@ -25,7 +27,8 @@
"UrlName": "planningconditionss73s79",
"MetadataId": "093bf9ff-8d81-eb11-aac0-00224800be9c",
"appealTypeID": "846040001",
"NavigationProperty": "pinswg_PlanningConditionsS73S79Ids"
"NavigationProperty": "pinswg_PlanningConditionsS73S79Ids",
"value": "Planning Conditions - S73 + S79"
},
{
"LogicalCollectionName": "pinswg_rows",
@@ -34,7 +37,8 @@
"UrlName": "row",
"MetadataId": "4ccc6e93-4f82-eb11-aac0-00224800be9c",
"appealTypeID": "846040015",
"NavigationProperty": "pinswg_ROWIds"
"NavigationProperty": "pinswg_ROWIds",
"value": "Rights of Way"
},
{
"LogicalCollectionName": "pinswg_transportandworkacts",
@@ -43,7 +47,8 @@
"UrlName": "transportandworkact",
"MetadataId": "bc3edc4b-7d82-eb11-aac0-00224800be9c",
"appealTypeID": "846040013",
"NavigationProperty": ""
"NavigationProperty": "",
"value": "Transport and Works Act"
},
{
"LogicalCollectionName": "pinswg_transportandworkacts",
@@ -52,7 +57,8 @@
"UrlName": "transportandworkact",
"MetadataId": "bc3edc4b-7d82-eb11-aac0-00224800be9c",
"appealTypeID": "846040013",
"NavigationProperty": "pinswg_TransportandWorkActIdspinswg_TransportandWorkActIds"
"NavigationProperty": "pinswg_TransportandWorkActIdspinswg_TransportandWorkActIds",
"value": "Transport and Works Act"
},
{
"LogicalCollectionName": "pinswg_transportandworkacts",
@@ -61,7 +67,8 @@
"UrlName": "transportandworksact",
"MetadataId": "bc3edc4b-7d82-eb11-aac0-00224800be9c",
"appealTypeID": "846040013",
"NavigationProperty": "pinswg_TransportandWorkActIdspinswg_TransportandWorkActIds"
"NavigationProperty": "pinswg_TransportandWorkActIdspinswg_TransportandWorkActIds",
"value": "Transport and Works Act"
},
{
"LogicalCollectionName": "pinswg_harbourrevisionorders",
@@ -70,7 +77,8 @@
"UrlName": "harbourrevisionorder",
"MetadataId": "dc8dcd0d-4f82-eb11-aac0-00224800be9c",
"appealTypeID": "846040014",
"NavigationProperty": "pinswg_HarbourRevisionOrderIds"
"NavigationProperty": "pinswg_HarbourRevisionOrderIds",
"value": "Harbour Revision Order"
},
{
"LogicalCollectionName": "pinswg_miscellaneouscaseworks",
@@ -106,7 +114,8 @@
"UrlName": "planningappeals78",
"MetadataId": "8d7f813a-4183-eb11-aac0-00224800be9c",
"appealTypeID": "846040000",
"NavigationProperty": "pinswg_PlanningAppealS78Ids"
"NavigationProperty": "pinswg_PlanningAppealS78Ids",
"value": "Planning Appeal - S78"
},
{
"LogicalCollectionName": "pinswg_lawfuldevelopmentcertificates",
@@ -124,7 +133,8 @@
"UrlName": "lawfuldevelopmentcertificateappeals1941",
"MetadataId": "184e4861-9681-eb11-aac0-00224800be9c",
"appealTypeID": "846040008",
"NavigationProperty": "pinswg_LawfulDevelopmentCertificatAppIds"
"NavigationProperty": "pinswg_LawfulDevelopmentCertificatAppIds",
"value": "Lawful Development Certificate Appeal - S194 + 195"
},
{
"LogicalCollectionName": "pinswg_lawfuldevelopmentcertificates",
@@ -133,7 +143,8 @@
"UrlName": "lawfuldevelopmentcertificate",
"MetadataId": "184e4861-9681-eb11-aac0-00224800be9c",
"appealTypeID": "846040008",
"NavigationProperty": "pinswg_LawfulDevelopmentCertificatAppIds"
"NavigationProperty": "pinswg_LawfulDevelopmentCertificatAppIds",
"value": "Lawful Development Certificate Appeal - S194 + 195"
},
{
"LogicalCollectionName": "pinswg_householderappealhases",
@@ -142,7 +153,8 @@
"UrlName": "householderappealhas",
"MetadataId": "a6c728b0-9081-eb11-aac0-00224800be9c",
"appealTypeID": "846040004",
"NavigationProperty": "pinswg_HouseholderAppealHASIds"
"NavigationProperty": "pinswg_HouseholderAppealHASIds",
"value": "Householder and Minor Commercial Appeals - HAS/CAS"
},
{
"LogicalCollectionName": "pinswg_enforcementlistedbuildingconservationaps",
@@ -160,7 +172,8 @@
"UrlName": "enforcementlistedbuildingconservationap",
"MetadataId": "c697be96-9481-eb11-aac0-00224800be9c",
"appealTypeID": "846040006",
"NavigationProperty": "pinswg_EnforcementListedBuildingConseIds"
"NavigationProperty": "pinswg_EnforcementListedBuildingConseIds",
"value": "Enforcement Listed Building and Conservation Appeal - S39"
},
{
"LogicalCollectionName": "pinswg_enforcementlistedbuildingconservationaps",
@@ -178,7 +191,8 @@
"UrlName": "callinss77",
"MetadataId": "dd309e51-4982-eb11-aac0-00224800be9c",
"appealTypeID": "846040010",
"NavigationProperty": "pinswg_CallInsS77Ids"
"NavigationProperty": "pinswg_CallInsS77Ids",
"value": "Called In Applications - S77"
},
{
"LogicalCollectionName": "pinswg_commonlands",
@@ -187,7 +201,8 @@
"UrlName": "commonland",
"MetadataId": "4161a618-5082-eb11-aac0-00224800be9c",
"appealTypeID": "846040016",
"NavigationProperty": "pinswg_CommonLandIds"
"NavigationProperty": "pinswg_CommonLandIds",
"value": "Common Land"
},
{
"LogicalCollectionName": "pinswg_advertses",
@@ -196,7 +211,8 @@
"UrlName": "adverts",
"MetadataId": "0735866b-5482-eb11-aac0-00224800be9c",
"appealTypeID": "846040018",
"NavigationProperty": "pinswg_AdvertsIds"
"NavigationProperty": "pinswg_AdvertsIds",
"value": "Adverts"
},
{
"LogicalCollectionName": "pinswg_hedgeshedgerowstreepreservationreplacems",
@@ -205,7 +221,8 @@
"UrlName": "hedgeshedgerowstreepreservationreplacem",
"MetadataId": "60f38fed-5382-eb11-aac0-00224800be9c",
"appealTypeID": "846040017",
"NavigationProperty": "pinswg_HedgesHedgerowsTreePreservatioIds"
"NavigationProperty": "pinswg_HedgesHedgerowsTreePreservatioIds",
"value": "High Hedges, Tree Preservation orders, Hedgerows, Tree Replacement Notice."
},
{
"LogicalCollectionName": "pinswg_hedgeshedgerowstreepreservationreplacems",
@@ -214,7 +231,8 @@
"UrlName": "hedgeshedgerowstreepreservationreplacem",
"MetadataId": "60f38fed-5382-eb11-aac0-00224800be9c",
"appealTypeID": "846040017",
"NavigationProperty": "pinswg_HedgesHedgerowsTreePreservatioIds"
"NavigationProperty": "pinswg_HedgesHedgerowsTreePreservatioIds",
"value": "High Hedges, Tree Preservation orders, Hedgerows, Tree Replacement Notice."
},
{
"LogicalCollectionName": "pinswg_hedgeshedgerowstreepreservationreplacems",
@@ -223,7 +241,8 @@
"UrlName": "hedgeshedgerowstreepreservationreplacem",
"MetadataId": "60f38fed-5382-eb11-aac0-00224800be9c",
"appealTypeID": "846040017",
"NavigationProperty": "pinswg_HedgesHedgerowsTreePreservatioIds"
"NavigationProperty": "pinswg_HedgesHedgerowsTreePreservatioIds",
"value": "High Hedges, Tree Preservation orders, Hedgerows, Tree Replacement Notice."
},
{
"LogicalCollectionName": "pinswg_compulsorypurchaseorderses",
@@ -232,7 +251,8 @@
"UrlName": "compulsorypurchaseorders",
"MetadataId": "054da4c7-5582-eb11-aac0-00224800be9c",
"appealTypeID": "846040019",
"NavigationProperty": "pinswg_CompulsoryPurchaseOrdersIds"
"NavigationProperty": "pinswg_CompulsoryPurchaseOrdersIds",
"value": "Compulsory Purchase Orders"
},
{
"LogicalCollectionName": "pinswg_communityinfrastructurelevys117118119s",
@@ -241,7 +261,8 @@
"UrlName": "communityinfrastructurelevys117118119",
"MetadataId": "0c309f3c-4882-eb11-aac0-00224800be9c",
"appealTypeID": "846040009",
"NavigationProperty": "pinswg_CommunityInfrastructureLevyIds"
"NavigationProperty": "pinswg_CommunityInfrastructureLevyIds",
"value": "Community Infrastructure Levy - S117, 118, & 119"
},
{
"LogicalCollectionName": "pinswg_objectiveconfigs",
@@ -259,7 +280,8 @@
"UrlName": "nonvalidation",
"MetadataId": "37f31a93-5882-eb11-aac0-00224800be9c",
"appealTypeID": "846040024",
"NavigationProperty": "pinswg_NonValidationIds"
"NavigationProperty": "pinswg_NonValidationIds",
"value": "Non-Validation"
},
{
"LogicalCollectionName": "pinswg_caseinvolvements",
@@ -304,7 +326,8 @@
"UrlName": "wayleave",
"MetadataId": "a0652117-5782-eb11-aac0-00224800be9c",
"appealTypeID": "846040021",
"NavigationProperty": "pinswg_WayleaveIds"
"NavigationProperty": "pinswg_WayleaveIds",
"value": "Wayleave"
},
{
"LogicalCollectionName": "pinswg_listedbuildingandconservationareaconsens",
@@ -313,7 +336,8 @@
"UrlName": "listedbuildingandconservationareaconsen",
"MetadataId": "4cd95405-8f81-eb11-aac0-00224800be9c",
"appealTypeID": "846040025",
"NavigationProperty": "pinswg_ListedBuildingandConservationrIds"
"NavigationProperty": "pinswg_ListedBuildingandConservationrIds",
"value": "Listed Building and Conservation Area Consent"
},
{
"LogicalCollectionName": "pinswg_environmentalpermittings",
@@ -322,7 +346,8 @@
"UrlName": "environmentalpermitting",
"MetadataId": "62d4aa9a-5682-eb11-aac0-00224800be9c",
"appealTypeID": "846040020",
"NavigationProperty": "pinswg_EnforcementPermittingIds"
"NavigationProperty": "pinswg_EnforcementPermittingIds",
"value": "Environmental Permitting"
},
{
"LogicalCollectionName": "pinswg_enforcementnoticeappeals174s",
@@ -331,7 +356,8 @@
"UrlName": "enforcementnoticeappeals174",
"MetadataId": "930a3cc4-9181-eb11-aac0-00224800be9c",
"appealTypeID": "846040005",
"NavigationProperty": "pinswg_EnforcementNoticeAppealS174Ids"
"NavigationProperty": "pinswg_EnforcementNoticeAppealS174Ids",
"value": "Enforcement Notice Appeal - S174"
},
{
"LogicalCollectionName": "pinswg_ldps",
@@ -349,7 +375,8 @@
"UrlName": "maintenanceoflands217",
"MetadataId": "bb302784-9581-eb11-aac0-00224800be9c",
"appealTypeID": "846040007",
"NavigationProperty": "pinswg_MaintenanceofLandS217Ids"
"NavigationProperty": "pinswg_MaintenanceofLandS217Ids",
"value": "Maintenance of Land - S217"
},
{
"LogicalCollectionName": "pinswg_electricityacts",
@@ -358,7 +385,8 @@
"UrlName": "electricityact",
"MetadataId": "6aedaab1-4a82-eb11-aac0-00224800be9c",
"appealTypeID": "846040012",
"NavigationProperty": "pinswg_ElectricityActIds"
"NavigationProperty": "pinswg_ElectricityActIds",
"value": "Electricity Act"
}
]
}
+82
View File
@@ -0,0 +1,82 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions";
import { getCaseBlob, createBlob } from "../../../actions/azurestorage";
import { getTempCaseRef } from "../../../components/utils";
import { v4 as uuidv4 } from "uuid";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
process.env.RELAY_ROOT ||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
const hashAPIPath = (queryPath) => {
var hashlink = CryptoJS.HmacSHA256(
queryPath,
CryptoJS.enc.Hex.parse(WORDKEY)
);
hashlink = hashlink.toString(CryptoJS.enc.Hex);
//return "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var createCaseBody = req.body;
var contactid = req.query.contactid;
var appealTypeId = req.query.appealTypeId;
var containerName = req.query.containername;
var lpaID = req.query.lpaID;
var queryUrl = "incidents";
var token = await getToken();
var tempCaseRef = getTempCaseRef();
var data = {
"title": tempCaseRef,
"ticketnumber": tempCaseRef,
"incidentid": uuidv4(),
"statecode": 0,
"statuscode": 1,
"caseorigincode": 3,
"servicestage": 1,
"customerid_contact@odata.bind": "/contacts(" + contactid + ")",
"pinswg_appealcasetype": appealTypeId,
"pinswg_AssociatedLPA@odata.bind": "/accounts(" + lpaID + ")",
};
var newData = Object.assign(data, createCaseBody);
delete newData.lpaTypes;
delete newData.appealTypes;
console.log("/////Create Case:\n", newData, "\n//////////////");
var newAppealObj = {
"pinswg_name": tempCaseRef,
"pinswg_appealcasetype": appealTypeId,
"_pinswg_associatedlpa_value": lpaID,
};
// var config = {
// method: "post",
// url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
// headers: {
// "OData-MaxVersion": "4.0",
// "OData-Version": "4.0",
// "Accept": "application/json",
// "Prefer": 'odata.include-annotations="*",return=representation',
// "Authorization": "Bearer " + token.access_token,
// "Content-Type": "application/json",
// },
// data: JSON.stringify(newData),
// };
var apiResponse = _.isEmpty(req.query)
? res.status(400).json()
: (getCaseBlob(containerName, tempCaseRef, newData),
createBlob(JSON.stringify(newAppealObj), containerName),
res.status(200).json(newData));
return apiResponse;
}
@@ -24,7 +24,6 @@ ApiProxy.get(async (req, res) => {
//if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
const blobObj = await getAllProgressBlobs(containerName)
.then((data) => {
//console.log(data);
return downloadAllProgressFiles(containerName, data);
})
.then((data) => {
+56
View File
@@ -0,0 +1,56 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { getToken, patchCase } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
process.env.RELAY_ROOT ||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
const hashAPIPath = (queryPath) => {
var hashlink = CryptoJS.HmacSHA256(
queryPath,
CryptoJS.enc.Hex.parse(WORDKEY)
);
hashlink = hashlink.toString(CryptoJS.enc.Hex);
//return "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var data = JSON.stringify(req.body);
var appealObj = req.query.appealObj;
var incidentID = req.query.incident;
var updateFormCollection = req.query.updateFormCollection;
var queryUrl = updateFormCollection + "(" + appealObj + ")";
var token = await getToken();
var config = {
method: "patch",
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json",
"Prefer": 'odata.include-annotations="*"',
"Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json",
},
data: data,
};
//console.log("update case:", data);
return axios(config)
.then(({ data }) => {
res.status(200).json(data);
})
.catch((error) => {
res.status(400);
});
}
+3 -2
View File
@@ -243,7 +243,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
query.casereference
);
// console.log("/////////\nappeal type data:", appealTypeData);
//console.log("/////////\nappeal type data:", appealTypeData);
//
// Removed to make progress from Blob not CRM
@@ -295,9 +295,10 @@ export const getServerSideProps = wrapper.getServerSideProps(
store.dispatch(setCaseReference(caseReference));
store.dispatch(setForm(xmlStr, mandatoryFieldsData, pickListData));
store.dispatch(setAppealType(appealTypeData));
store.dispatch(setFilesForAppeal(blobList));
store.dispatch(setContainerID(thisSession.user.id));
store.dispatch(setFilesForAppeal(blobList));
return {
props: { url: process.env.API_ROOT },
};
+7 -1
View File
@@ -198,6 +198,12 @@ export const getServerSideProps = wrapper.getServerSideProps(
await getAwaitingSubmissionFromBlob(thisSession.user.id),
]);
// console.log(
// "/////////////////////////\n ",
// awaitingSubmissionFromBlob.value,
// awaitingSubmissionFromBlob.case
// );
if (_.has(accountDetails, "errorCode") != false) {
return {
redirect: {
@@ -234,7 +240,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
);
store.dispatch(
setAwaitingSubmissionDetails(awaitingSubmissionDetails)
setAwaitingSubmissionDetails(awaitingSubmissionFromBlob)
);
store.dispatch(setContainerID(thisSession.user.id));
+9 -6
View File
@@ -9,6 +9,7 @@ import xpath from "xpath";
import {
getCase,
getAppealsTypes,
getAppealsTypesForNewAppeal,
getMandatoryFields,
getPickLists,
getFilesFromBlob,
@@ -232,14 +233,12 @@ export const getServerSideProps = wrapper.getServerSideProps(
console.log("logged ident:", loggedInUserIdent, loggedInUserEmail);
const [
caseReferenceData,
appealTypeData,
mandatoryFieldsData,
pickListData,
//blobList,
] = await Promise.all([
await getCase(query.id),
await getAppealsTypes(),
await getAppealsTypesForNewAppeal(),
await getMandatoryFields(query.appealtypes),
await getPickLists(query.appealtypes),
@@ -248,12 +247,16 @@ export const getServerSideProps = wrapper.getServerSideProps(
const blobProgress = await getProgressFromBlob(
loggedInUserIdent,
caseReferenceData.ticketnumber
query.id
);
console.log("anything here", loggedInUser, query.id, caseReferenceData);
console.log("anything here", loggedInUser, query.id, blobProgress);
let caseReference = caseReferenceData; //caseReferenceData.ticketnumber;
let caseReference = {};
caseReference.ticketnumber = query.id;
caseReference.incidentid = query.id;
caseReference.caseDetails = blobProgress; //searchDetailsObj;
var path = require("path");
const configDirectory = path.resolve(process.cwd(), "data/formsxml");