Merged PR 437: update proxy for get - update appeal record data
update proxy for get - update appeal record data Related work items: #5867
This commit is contained in:
+48
-38
@@ -137,8 +137,8 @@ export const getBasicSearchDetails = (appealType, caseReference) => {
|
||||
};
|
||||
|
||||
export const getFormData = (whichForm) => {
|
||||
console.log("got to axios", whichForm);
|
||||
console.log("api_root: ", BASE_URL);
|
||||
//console.log("got to axios", whichForm);
|
||||
//console.log("api_root: ", BASE_URL);
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL +
|
||||
@@ -299,7 +299,7 @@ export const getAppealTypeDetail = (caseReference, appealcasetype) => {
|
||||
//https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/pinswg_planningappeals78s?$filter=pinswg_name eq 'CAS-00015-L7J9H1'
|
||||
|
||||
export const getLPA = () => {
|
||||
console.log("api_root: ", BASE_URL);
|
||||
// console.log("api_root: ", BASE_URL);
|
||||
return axios
|
||||
.get(WEBAPI_URL + "accounts?$count=true&$select=name", azureHeaders)
|
||||
.then((res) => res.data)
|
||||
@@ -323,6 +323,32 @@ export const getPersonalAccount = () => {
|
||||
});
|
||||
};
|
||||
|
||||
export const getAppealID = (
|
||||
caseReference,
|
||||
updateFormCollection,
|
||||
primaryAttribute
|
||||
) => {
|
||||
const weburl =
|
||||
"/api/proxy/" +
|
||||
updateFormCollection +
|
||||
"?$count=true&$select=_" +
|
||||
primaryAttribute +
|
||||
"s_value&$filter=pinswg_name eq '" +
|
||||
caseReference +
|
||||
"'";
|
||||
|
||||
console.log("proxy url", weburl);
|
||||
return axios
|
||||
.get(weburl, azureHeaders)
|
||||
.then((res) => {
|
||||
var appealID = res.data.value[0][primaryAttribute];
|
||||
return appealID;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("thi serror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const createCase = (appealTypeId) => {
|
||||
appealTypeId = parseInt(appealTypeId);
|
||||
var data = JSON.stringify({
|
||||
@@ -345,7 +371,7 @@ export const createCase = (appealTypeId) => {
|
||||
},
|
||||
data: data,
|
||||
};
|
||||
console.log(config);
|
||||
// console.log(config);
|
||||
return axios(config)
|
||||
.then((res) => {
|
||||
// console.log("posted ", res.data);
|
||||
@@ -356,13 +382,27 @@ export const createCase = (appealTypeId) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const updateCase = (incidentId, updateBody, updateFormCollection) => {
|
||||
export const updateCase = async (
|
||||
incidentId,
|
||||
updateBody,
|
||||
updateFormCollection,
|
||||
primaryAttribute,
|
||||
caseReference
|
||||
) => {
|
||||
var data = JSON.stringify(updateBody);
|
||||
|
||||
var appealObj = await getAppealID(
|
||||
caseReference,
|
||||
updateFormCollection,
|
||||
primaryAttribute
|
||||
);
|
||||
|
||||
console.log("appeal obj ", appealObj);
|
||||
|
||||
var config = {
|
||||
method: "patch",
|
||||
//url: WEBAPI_URL + updateFormCollection + "(" + incidentId + ")",
|
||||
url: "/api/proxy/" + updateFormCollection + "(" + incidentId + ")",
|
||||
url: "/api/proxy/" + updateFormCollection + "(" + appealObj + ")",
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
@@ -373,7 +413,8 @@ export const updateCase = (incidentId, updateBody, updateFormCollection) => {
|
||||
},
|
||||
data: data,
|
||||
};
|
||||
// console.log(config);
|
||||
|
||||
console.log(config);
|
||||
return axios(config)
|
||||
.then((res) => {
|
||||
console.log("patched ", res.data);
|
||||
@@ -384,37 +425,6 @@ export const updateCase = (incidentId, updateBody, updateFormCollection) => {
|
||||
});
|
||||
};
|
||||
|
||||
// //jquery version to get case number from an lpa and an appeal type
|
||||
// var entity = {};
|
||||
// entity.caseorigincode = 3;
|
||||
// entity["customerid_account@odata.bind"] = "/accounts(c75f6f84-49da-eb11-aabd-00224800d1bd)";
|
||||
// entity.pinswg_appealcasetype = 846040004;
|
||||
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// contentType: "application/json; charset=utf-8",
|
||||
// datatype: "json",
|
||||
// url: Xrm.Page.context.getClientUrl() + "/api/data/v8.2/incidents",
|
||||
// data: JSON.stringify(entity),
|
||||
// beforeSend: function(XMLHttpRequest) {
|
||||
// XMLHttpRequest.setRequestHeader("OData-MaxVersion", "4.0");
|
||||
// XMLHttpRequest.setRequestHeader("OData-Version", "4.0");
|
||||
// XMLHttpRequest.setRequestHeader("Accept", "application/json");
|
||||
// XMLHttpRequest.setRequestHeader("Prefer", "odata.include-annotations=\"*\",return=representation");
|
||||
// },
|
||||
// async: true,
|
||||
// success: function(data, textStatus, xhr) {
|
||||
// var uri = xhr.getResponseHeader("OData-EntityId");
|
||||
// var regExp = /\(([^)]+)\)/;
|
||||
// var matches = regExp.exec(uri);
|
||||
// var newEntityId = matches[1];
|
||||
// //Handle returned attributes
|
||||
// },
|
||||
// error: function(xhr, textStatus, errorThrown) {
|
||||
// Xrm.Utility.alertDialog(textStatus + " " + errorThrown);
|
||||
// }
|
||||
// });
|
||||
|
||||
export const getMyCases = () => {
|
||||
return (
|
||||
axios
|
||||
|
||||
@@ -18,9 +18,19 @@ let CompleteAppeal = (props) => {
|
||||
let incidentId = props.appealType.caseReference.incidentid;
|
||||
let updateBody = props.props.form.appealForm.values;
|
||||
|
||||
let updateBindAppealTypeToIncident =
|
||||
"pinswg_" +
|
||||
props.appealType.caseReference[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
].replace(/[\s\-\+\(\)\,\&\.]/g, "") +
|
||||
"Ids";
|
||||
|
||||
Object.assign(updateBody, {
|
||||
"pinswg_name": props.appealType.caseReference.ticketnumber,
|
||||
[updateBindAppealTypeToIncident + "@odata.bind"]:
|
||||
"/incidents(" + incidentId + ")",
|
||||
});
|
||||
|
||||
updateBody = JSON.stringify(updateBody);
|
||||
|
||||
updateBody = updateBody.replace(/:"Yes"/gm, `:true`);
|
||||
@@ -35,7 +45,22 @@ let CompleteAppeal = (props) => {
|
||||
.toLowerCase()
|
||||
);
|
||||
|
||||
updateCase(incidentId, updateBody, updateFormCollection);
|
||||
let primaryAttribute = getPrimaryAttr(
|
||||
"pinswg_" +
|
||||
props.appealType.caseReference[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
.replace(/[\s\-\+\(\)\,\&\.]/g, "")
|
||||
.toLowerCase()
|
||||
);
|
||||
|
||||
updateCase(
|
||||
incidentId,
|
||||
updateBody,
|
||||
updateFormCollection,
|
||||
primaryAttribute,
|
||||
props.appealType.caseReference.ticketnumber
|
||||
);
|
||||
}, [props.appealType.caseReference, props.props.form.appealForm.values]);
|
||||
|
||||
const getFormCollection = (formtype) => {
|
||||
@@ -47,6 +72,14 @@ let CompleteAppeal = (props) => {
|
||||
return collectionName[0];
|
||||
};
|
||||
|
||||
const getPrimaryAttr = (formtype) => {
|
||||
const attrName = jsonpath.query(
|
||||
data,
|
||||
"$..[?(@.LogicalName=='" + formtype + "')].PrimaryIdAttribute"
|
||||
);
|
||||
return attrName[0];
|
||||
};
|
||||
|
||||
let { t } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
+62
-4
@@ -3,309 +3,367 @@
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_planningobligationss106flows",
|
||||
"LogicalName": "pinswg_planningobligationss106flow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "efb4c590-19be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_dnsflows",
|
||||
"LogicalName": "pinswg_dnsflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "328e015f-dabe-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_harbourrevisionorderflows",
|
||||
"LogicalName": "pinswg_harbourrevisionorderflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "98bbb26e-e7be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_transportandworkactflows",
|
||||
"LogicalName": "pinswg_transportandworkactflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "ad4bfc8c-e1be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_maintenanceoflands127flows",
|
||||
"LogicalName": "pinswg_maintenanceoflands127flow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "2b26362c-d3be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_environmentalpermittingflows",
|
||||
"LogicalName": "pinswg_environmentalpermittingflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "74dd4767-f2be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_dnses",
|
||||
"LogicalName": "pinswg_dns",
|
||||
"PrimaryIdAttribute": "pinswg_dnsid",
|
||||
"MetadataId": "36f07225-4a82-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_planningobligationappeals106s",
|
||||
"LogicalName": "pinswg_planningobligationappeals106",
|
||||
"PrimaryIdAttribute": "pinswg_planningobligationappeals106id",
|
||||
"MetadataId": "cb8beeae-8f81-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_planningconditionss73s79s",
|
||||
"LogicalName": "pinswg_planningconditionss73s79",
|
||||
"PrimaryIdAttribute": "pinswg_planningconditionss73s79id",
|
||||
"MetadataId": "093bf9ff-8d81-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_rows",
|
||||
"LogicalName": "pinswg_row",
|
||||
"PrimaryIdAttribute": "pinswg_rowid",
|
||||
"MetadataId": "4ccc6e93-4f82-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_transportandworkacts",
|
||||
"LogicalName": "pinswg_transportandworkact",
|
||||
"PrimaryIdAttribute": "pinswg_transportandworkactid",
|
||||
"MetadataId": "bc3edc4b-7d82-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_transportandworkacts",
|
||||
"LogicalName": "pinswg_transportandworksact",
|
||||
"PrimaryIdAttribute": "pinswg_transportandworkactid",
|
||||
"MetadataId": "bc3edc4b-7d82-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_wayleaveflows",
|
||||
"LogicalName": "pinswg_wayleaveflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "a28054b9-e3be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_planningappeals78flows",
|
||||
"LogicalName": "pinswg_planningappeals78flow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "ddaebde1-0fbe-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_harbourrevisionorders",
|
||||
"LogicalName": "pinswg_harbourrevisionorder",
|
||||
"PrimaryIdAttribute": "pinswg_harbourrevisionorderid",
|
||||
"MetadataId": "dc8dcd0d-4f82-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_miscellaneouscaseworks",
|
||||
"LogicalName": "pinswg_miscellaneouscasework",
|
||||
"PrimaryIdAttribute": "pinswg_miscellaneouscaseworkid",
|
||||
"MetadataId": "f519aa8e-5782-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_miscellaneouscaseworks",
|
||||
"LogicalName": "pinswg_misccasework",
|
||||
"PrimaryIdAttribute": "pinswg_miscellaneouscaseworkid",
|
||||
"MetadataId": "f519aa8e-5782-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_localdevelopmentplanses",
|
||||
"LogicalName": "pinswg_localdevelopmentplans",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "38ed3835-c1e0-eb11-aac5-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_planningappeals78s",
|
||||
"LogicalName": "pinswg_planningappeals78",
|
||||
"PrimaryIdAttribute": "pinswg_planningappeals78id",
|
||||
"MetadataId": "8d7f813a-4183-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_enforcementnoticeappealsflow174s",
|
||||
"LogicalName": "pinswg_enforcementnoticeappealsflow174",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "a933cf28-20be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_lawfuldevelopmentcertificates",
|
||||
"LogicalName": "pinswg_lawfuldevelopmentcertificate",
|
||||
"PrimaryIdAttribute": "pinswg_lawfuldevelopmentcertificateid",
|
||||
"MetadataId": "184e4861-9681-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_lawfuldevelopmentcertificates",
|
||||
"LogicalName": "pinswg_lawfuldevelopmentcertificateappeals194195",
|
||||
"PrimaryIdAttribute": "pinswg_lawfuldevelopmentcertificateid",
|
||||
"MetadataId": "184e4861-9681-eb11-aac0-00224800be9c"
|
||||
},
|
||||
|
||||
|
||||
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_highhedgestreepreservationflows",
|
||||
"LogicalName": "pinswg_highhedgestreepreservationflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "c365b924-f3be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_householderappealhases",
|
||||
"LogicalName": "pinswg_householderappealhas",
|
||||
"PrimaryIdAttribute": "pinswg_householderappealhasid",
|
||||
"MetadataId": "a6c728b0-9081-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_enforcementlistedbuildingconservationaps",
|
||||
"LogicalName": "pinswg_enforcementlistedbuildingconservationap",
|
||||
"PrimaryIdAttribute": "pinswg_enforcementlistedbuildingconservationapid",
|
||||
"MetadataId": "c697be96-9481-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_enforcementlistedbuildingconservationaps",
|
||||
"LogicalName": "pinswg_enforcementlistedbuildingandconservationappeals39",
|
||||
"PrimaryIdAttribute": "pinswg_enforcementlistedbuildingconservationapid",
|
||||
"MetadataId": "c697be96-9481-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_callinss77s",
|
||||
"LogicalName": "pinswg_callinss77",
|
||||
"PrimaryIdAttribute": "pinswg_callinss77id",
|
||||
"MetadataId": "dd309e51-4982-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_commonlands",
|
||||
"LogicalName": "pinswg_commonland",
|
||||
"PrimaryIdAttribute": "pinswg_commonlandid",
|
||||
"MetadataId": "4161a618-5082-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_advertses",
|
||||
"LogicalName": "pinswg_adverts",
|
||||
"PrimaryIdAttribute": "pinswg_advertsid",
|
||||
"MetadataId": "0735866b-5482-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_hedgeshedgerowstreepreservationreplacems",
|
||||
"LogicalName": "pinswg_hedgeshedgerowstreepreservationreplacem",
|
||||
"PrimaryIdAttribute": "pinswg_hedgeshedgerowstreepreservationreplacemid",
|
||||
"MetadataId": "60f38fed-5382-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_hedgeshedgerowstreepreservationreplacems",
|
||||
"LogicalName": "pinswg_highhedgestreepreservationordershedgerowstreereplacementnotice",
|
||||
"PrimaryIdAttribute": "pinswg_hedgeshedgerowstreepreservationreplacemid",
|
||||
"MetadataId": "60f38fed-5382-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_compulsorypurchaseorderses",
|
||||
"LogicalName": "pinswg_compulsorypurchaseorders",
|
||||
"PrimaryIdAttribute": "pinswg_compulsorypurchaseordersid",
|
||||
"MetadataId": "054da4c7-5582-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_communityinfrastructurelevys117118119s",
|
||||
"LogicalName": "pinswg_communityinfrastructurelevys117118119",
|
||||
"PrimaryIdAttribute": "pinswg_communityinfrastructurelevys117118119id",
|
||||
"MetadataId": "0c309f3c-4882-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_objectiveconfigs",
|
||||
"LogicalName": "pinswg_objectiveconfig",
|
||||
"PrimaryIdAttribute": "pinswg_objectiveconfigid",
|
||||
"MetadataId": "f89ae20c-4777-eb11-aabd-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_nonvalidations",
|
||||
"LogicalName": "pinswg_nonvalidation",
|
||||
"PrimaryIdAttribute": "pinswg_nonvalidationid",
|
||||
"MetadataId": "37f31a93-5882-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_rightofwayflows",
|
||||
"LogicalName": "pinswg_rightofwayflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "b26c1d43-efbe-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_caseinvolvements",
|
||||
"LogicalName": "pinswg_caseinvolvement",
|
||||
"PrimaryIdAttribute": "pinswg_caseinvolvementid",
|
||||
"MetadataId": "65677cd9-4aae-eb11-aac3-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_commonlandflows",
|
||||
"LogicalName": "pinswg_commonlandflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "338fac85-e6be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_lawfuldevelopmentcertificates195flows",
|
||||
"LogicalName": "pinswg_lawfuldevelopmentcertificates195flow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "0b8f5046-1dbe-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_advertisementappealanddiscontinuances",
|
||||
"LogicalName": "pinswg_advertisementappealanddiscontinuance",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "79b9ab3a-f1be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_documenthistories",
|
||||
"LogicalName": "pinswg_documenthistory",
|
||||
"PrimaryIdAttribute": "pinswg_documenthistoryid",
|
||||
"MetadataId": "0d8e78a7-33a3-eb11-aac3-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_documents",
|
||||
"LogicalName": "pinswg_document",
|
||||
"PrimaryIdAttribute": "pinswg_documentid",
|
||||
"MetadataId": "e6cbbbca-026a-eb11-aabb-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_electricityactflows",
|
||||
"LogicalName": "pinswg_electricityactflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "699c4318-e3be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_planningconditionss73s79flows",
|
||||
"LogicalName": "pinswg_planningconditionss73s79flow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "510154b1-15be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_wayleaves",
|
||||
"LogicalName": "pinswg_wayleave",
|
||||
"PrimaryIdAttribute": "pinswg_wayleaveid",
|
||||
"MetadataId": "a0652117-5782-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_listedbuildingandconservationareaconsens",
|
||||
"LogicalName": "pinswg_listedbuildingandconservationareaconsen",
|
||||
"PrimaryIdAttribute": "pinswg_listedbuildingandconservationareaconsenid",
|
||||
"MetadataId": "4cd95405-8f81-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_listedbuildingandconservationareaconsens",
|
||||
"LogicalName": "pinswg_listedbuildingandconservationareaconsents73s79",
|
||||
"PrimaryIdAttribute": "pinswg_listedbuildingandconservationareaconsenid",
|
||||
"MetadataId": "4cd95405-8f81-eb11-aac0-00224800be9c"
|
||||
},
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_callinapplicationss77flows",
|
||||
"LogicalName": "pinswg_callinapplicationss77flow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "2a4f3d43-d4be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_transfercodes",
|
||||
"LogicalName": "pinswg_transfercode",
|
||||
"PrimaryIdAttribute": "pinswg_transfercodeid",
|
||||
"MetadataId": "a551ad5c-29f5-eb11-aac7-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_compulsorypurchaseordersflows",
|
||||
"LogicalName": "pinswg_compulsorypurchaseordersflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "a94f098b-f0be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_environmentalpermittings",
|
||||
"LogicalName": "pinswg_environmentalpermitting",
|
||||
"PrimaryIdAttribute": "pinswg_environmentalpermittingid",
|
||||
"MetadataId": "62d4aa9a-5682-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_nonvaidationflows",
|
||||
"LogicalName": "pinswg_nonvaidationflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "e5ca3ceb-c1e0-eb11-aac5-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_enforcementnoticeappeals174s",
|
||||
"LogicalName": "pinswg_enforcementnoticeappeals174",
|
||||
"PrimaryIdAttribute": "pinswg_enforcementnoticeappeals174id",
|
||||
"MetadataId": "930a3cc4-9181-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_ldps",
|
||||
"LogicalName": "pinswg_ldp",
|
||||
"PrimaryIdAttribute": "pinswg_ldpid",
|
||||
"MetadataId": "af424d4d-5882-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_maintenanceoflands217s",
|
||||
"LogicalName": "pinswg_maintenanceoflands217",
|
||||
"PrimaryIdAttribute": "pinswg_maintenanceoflands217id",
|
||||
"MetadataId": "bb302784-9581-eb11-aac0-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_enforcelistbuild39flows",
|
||||
"LogicalName": "pinswg_enforcelistbuild39flow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "9423206e-d2be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_householderappealflows",
|
||||
"LogicalName": "pinswg_householderappealflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "330541bd-d5be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_miscellaneouscaseworkflows",
|
||||
"LogicalName": "pinswg_miscellaneouscaseworkflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "87db8649-f4be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_communityinfrastructurelevyflows",
|
||||
"LogicalName": "pinswg_communityinfrastructurelevyflow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "92bc1e3d-e0be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_listedbuildconserv20flows",
|
||||
"LogicalName": "pinswg_listedbuildconserv20flow",
|
||||
"PrimaryIdAttribute": "businessprocessflowinstanceid",
|
||||
"MetadataId": "4c11cbe9-27be-eb11-aac4-00224800be9c"
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_electricityacts",
|
||||
"LogicalName": "pinswg_electricityact",
|
||||
"PrimaryIdAttribute": "pinswg_electricityactid",
|
||||
"MetadataId": "6aedaab1-4a82-eb11-aac0-00224800be9c"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -72,6 +72,20 @@ export default async function ApiProxy(req, res) {
|
||||
|
||||
// console.log(SASToken);
|
||||
|
||||
var configNoData = {
|
||||
method: req.method,
|
||||
//url: WEBAPI_URL + updateFormCollection + "(" + incidentId + ")",
|
||||
url: WEBAPI_URL + req.url.split("/api/proxy/")[1],
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Authorization": SASToken,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
};
|
||||
|
||||
var config = {
|
||||
method: req.method,
|
||||
//url: WEBAPI_URL + updateFormCollection + "(" + incidentId + ")",
|
||||
@@ -87,17 +101,17 @@ export default async function ApiProxy(req, res) {
|
||||
data: data,
|
||||
};
|
||||
|
||||
console.log(config);
|
||||
console.log(req.url.split("/api/proxy/")[1]);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
// console.log(config);
|
||||
axios(config)
|
||||
axios(req.method == "GET" ? configNoData : config)
|
||||
.then((response) => {
|
||||
res.statusCode = 200;
|
||||
res.setHeader("Content-Type", "application/json");
|
||||
res.setHeader("Cache-Control", "max-age=1800000");
|
||||
res.end(JSON.stringify(response.data));
|
||||
console.log("response data", response.data);
|
||||
// console.log("response data", response.data);
|
||||
resolve();
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
Reference in New Issue
Block a user