updated coords and address fix
This commit is contained in:
@@ -75,7 +75,7 @@ export const getSelectQuery = (appealTypeName) => {
|
||||
break;
|
||||
case "pinswg_sipses":
|
||||
// return "&$select=pinswg_anticipatedgridreferenceeastingtext,pinswg_anticipatedgridreferencenorthingtext,_pinswg_appellant_value,pinswg_name,pinswg_addressline1,pinswg_addressline2,pinswg_postcode,pinswg_addresstown,_pinswg_associatedlpa_value,pinswg_addresscounty,pinswg_applicationacceptedasvalid,pinswg_applicationrejectedasinvalid,pinswg_choiceofprocedure,pinswg_confirmrequesttovaryapplication,pinswg_dateeventrequested,pinswg_dateofdecision,pinswg_dateofrequesttovarytheapplication,pinswg_dateofsubmissionofapplication,pinswg_dateprojectpublishedonwebsite,pinswg_deadlineforsubmissionofapplication,pinswg_decision,pinswg_endofrepresentationperiod,pinswg_inspectorreportsubmittedtowelshgovernment,pinswg_procedureconfirmed,pinswg_projectdescription,pinswg_projectlocation,pinswg_recommendation,pinswg_rejectrequesttovaryapplication,pinswg_reportdueby,pinswg_suspensiondates,pinswg_suspensionenddates,pinswg_suspensionstartdates,pinswg_validnoticeofintentiontosubmitanapplicati,pinswg_webaddress,pinswg_withdrawndate,pinswg_writtenacceptanceofnotification,statuscode,pinswg_casestage,_pinswg_dnsids_value,pinswg_startdateofevent,pinswg_typeofevent";
|
||||
return "&$select=pinswg_anticipatedgridreferenceeastingtext,pinswg_anticipatedgridreferencenorthingtext,_pinswg_appellant_value,pinswg_name,pinswg_addressline1,pinswg_addressline2,pinswg_postcode,pinswg_addresstown,_pinswg_associatedlpa_value,pinswg_addresscounty,pinswg_choiceofprocedure,pinswg_decision,pinswg_projectdescription,pinswg_projectlocation,pinswg_recommendation,pinswg_webaddress,statuscode,pinswg_casestage,_pinswg_sipscase_value,pinswg_writtenacceptanceofnotification,pinswg_validnoticeofintentiontosubmit,pinswg_deadlineforsubmissionofapplication,pinswg_screeningstartdate,pinswg_eiatargetdate,pinswg_targetextended,pinswg_directionissueddate,pinswg_eiarequired,pinswg_scopingstartdate,pinswg_scopingtargetdate,pinswg_scopingtargetextended,pinswg_scopingoutcomeissueddate";
|
||||
return "&$select=pinswg_anticipatedgridrefeasting,pinswg_anticipatedgridrefnorthing,_pinswg_appellant_value,pinswg_name,_pinswg_associatedlpa_value,pinswg_choiceofprocedure,pinswg_decision,pinswg_projectdescription,pinswg_projectlocation,pinswg_recommendation,statuscode,pinswg_casestage,_pinswg_sipscase_value,pinswg_writtenacceptanceofnotification,pinswg_validnoticeofintentiontosubmit,pinswg_deadlineforsubmissionofapplication,pinswg_screeningstartdate,pinswg_eiatargetdate,pinswg_targetextended,pinswg_directionissueddate,pinswg_eiarequired,pinswg_scopingstartdate,pinswg_scopingtargetdate,pinswg_scopingtargetextended,pinswg_scopingoutcomeissueddate";
|
||||
break;
|
||||
default:
|
||||
return "";
|
||||
|
||||
@@ -890,6 +890,7 @@ const DocumentDetails = (props) => {
|
||||
)
|
||||
// .then((data) => data)
|
||||
.then((data) => {
|
||||
setDocumentSearchState(true);
|
||||
setDocumentDetails(data);
|
||||
setShowSpinnerState(false);
|
||||
});
|
||||
|
||||
@@ -296,7 +296,9 @@ const CaseSummary = (props) => {
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{getFormCollectionByID(appealTypeID)
|
||||
.PrimaryIdAttribute == "pinswg_dnsid"
|
||||
.PrimaryIdAttribute == "pinswg_dnsid" ||
|
||||
getFormCollectionByID(appealTypeID)
|
||||
.PrimaryIdAttribute == "pinswg_sipscase"
|
||||
? detailsObj.pinswg_projectlocation !=
|
||||
null
|
||||
? detailsObj.pinswg_projectlocation.indexOf(
|
||||
|
||||
@@ -20,8 +20,8 @@ const Pinswg_sipscase = (props) => {
|
||||
let center = {};
|
||||
|
||||
point = new OSPoint(
|
||||
detailsObj.pinswg_anticipatedgridreferencenorthingtext,
|
||||
detailsObj.pinswg_anticipatedgridreferenceeastingtext
|
||||
detailsObj.pinswg_anticipatedgridrefnorthing,
|
||||
detailsObj.pinswg_anticipatedgridrefeasting
|
||||
);
|
||||
siteCoords = point.toOSGB36();
|
||||
//console.log(siteCoords);
|
||||
|
||||
@@ -64,8 +64,12 @@ const DNSSearchResults = (props) => {
|
||||
if (showMap == "true") {
|
||||
dnsCoords.map((item) => {
|
||||
let point = new OSPoint(
|
||||
item.pinswg_anticipatedgridreferencenorthingtext || 0,
|
||||
item.pinswg_anticipatedgridreferenceeastingtext || 0
|
||||
item.pinswg_anticipatedgridrefnorthing ||
|
||||
item.pinswg_anticipatedgridreferencenorthingtext ||
|
||||
0,
|
||||
item.pinswg_anticipatedgridrefeasting ||
|
||||
item.pinswg_anticipatedgridreferenceeastingtext ||
|
||||
0
|
||||
);
|
||||
let siteCoords = point.toOSGB36();
|
||||
//console.log(siteCoords);
|
||||
@@ -193,6 +197,15 @@ const DNSSearchResults = (props) => {
|
||||
});
|
||||
};
|
||||
|
||||
function hasValidKey(obj, key) {
|
||||
return (
|
||||
obj.hasOwnProperty(key) &&
|
||||
obj[key] !== null &&
|
||||
obj[key] !== undefined &&
|
||||
obj[key] !== ""
|
||||
);
|
||||
}
|
||||
|
||||
const ResultsView = (resultsArr) => {
|
||||
return (
|
||||
<div className="govuk-grid-row govuk-!-margin-top-9">
|
||||
@@ -394,7 +407,26 @@ const DNSSearchResults = (props) => {
|
||||
";"
|
||||
)[0]
|
||||
: ""
|
||||
: hasValidKey(
|
||||
item,
|
||||
"pinswg_caseaddress"
|
||||
)
|
||||
? item.pinswg_caseaddress !=
|
||||
null
|
||||
? item.pinswg_caseaddress.indexOf(
|
||||
";"
|
||||
) < 0
|
||||
? item.pinswg_caseaddress
|
||||
: router.locale == "cy"
|
||||
? item.pinswg_caseaddress.split(
|
||||
";"
|
||||
)[1]
|
||||
: item.pinswg_caseaddress.split(
|
||||
";"
|
||||
)[0]
|
||||
: ""
|
||||
: ""}
|
||||
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_siteaddressline1"
|
||||
|
||||
@@ -128,6 +128,15 @@ const SearchResults = (props) => {
|
||||
});
|
||||
};
|
||||
|
||||
function hasValidKey(obj, key) {
|
||||
return (
|
||||
obj.hasOwnProperty(key) &&
|
||||
obj[key] !== null &&
|
||||
obj[key] !== undefined &&
|
||||
obj[key] !== ""
|
||||
);
|
||||
}
|
||||
|
||||
const ResultsView = (resultsArr) => {
|
||||
return (
|
||||
<>
|
||||
@@ -337,6 +346,23 @@ const SearchResults = (props) => {
|
||||
";"
|
||||
)[0]
|
||||
: ""
|
||||
: hasValidKey(
|
||||
item,
|
||||
"pinswg_caseaddress"
|
||||
)
|
||||
? item.pinswg_caseaddress != null
|
||||
? item.pinswg_caseaddress.indexOf(
|
||||
";"
|
||||
) < 0
|
||||
? item.pinswg_caseaddress
|
||||
: router.locale == "cy"
|
||||
? item.pinswg_caseaddress.split(
|
||||
";"
|
||||
)[1]
|
||||
: item.pinswg_caseaddress.split(
|
||||
";"
|
||||
)[0]
|
||||
: ""
|
||||
: ""}
|
||||
{_.has(
|
||||
detailsObj,
|
||||
|
||||
@@ -82,7 +82,7 @@ export default async function ApiProxy(req, res) {
|
||||
//console.log(queryString);
|
||||
|
||||
var queryUrl =
|
||||
"incidents?$select=modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title,_primarycontactid_value,pinswg_lpareference,pinswg_appellantagent,pinswg_appellantfirstname,pinswg_appellantlastname&$expand=primarycontactid($select=fullname)&$filter=" +
|
||||
"incidents?$select=pinswg_caseaddress,modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title,_primarycontactid_value,pinswg_lpareference,pinswg_appellantagent,pinswg_appellantfirstname,pinswg_appellantlastname&$expand=primarycontactid($select=fullname)&$filter=" +
|
||||
queryString +
|
||||
" pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ export default async function ApiProxy(req, res) {
|
||||
: "";
|
||||
|
||||
var queryUrl =
|
||||
"incidents?$select=modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title,_primarycontactid_value,pinswg_lpareference,pinswg_appellantagent,pinswg_appellantfirstname,pinswg_appellantlastname&$expand=primarycontactid($select=fullname)&$filter=" +
|
||||
"incidents?$select=pinswg_caseaddress,modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title,_primarycontactid_value,pinswg_lpareference,pinswg_appellantagent,pinswg_appellantfirstname,pinswg_appellantlastname&$expand=primarycontactid($select=fullname)&$filter=" +
|
||||
queryString +
|
||||
" pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=" +
|
||||
orderby +
|
||||
|
||||
@@ -43,9 +43,9 @@ export default async function ApiProxy(req, res) {
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"incidents?$select=modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_lpareference&$expand=primarycontactid($select=fullname)&$filter=(pinswg_appealcasetype eq 846040011 or pinswg_appealcasetype eq 846040002)and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||
"incidents?$select=pinswg_caseaddress,modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_lpareference&$expand=primarycontactid($select=fullname)&$filter=(pinswg_appealcasetype eq 846040011 or pinswg_appealcasetype eq 846040002)and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||
|
||||
//console.log(queryUrl);
|
||||
console.log(queryUrl);
|
||||
|
||||
return axios
|
||||
.get(
|
||||
|
||||
@@ -78,7 +78,7 @@ export default async function ApiProxy(req, res) {
|
||||
var showNumberOfRecords = req.query.showNumberOfRecords;
|
||||
|
||||
var queryUrl =
|
||||
"incidents?$select=modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_lpareference&$expand=primarycontactid($select=fullname)&$filter=(pinswg_appealcasetype eq 846040011 or pinswg_appealcasetype eq 846040002) and pinswg_publishtoweb eq true&$orderby=" +
|
||||
"incidents?$select=pinswg_caseaddress,modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_lpareference&$expand=primarycontactid($select=fullname)&$filter=(pinswg_appealcasetype eq 846040011 or pinswg_appealcasetype eq 846040002) and pinswg_publishtoweb eq true&$orderby=" +
|
||||
orderby +
|
||||
" " +
|
||||
fieldSort +
|
||||
|
||||
@@ -45,7 +45,7 @@ export default async function ApiProxy(req, res) {
|
||||
searchString = searchString.replace(/\'/g, "''");
|
||||
|
||||
var queryUrl =
|
||||
"incidents?$select=modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_lpareference,pinswg_appellantagent,pinswg_appellantfirstname,pinswg_appellantlastname&$expand=primarycontactid($select=fullname)&$filter=(contains(title, '" +
|
||||
"incidents?$select=pinswg_caseaddress,modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_lpareference,pinswg_appellantagent,pinswg_appellantfirstname,pinswg_appellantlastname&$expand=primarycontactid($select=fullname)&$filter=(contains(title, '" +
|
||||
searchString +
|
||||
"') or contains(ticketnumber, '" +
|
||||
searchString +
|
||||
|
||||
@@ -1,508 +0,0 @@
|
||||
/**
|
||||
* @swagger
|
||||
* /api/endpoint/getbasicsearch_api:
|
||||
* get:
|
||||
* tags: [Search]
|
||||
* description: Basic search
|
||||
* parameters:
|
||||
* - name: searchString
|
||||
* in: query
|
||||
* required: true
|
||||
* schema:
|
||||
* type: string
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Success
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import {
|
||||
getToken,
|
||||
azureHeaders,
|
||||
consoleLogger,
|
||||
getIncidentbyID,
|
||||
} from "../../../actions";
|
||||
import { JSONPath as jsonpath } from "jsonpath-plus";
|
||||
import { object } from "prop-types";
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
const getIncident = async (incidentID) => {
|
||||
const queryUrl =
|
||||
process.env.API_ROOT +
|
||||
"/api/endpoint/getincidentbyid_api?searchString=" +
|
||||
incidentID;
|
||||
|
||||
var config = {
|
||||
method: "get",
|
||||
url: queryUrl,
|
||||
};
|
||||
|
||||
return axios(config)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
});
|
||||
};
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var addressline1 = req.query.addressline1 || "";
|
||||
var town = req.query.town || "";
|
||||
var postcode = req.query.postcode || "";
|
||||
var token = await getToken();
|
||||
|
||||
console.log("whats my parmas:", req.query);
|
||||
|
||||
addressline1 = addressline1.replace(/\'/g, "''");
|
||||
typeof town != "undefined" && (town = town.replace(/\'/g, "''"));
|
||||
|
||||
var searchResultsObj = [];
|
||||
|
||||
var appealTypeArray = [
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_advertses",
|
||||
"LogicalName": "pinswg_adverts",
|
||||
"PrimaryIdAttribute": "pinswg_advertsid",
|
||||
"UrlName": "adverts",
|
||||
"MetadataId": "0735866b-5482-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040018",
|
||||
"NavigationProperty": "pinswg_AdvertsIds",
|
||||
"value": "Adverts",
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_callinss77s",
|
||||
"LogicalName": "pinswg_callinss77",
|
||||
"PrimaryIdAttribute": "pinswg_callinss77id",
|
||||
"UrlName": "callinss77",
|
||||
"MetadataId": "dd309e51-4982-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040010",
|
||||
"NavigationProperty": "pinswg_CallInsS77Ids",
|
||||
"value": "Called In Applications - S77",
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_commonlands",
|
||||
"LogicalName": "pinswg_commonland",
|
||||
"PrimaryIdAttribute": "pinswg_commonlandid",
|
||||
"UrlName": "commonland",
|
||||
"MetadataId": "4161a618-5082-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040016",
|
||||
"NavigationProperty": "pinswg_CommonLandIds",
|
||||
"value": "Common Land",
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName":
|
||||
"pinswg_communityinfrastructurelevys117118119s",
|
||||
"LogicalName": "pinswg_communityinfrastructurelevys117118119",
|
||||
"PrimaryIdAttribute": "pinswg_communityinfrastructurelevyid",
|
||||
"UrlName": "communityinfrastructurelevys117118119",
|
||||
"MetadataId": "0c309f3c-4882-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040009",
|
||||
"NavigationProperty": "pinswg_CommunityInfrastructureLevyIds",
|
||||
"value": "Community Infrastructure Levy - S117, 118, & 119",
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_compulsorypurchaseorderses",
|
||||
"LogicalName": "pinswg_compulsorypurchaseorders",
|
||||
"PrimaryIdAttribute": "pinswg_compulsorypurchaseordersid",
|
||||
"UrlName": "compulsorypurchaseorders",
|
||||
"MetadataId": "054da4c7-5582-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040019",
|
||||
"NavigationProperty": "pinswg_CompulsoryPurchaseOrdersIds",
|
||||
"value": "Compulsory Purchase Orders",
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_dnses",
|
||||
"LogicalName": "pinswg_dns",
|
||||
"PrimaryIdAttribute": "pinswg_dnsid",
|
||||
"UrlName": "dns",
|
||||
"MetadataId": "36f07225-4a82-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040011",
|
||||
"NavigationProperty": "pinswg_DNSIds",
|
||||
"value": "Developments of National Significance",
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_electricityacts",
|
||||
"LogicalName": "pinswg_electricityact",
|
||||
"PrimaryIdAttribute": "pinswg_electricityactid",
|
||||
"UrlName": "electricityact",
|
||||
"MetadataId": "6aedaab1-4a82-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040012",
|
||||
"NavigationProperty": "pinswg_ElectricityActIds",
|
||||
"value": "Electricity Act",
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName":
|
||||
"pinswg_enforcementlistedbuildingconservationaps",
|
||||
"LogicalName":
|
||||
"pinswg_enforcementlistedbuildingandconservationappeals39",
|
||||
"PrimaryIdAttribute": "pinswg_enforcementlistedbuildingconseid",
|
||||
"UrlName": "enforcementlistedbuildingconservationap",
|
||||
"MetadataId": "c697be96-9481-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040006",
|
||||
"NavigationProperty": "pinswg_EnforcementListedBuildingConseIds",
|
||||
"value":
|
||||
"Enforcement Listed Building and Conservation Appeal - S39",
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_enforcementnoticeappeals174s",
|
||||
"LogicalName": "pinswg_enforcementnoticeappeals174",
|
||||
"PrimaryIdAttribute": "pinswg_enforcementnoticeappeals174id",
|
||||
"UrlName": "enforcementnoticeappeals174",
|
||||
"MetadataId": "930a3cc4-9181-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040005",
|
||||
"NavigationProperty": "pinswg_EnforcementNoticeAppealS174Ids",
|
||||
"value": "Enforcement Notice Appeal - S174",
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_environmentalpermittings",
|
||||
"LogicalName": "pinswg_environmentalpermitting",
|
||||
"PrimaryIdAttribute": "pinswg_enforcementpermittingid",
|
||||
"UrlName": "environmentalpermitting",
|
||||
"MetadataId": "62d4aa9a-5682-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040020",
|
||||
"NavigationProperty": "pinswg_EnforcementPermittingIds",
|
||||
"value": "Environmental Permitting",
|
||||
},
|
||||
// {
|
||||
// "LogicalCollectionName": "pinswg_harbourrevisionorders",
|
||||
// "LogicalName": "pinswg_harbourrevisionorder",
|
||||
// "PrimaryIdAttribute": "pinswg_harbourrevisionorderid",
|
||||
// "UrlName": "harbourrevisionorder",
|
||||
// "MetadataId": "dc8dcd0d-4f82-eb11-aac0-00224800be9c",
|
||||
// "appealTypeID": "846040014",
|
||||
// "NavigationProperty": "pinswg_HarbourRevisionOrderIds",
|
||||
// "value": "Harbour Revision Order",
|
||||
// },
|
||||
{
|
||||
"LogicalCollectionName":
|
||||
"pinswg_hedgeshedgerowstreepreservationreplacems",
|
||||
"LogicalName": "pinswg_hedgeshedgerowstreepreservationreplacem",
|
||||
"PrimaryIdAttribute": "pinswg_hedgeshedgerowstreepreservatioid",
|
||||
"UrlName": "hedgeshedgerowstreepreservationreplacem",
|
||||
"MetadataId": "60f38fed-5382-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040017",
|
||||
"NavigationProperty": "pinswg_HedgesHedgerowsTreePreservatioIds",
|
||||
"value":
|
||||
"High Hedges, Tree Preservation orders, Hedgerows, Tree Replacement Notice.",
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_householderappealhases",
|
||||
"LogicalName": "pinswg_householderappealhas",
|
||||
"PrimaryIdAttribute": "pinswg_householderappealhasid",
|
||||
"UrlName": "householderappealhas",
|
||||
"MetadataId": "a6c728b0-9081-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040004",
|
||||
"NavigationProperty": "pinswg_HouseholderAppealHASIds",
|
||||
"value": "Householder and Minor Commercial Appeals - HAS/CAS",
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_lawfuldevelopmentcertificates",
|
||||
"LogicalName": "pinswg_lawfuldevelopmentcertificateappeals194195",
|
||||
"PrimaryIdAttribute": "pinswg_lawfuldevelopmentcertificatappid",
|
||||
"UrlName": "lawfuldevelopmentcertificateappeals1941",
|
||||
"MetadataId": "184e4861-9681-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040008",
|
||||
"NavigationProperty": "pinswg_LawfulDevelopmentCertificatAppIds",
|
||||
"value": "Lawful Development Certificate Appeal - S194 + 195",
|
||||
},
|
||||
// {
|
||||
// "LogicalCollectionName": "pinswg_ldps",
|
||||
// "LogicalName": "pinswg_ldp",
|
||||
// "PrimaryIdAttribute": "pinswg_ldpid",
|
||||
// "UrlName": "ldp",
|
||||
// "MetadataId": "af424d4d-5882-eb11-aac0-00224800be9c",
|
||||
// "appealTypeID": "846040023",
|
||||
// "NavigationProperty": "pinswg_LDPIds",
|
||||
// },
|
||||
{
|
||||
"LogicalCollectionName":
|
||||
"pinswg_enforcementlistedbuildingconservationaps",
|
||||
"LogicalName": "pinswg_enforcementlistedbuildingandconservationap",
|
||||
"PrimaryIdAttribute": "pinswg_enforcementlistedbuildingconseid",
|
||||
"UrlName": "enforcementlistedbuildingconservationap",
|
||||
"MetadataId": "c697be96-9481-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040006",
|
||||
"NavigationProperty": "pinswg_EnforcementListedBuildingConseIds",
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_maintenanceoflands217s",
|
||||
"LogicalName": "pinswg_maintenanceoflands217",
|
||||
"PrimaryIdAttribute": "pinswg_maintenanceoflands217id",
|
||||
"UrlName": "maintenanceoflands217",
|
||||
"MetadataId": "bb302784-9581-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040007",
|
||||
"NavigationProperty": "pinswg_MaintenanceofLandS217Ids",
|
||||
"value": "Maintenance of Land - S217",
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_miscellaneouscaseworks",
|
||||
"LogicalName": "pinswg_misccasework",
|
||||
"PrimaryIdAttribute": "pinswg_miscellaneouscasewordid",
|
||||
"UrlName": "miscellaneouscasework",
|
||||
"MetadataId": "f519aa8e-5782-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040022",
|
||||
"NavigationProperty": "pinswg_MiscellaneousCasewordIds",
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_nonvalidations",
|
||||
"LogicalName": "pinswg_nonvalidation",
|
||||
"PrimaryIdAttribute": "pinswg_nonvalidationid",
|
||||
"UrlName": "nonvalidation",
|
||||
"MetadataId": "37f31a93-5882-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040024",
|
||||
"NavigationProperty": "pinswg_NonValidationIds",
|
||||
"value": "Non-Validation",
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_planningappeals78s",
|
||||
"LogicalName": "pinswg_planningappeals78",
|
||||
"PrimaryIdAttribute": "pinswg_planningappeals78id",
|
||||
"UrlName": "planningappeals78",
|
||||
"MetadataId": "8d7f813a-4183-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040000",
|
||||
"NavigationProperty": "pinswg_PlanningAppealS78Ids",
|
||||
"value": "Planning Appeal - S78",
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_planningconditionss73s79s",
|
||||
"LogicalName": "pinswg_planningconditionss73s79",
|
||||
"PrimaryIdAttribute": "pinswg_planningconditionss73s79id",
|
||||
"UrlName": "planningconditionss73s79",
|
||||
"MetadataId": "093bf9ff-8d81-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040001",
|
||||
"NavigationProperty": "pinswg_PlanningConditionsS73S79Ids",
|
||||
"value": "Planning Conditions - S73 + S79",
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_planningobligationappeals106s",
|
||||
"LogicalName": "pinswg_planningobligationappeals106",
|
||||
"PrimaryIdAttribute": "pinswg_planningobligationappeals106id",
|
||||
"UrlName": "planningobligationappeals106",
|
||||
"MetadataId": "cb8beeae-8f81-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040003",
|
||||
"NavigationProperty": "pinswg_PlanningObligationAppealS106Ids",
|
||||
"value": "Planning Obligation Appeal - S106",
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_rows",
|
||||
"LogicalName": "pinswg_row",
|
||||
"PrimaryIdAttribute": "pinswg_rowid",
|
||||
"UrlName": "row",
|
||||
"MetadataId": "4ccc6e93-4f82-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040015",
|
||||
"NavigationProperty": "pinswg_ROWIds",
|
||||
"value": "Rights of Way",
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_transportandworkacts",
|
||||
"LogicalName": "pinswg_transportandworksact",
|
||||
"PrimaryIdAttribute": "pinswg_transportandworkactid",
|
||||
"UrlName": "transportandworksact",
|
||||
"MetadataId": "bc3edc4b-7d82-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040013",
|
||||
"NavigationProperty": "pinswg_TransportandWorkActIds",
|
||||
"value": "Transport and Works Act",
|
||||
},
|
||||
{
|
||||
"LogicalCollectionName": "pinswg_wayleaves",
|
||||
"LogicalName": "pinswg_wayleave",
|
||||
"PrimaryIdAttribute": "pinswg_wayleaveid",
|
||||
"UrlName": "wayleave",
|
||||
"MetadataId": "a0652117-5782-eb11-aac0-00224800be9c",
|
||||
"appealTypeID": "846040021",
|
||||
"NavigationProperty": "pinswg_WayleaveIds",
|
||||
"value": "Wayleave",
|
||||
},
|
||||
];
|
||||
|
||||
const getSearchResultsObj = await Promise.all(
|
||||
appealTypeArray.map(async (item) => {
|
||||
let container = {};
|
||||
|
||||
var queryUrl =
|
||||
item.LogicalCollectionName +
|
||||
"?$count=true&$filter=" +
|
||||
(addressline1 != ""
|
||||
? "(contains(" +
|
||||
(item.LogicalCollectionName == "pinswg_ldps" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_harbourrevisionorders" ||
|
||||
item.LogicalCollectionName == "pinswg_electricityacts" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_transportandworkacts" ||
|
||||
item.LogicalCollectionName == "pinswg_dnses"
|
||||
? "pinswg_addressline1"
|
||||
: "pinswg_siteaddressline1") +
|
||||
", '" +
|
||||
addressline1 +
|
||||
"')) "
|
||||
: "") +
|
||||
(town != ""
|
||||
? (addressline1 != "" ? " and " : "") +
|
||||
" (contains(" +
|
||||
(item.LogicalCollectionName == "pinswg_ldps" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_harbourrevisionorders"
|
||||
? "pinswg_town"
|
||||
: item.LogicalCollectionName ==
|
||||
"pinswg_transportandworkacts" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_electricityacts" ||
|
||||
item.LogicalCollectionName == "pinswg_dnses"
|
||||
? "pinswg_addresstown"
|
||||
: "pinswg_siteaddresstown") +
|
||||
", '" +
|
||||
town +
|
||||
"')) "
|
||||
: "") +
|
||||
(postcode != ""
|
||||
? (addressline1 != "" || town != "" ? " and " : "") +
|
||||
" (contains(" +
|
||||
(item.LogicalCollectionName == "pinswg_ldps" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_harbourrevisionorders"
|
||||
? "pinswg_postcode"
|
||||
: item.LogicalCollectionName ==
|
||||
"pinswg_transportandworkacts" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_electricityacts" ||
|
||||
item.LogicalCollectionName == "pinswg_dnses"
|
||||
? "pinswg_postcode"
|
||||
: "pinswg_siteaddresspostcode") +
|
||||
", '" +
|
||||
postcode +
|
||||
"')) "
|
||||
: "") +
|
||||
"&$orderby=createdon desc&$select=ticketnumber,modifiedon,_pinswg_appellant_value,pinswg_name," +
|
||||
(item.LogicalCollectionName == "pinswg_ldps" ||
|
||||
item.LogicalCollectionName == "pinswg_harbourrevisionorders"
|
||||
? "pinswg_addresstown,pinswg_addressline1,pinswg_addresscounty,pinswg_addressline2,pinswg_addresspostcode"
|
||||
: item.LogicalCollectionName == "pinswg_electricityacts" ||
|
||||
item.LogicalCollectionName == "pinswg_dnses" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_transportandworkacts"
|
||||
? "pinswg_addresstown,pinswg_addressline1,pinswg_addresscounty,pinswg_addressline2,pinswg_postcode"
|
||||
: item.LogicalCollectionName == "pinswg_rows"
|
||||
? "pinswg_siteaddresstown,pinswg_siteaddressline1,pinswg_sitecounty,pinswg_siteaddressline2,pinswg_siteaddresspostcode"
|
||||
: "pinswg_siteaddresstown,pinswg_siteaddressline1,pinswg_siteaddresscounty,pinswg_siteaddressline2,pinswg_siteaddresspostcode") +
|
||||
"," +
|
||||
(item.LogicalCollectionName == "pinswg_dnses" ||
|
||||
item.LogicalCollectionName == "pinswg_transportandworkacts"
|
||||
? "pinswg_dateofdecision"
|
||||
: item.LogicalCollectionName == "pinswg_nonvalidations"
|
||||
? "pinswg_decisionissueddate"
|
||||
: item.LogicalCollectionName == "pinswg_electricityacts"
|
||||
? "pinswg_datedecision"
|
||||
: "pinswg_casedecisiondate") +
|
||||
"," +
|
||||
(item.LogicalCollectionName == "pinswg_planningappeals78s"
|
||||
? "pinswg_dicision"
|
||||
: item.LogicalCollectionName ==
|
||||
"pinswg_transportandworkacts"
|
||||
? "pinswg_decsision"
|
||||
: item.LogicalCollectionName == "pinswg_nonvalidations"
|
||||
? "pinswg_decisionissued"
|
||||
: "pinswg_decision") +
|
||||
"," +
|
||||
(item.LogicalCollectionName == "pinswg_nonvalidations"
|
||||
? ""
|
||||
: "pinswg_dateeventrequested,") +
|
||||
"statuscode,_" +
|
||||
item.NavigationProperty.toLowerCase() +
|
||||
"_value";
|
||||
|
||||
//console.log(
|
||||
// "\n==========================================\n",
|
||||
// "basic search: " + queryUrl,
|
||||
// "\n\n",
|
||||
// item.LogicalCollectionName,
|
||||
// "\n\n",
|
||||
// WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
// "\n==========================================\n"
|
||||
// );
|
||||
|
||||
const resultObj = axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
data.value.map(async (key) => {
|
||||
Object.assign(key, {
|
||||
"pinswg_appealType": item.value,
|
||||
"incidentid":
|
||||
key[
|
||||
"_" +
|
||||
item.NavigationProperty.toLowerCase() +
|
||||
"_value"
|
||||
],
|
||||
});
|
||||
});
|
||||
return searchResultsObj.push(data);
|
||||
})
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
res.status(400).json(error);
|
||||
});
|
||||
|
||||
return resultObj;
|
||||
})
|
||||
);
|
||||
|
||||
searchResultsObj = jsonpath("$..[?(@ && @.pinswg_name)]", searchResultsObj);
|
||||
|
||||
const getIncidentResultsObj = await Promise.all(
|
||||
searchResultsObj.map(async (key) => {
|
||||
var queryUrl =
|
||||
"incidents?$select=pinswg_publishtoweb,modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_lpareference,pinswg_appellantagent,pinswg_appellantfirstname,pinswg_appellantlastname&$expand=primarycontactid($select=fullname)&$filter=incidentid eq " +
|
||||
key.incidentid +
|
||||
" and pinswg_appealcasetype ne null &$orderby=createdon desc&$count=true";
|
||||
|
||||
const incidentObj = await axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
return data.value[0].pinswg_publishtoweb;
|
||||
});
|
||||
Object.assign(key, {
|
||||
"pinswg_publishtoweb": incidentObj,
|
||||
});
|
||||
|
||||
return incidentObj;
|
||||
})
|
||||
);
|
||||
|
||||
searchResultsObj = searchResultsObj.filter(
|
||||
(arr) => arr.pinswg_publishtoweb
|
||||
);
|
||||
|
||||
let searchResultsOutputObj = {};
|
||||
Object.assign(searchResultsOutputObj, {
|
||||
"@odata.count": searchResultsObj.length,
|
||||
"value": searchResultsObj,
|
||||
});
|
||||
|
||||
return res.status(200).json(searchResultsOutputObj);
|
||||
}
|
||||
@@ -347,214 +347,255 @@ export default async function ApiProxy(req, res) {
|
||||
let container = {};
|
||||
|
||||
var queryUrl =
|
||||
item.LogicalCollectionName +
|
||||
"?$count=true&$filter=" +
|
||||
(addressline1 != ""
|
||||
? "(contains(" +
|
||||
(item.LogicalCollectionName == "pinswg_ldps" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_harbourrevisionorders" ||
|
||||
item.LogicalCollectionName == "pinswg_electricityacts" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_transportandworkacts" ||
|
||||
item.LogicalCollectionName == "pinswg_dnses" ||
|
||||
item.LogicalCollectionName == "pinswg_sipses"
|
||||
? "pinswg_addressline1"
|
||||
: "pinswg_siteaddressline1") +
|
||||
", '" +
|
||||
addressline1 +
|
||||
"')) "
|
||||
: "") +
|
||||
(town != ""
|
||||
? (addressline1 != "" ? " and " : "") +
|
||||
" (contains(" +
|
||||
(item.LogicalCollectionName == "pinswg_ldps" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_harbourrevisionorders"
|
||||
? "pinswg_town"
|
||||
: item.LogicalCollectionName ==
|
||||
"pinswg_transportandworkacts" ||
|
||||
item.LogicalCollectionName == "pinswg_sipses"
|
||||
? item.LogicalCollectionName +
|
||||
"?$count=true&$filter=" +
|
||||
(addressline1 != ""
|
||||
? "(contains(pinswg_projectlocation,'" +
|
||||
addressline1 +
|
||||
"')) "
|
||||
: "") +
|
||||
(town != ""
|
||||
? "(contains(pinswg_projectlocation,'" + town + "')) "
|
||||
: "") +
|
||||
(county != ""
|
||||
? "(contains(pinswg_projectlocation,'" +
|
||||
county +
|
||||
"')) "
|
||||
: "") +
|
||||
(postcode != ""
|
||||
? "(contains(pinswg_projectlocation,'" +
|
||||
postcode +
|
||||
"')) "
|
||||
: "") +
|
||||
"&$orderby=createdon desc&$select=modifiedon,_pinswg_appellant_value,pinswg_name,_pinswg_sipscase_value,pinswg_projectlocation,_pinswg_associatedlpa_value,statuscode,pinswg_validnoticeofintentiontosubmit,pinswg_decision"
|
||||
: item.LogicalCollectionName +
|
||||
"?$count=true&$filter=" +
|
||||
(addressline1 != ""
|
||||
? "(contains(" +
|
||||
(item.LogicalCollectionName == "pinswg_ldps" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_harbourrevisionorders" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_electricityacts" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_transportandworkacts" ||
|
||||
item.LogicalCollectionName == "pinswg_dnses" ||
|
||||
item.LogicalCollectionName == "pinswg_sipses"
|
||||
? "pinswg_addresstown"
|
||||
: "pinswg_siteaddresstown") +
|
||||
", '" +
|
||||
town +
|
||||
"')) "
|
||||
: "") +
|
||||
(county != ""
|
||||
? (addressline1 != "" || town != "" || postcode != ""
|
||||
? " and "
|
||||
? "pinswg_addressline1"
|
||||
: "pinswg_siteaddressline1") +
|
||||
", '" +
|
||||
addressline1 +
|
||||
"')) "
|
||||
: "") +
|
||||
" (contains(" +
|
||||
(item.LogicalCollectionName == "pinswg_ldps" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_harbourrevisionorders"
|
||||
? "pinswg_county"
|
||||
: item.LogicalCollectionName ==
|
||||
"pinswg_transportandworkacts" ||
|
||||
(town != ""
|
||||
? (addressline1 != "" ? " and " : "") +
|
||||
" (contains(" +
|
||||
(item.LogicalCollectionName == "pinswg_ldps" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_electricityacts" ||
|
||||
item.LogicalCollectionName == "pinswg_dnses" ||
|
||||
item.LogicalCollectionName == "pinswg_sipses"
|
||||
? "pinswg_addresscounty"
|
||||
: item.LogicalCollectionName == "pinswg_rows"
|
||||
? "pinswg_sitecounty"
|
||||
: "pinswg_siteaddresscounty") +
|
||||
", '" +
|
||||
county +
|
||||
"')) "
|
||||
: "") +
|
||||
(postcode != ""
|
||||
? (addressline1 != "" || town != "" || county != ""
|
||||
? " and "
|
||||
"pinswg_harbourrevisionorders"
|
||||
? "pinswg_town"
|
||||
: item.LogicalCollectionName ==
|
||||
"pinswg_transportandworkacts" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_electricityacts" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_dnses" ||
|
||||
item.LogicalCollectionName == "pinswg_sipses"
|
||||
? "pinswg_addresstown"
|
||||
: "pinswg_siteaddresstown") +
|
||||
", '" +
|
||||
town +
|
||||
"')) "
|
||||
: "") +
|
||||
" (contains(" +
|
||||
(item.LogicalCollectionName == "pinswg_ldps" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_harbourrevisionorders"
|
||||
? "pinswg_postcode"
|
||||
: item.LogicalCollectionName ==
|
||||
"pinswg_transportandworkacts" ||
|
||||
(county != ""
|
||||
? (addressline1 != "" || town != "" || postcode != ""
|
||||
? " and "
|
||||
: "") +
|
||||
" (contains(" +
|
||||
(item.LogicalCollectionName == "pinswg_ldps" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_electricityacts" ||
|
||||
item.LogicalCollectionName == "pinswg_dnses"
|
||||
? "pinswg_postcode"
|
||||
: "pinswg_siteaddresspostcode") +
|
||||
", '" +
|
||||
postcode +
|
||||
"')) "
|
||||
: "") +
|
||||
"&$orderby=createdon desc&$select=modifiedon,_pinswg_appellant_value,pinswg_name," +
|
||||
(item.LogicalCollectionName == "pinswg_planningappeals78s" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_lawfuldevelopmentcertificates" ||
|
||||
item.LogicalCollectionName == "pinswg_householderappealhases" ||
|
||||
item.LogicalCollectionName == "pinswg_advertses" ||
|
||||
item.LogicalCollectionName == "pinswg_callinss77s" ||
|
||||
item.LogicalCollectionName == "pinswg_commonlands" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_communityinfrastructurelevys117118119s" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_compulsorypurchaseorderses" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_enforcementnoticeappeals174s" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_environmentalpermittings" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_hedgeshedgerowstreepreservationreplacems" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_lawfuldevelopmentcertificates" ||
|
||||
item.LogicalCollectionName == "pinswg_miscellaneouscaseworks" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_planningconditionss73s79s" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_planningobligationappeals106s" ||
|
||||
item.LogicalCollectionName == "pinswg_rows" ||
|
||||
item.LogicalCollectionName == "pinswg_wayleaves"
|
||||
? "pinswg_startdate,pinswg_finalcommentsduedate,"
|
||||
: "") +
|
||||
(item.LogicalCollectionName ==
|
||||
"pinswg_enforcementlistedbuildingconservationaps" ||
|
||||
item.LogicalCollectionName == "pinswg_maintenanceoflands217s"
|
||||
? "pinswg_startdates,pinswg_finalcommentsduedate,"
|
||||
: "") +
|
||||
(item.LogicalCollectionName == "pinswg_nonvalidations"
|
||||
? "pinswg_validdate,"
|
||||
: "") +
|
||||
(item.LogicalCollectionName == "pinswg_electricityacts" ||
|
||||
item.LogicalCollectionName == "pinswg_dnses" ||
|
||||
item.LogicalCollectionName == "pinswg_transportandworkacts"
|
||||
? "pinswg_applicationacceptedasvalid,pinswg_endofrepresentationperiod,"
|
||||
: "") +
|
||||
(item.LogicalCollectionName == "pinswg_ldps" ||
|
||||
item.LogicalCollectionName == "pinswg_harbourrevisionorders"
|
||||
? "pinswg_addresstown,pinswg_addressline1,pinswg_addresscounty,pinswg_addressline2,pinswg_addresspostcode"
|
||||
: item.LogicalCollectionName == "pinswg_electricityacts" ||
|
||||
"pinswg_harbourrevisionorders"
|
||||
? "pinswg_county"
|
||||
: item.LogicalCollectionName ==
|
||||
"pinswg_transportandworkacts" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_electricityacts" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_dnses" ||
|
||||
item.LogicalCollectionName == "pinswg_sipses"
|
||||
? "pinswg_addresscounty"
|
||||
: item.LogicalCollectionName == "pinswg_rows"
|
||||
? "pinswg_sitecounty"
|
||||
: "pinswg_siteaddresscounty") +
|
||||
", '" +
|
||||
county +
|
||||
"')) "
|
||||
: "") +
|
||||
(postcode != ""
|
||||
? (addressline1 != "" || town != "" || county != ""
|
||||
? " and "
|
||||
: "") +
|
||||
" (contains(" +
|
||||
(item.LogicalCollectionName == "pinswg_ldps" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_harbourrevisionorders"
|
||||
? "pinswg_postcode"
|
||||
: item.LogicalCollectionName ==
|
||||
"pinswg_transportandworkacts" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_electricityacts" ||
|
||||
item.LogicalCollectionName == "pinswg_dnses"
|
||||
? "pinswg_postcode"
|
||||
: "pinswg_siteaddresspostcode") +
|
||||
", '" +
|
||||
postcode +
|
||||
"')) "
|
||||
: "") +
|
||||
"&$orderby=createdon desc&$select=modifiedon,_pinswg_appellant_value,pinswg_name," +
|
||||
(item.LogicalCollectionName ==
|
||||
"pinswg_planningappeals78s" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_lawfuldevelopmentcertificates" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_householderappealhases" ||
|
||||
item.LogicalCollectionName == "pinswg_advertses" ||
|
||||
item.LogicalCollectionName == "pinswg_callinss77s" ||
|
||||
item.LogicalCollectionName == "pinswg_commonlands" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_communityinfrastructurelevys117118119s" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_compulsorypurchaseorderses" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_enforcementnoticeappeals174s" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_environmentalpermittings" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_hedgeshedgerowstreepreservationreplacems" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_lawfuldevelopmentcertificates" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_miscellaneouscaseworks" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_planningconditionss73s79s" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_planningobligationappeals106s" ||
|
||||
item.LogicalCollectionName == "pinswg_rows" ||
|
||||
item.LogicalCollectionName == "pinswg_wayleaves"
|
||||
? "pinswg_startdate,pinswg_finalcommentsduedate,"
|
||||
: "") +
|
||||
(item.LogicalCollectionName ==
|
||||
"pinswg_enforcementlistedbuildingconservationaps" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_maintenanceoflands217s"
|
||||
? "pinswg_startdates,pinswg_finalcommentsduedate,"
|
||||
: "") +
|
||||
(item.LogicalCollectionName == "pinswg_nonvalidations"
|
||||
? "pinswg_validdate,"
|
||||
: "") +
|
||||
(item.LogicalCollectionName == "pinswg_electricityacts" ||
|
||||
item.LogicalCollectionName == "pinswg_dnses" ||
|
||||
item.LogicalCollectionName == "pinswg_sipses" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_transportandworkacts"
|
||||
? "pinswg_addresstown,pinswg_addressline1,pinswg_addresscounty,pinswg_addressline2,pinswg_postcode"
|
||||
: item.LogicalCollectionName == "pinswg_rows"
|
||||
? "pinswg_siteaddresstown,pinswg_siteaddressline1,pinswg_sitecounty,pinswg_siteaddressline2,pinswg_siteaddresspostcode"
|
||||
: "pinswg_siteaddresstown,pinswg_siteaddressline1,pinswg_siteaddresscounty,pinswg_siteaddressline2,pinswg_siteaddresspostcode") +
|
||||
"," +
|
||||
(item.LogicalCollectionName == "pinswg_dnses" ||
|
||||
item.LogicalCollectionName == "pinswg_transportandworkacts"
|
||||
? "pinswg_dateofdecision,"
|
||||
: item.LogicalCollectionName == "pinswg_nonvalidations"
|
||||
? "pinswg_decisionissueddate,"
|
||||
: item.LogicalCollectionName == "pinswg_electricityacts"
|
||||
? "pinswg_datedecision,"
|
||||
: item.LogicalCollectionName == "pinswg_sipses"
|
||||
? ""
|
||||
: "pinswg_casedecisiondate,") +
|
||||
(item.LogicalCollectionName == "pinswg_planningappeals78s"
|
||||
? "pinswg_dicision"
|
||||
: item.LogicalCollectionName ==
|
||||
"pinswg_transportandworkacts"
|
||||
? "pinswg_decsision"
|
||||
: item.LogicalCollectionName == "pinswg_nonvalidations"
|
||||
? "pinswg_decisionissued"
|
||||
: "pinswg_decision") +
|
||||
"," +
|
||||
(item.LogicalCollectionName == "pinswg_nonvalidations" ||
|
||||
item.LogicalCollectionName == "pinswg_sipses"
|
||||
? ""
|
||||
: "pinswg_dateeventrequested,") +
|
||||
"statuscode" +
|
||||
(item.LogicalCollectionName == "pinswg_sipses"
|
||||
? ""
|
||||
: ",_" + item.NavigationProperty.toLowerCase() + "_value") +
|
||||
(item.LogicalCollectionName == "pinswg_planningappeals78s"
|
||||
? ",_pinswg_localplanningauthority_value"
|
||||
: "") +
|
||||
(item.LogicalCollectionName ==
|
||||
"pinswg_compulsorypurchaseorderses" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_enforcementnoticeappeals174s" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_planningconditionss73s79s" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_planningobligationappeals106s" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_hedgeshedgerowstreepreservationreplacems" ||
|
||||
item.LogicalCollectionName == "pinswg_householderappealhases" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_lawfuldevelopmentcertificates" ||
|
||||
item.LogicalCollectionName == "pinswg_adverts" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_communityinfrastructurelevys117118119s" ||
|
||||
item.LogicalCollectionName == "pinswg_callinss77s" ||
|
||||
item.LogicalCollectionName == "pinswg_wayleaves" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_environmentalpermittings" ||
|
||||
item.LogicalCollectionName == "pinswg_miscellaneouscaseworks" ||
|
||||
item.LogicalCollectionName == "pinswg_commonlands" ||
|
||||
item.LogicalCollectionName == "pinswg_rows" ||
|
||||
item.LogicalCollectionName == "pinswg_maintenanceoflands217s" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_enforcementlistedbuildingconservationaps" ||
|
||||
item.LogicalCollectionName == "pinswg_dnses" ||
|
||||
item.LogicalCollectionName == "pinswg_sipses"
|
||||
? ",_pinswg_associatedlpa_value"
|
||||
: "") +
|
||||
(item.LogicalCollectionName == "pinswg_sipses"
|
||||
? ",_pinswg_sipscase_value"
|
||||
: ",_" + item.PrimaryIdAttribute + "s_value");
|
||||
? "pinswg_applicationacceptedasvalid,pinswg_endofrepresentationperiod,"
|
||||
: "") +
|
||||
(item.LogicalCollectionName == "pinswg_ldps" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_harbourrevisionorders"
|
||||
? "pinswg_addresstown,pinswg_addressline1,pinswg_addresscounty,pinswg_addressline2,pinswg_addresspostcode"
|
||||
: item.LogicalCollectionName ==
|
||||
"pinswg_electricityacts" ||
|
||||
item.LogicalCollectionName == "pinswg_dnses" ||
|
||||
item.LogicalCollectionName == "pinswg_sipses" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_transportandworkacts"
|
||||
? "pinswg_addresstown,pinswg_addressline1,pinswg_addresscounty,pinswg_addressline2,pinswg_postcode"
|
||||
: item.LogicalCollectionName == "pinswg_rows"
|
||||
? "pinswg_siteaddresstown,pinswg_siteaddressline1,pinswg_sitecounty,pinswg_siteaddressline2,pinswg_siteaddresspostcode"
|
||||
: "pinswg_siteaddresstown,pinswg_siteaddressline1,pinswg_siteaddresscounty,pinswg_siteaddressline2,pinswg_siteaddresspostcode") +
|
||||
"," +
|
||||
(item.LogicalCollectionName == "pinswg_dnses" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_transportandworkacts"
|
||||
? "pinswg_dateofdecision,"
|
||||
: item.LogicalCollectionName ==
|
||||
"pinswg_nonvalidations"
|
||||
? "pinswg_decisionissueddate,"
|
||||
: item.LogicalCollectionName ==
|
||||
"pinswg_electricityacts"
|
||||
? "pinswg_datedecision,"
|
||||
: item.LogicalCollectionName == "pinswg_sipses"
|
||||
? ""
|
||||
: "pinswg_casedecisiondate,") +
|
||||
(item.LogicalCollectionName == "pinswg_planningappeals78s"
|
||||
? "pinswg_dicision"
|
||||
: item.LogicalCollectionName ==
|
||||
"pinswg_transportandworkacts"
|
||||
? "pinswg_decsision"
|
||||
: item.LogicalCollectionName ==
|
||||
"pinswg_nonvalidations"
|
||||
? "pinswg_decisionissued"
|
||||
: "pinswg_decision") +
|
||||
"," +
|
||||
(item.LogicalCollectionName == "pinswg_nonvalidations" ||
|
||||
item.LogicalCollectionName == "pinswg_sipses"
|
||||
? ""
|
||||
: "pinswg_dateeventrequested,") +
|
||||
"statuscode" +
|
||||
(item.LogicalCollectionName == "pinswg_sipses"
|
||||
? ""
|
||||
: ",_" +
|
||||
item.NavigationProperty.toLowerCase() +
|
||||
"_value") +
|
||||
(item.LogicalCollectionName == "pinswg_planningappeals78s"
|
||||
? ",_pinswg_localplanningauthority_value"
|
||||
: "") +
|
||||
(item.LogicalCollectionName ==
|
||||
"pinswg_compulsorypurchaseorderses" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_enforcementnoticeappeals174s" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_planningconditionss73s79s" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_planningobligationappeals106s" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_hedgeshedgerowstreepreservationreplacems" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_householderappealhases" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_lawfuldevelopmentcertificates" ||
|
||||
item.LogicalCollectionName == "pinswg_adverts" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_communityinfrastructurelevys117118119s" ||
|
||||
item.LogicalCollectionName == "pinswg_callinss77s" ||
|
||||
item.LogicalCollectionName == "pinswg_wayleaves" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_environmentalpermittings" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_miscellaneouscaseworks" ||
|
||||
item.LogicalCollectionName == "pinswg_commonlands" ||
|
||||
item.LogicalCollectionName == "pinswg_rows" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_maintenanceoflands217s" ||
|
||||
item.LogicalCollectionName ==
|
||||
"pinswg_enforcementlistedbuildingconservationaps" ||
|
||||
item.LogicalCollectionName == "pinswg_dnses" ||
|
||||
item.LogicalCollectionName == "pinswg_sipses"
|
||||
? ",_pinswg_associatedlpa_value"
|
||||
: "") +
|
||||
(item.LogicalCollectionName == "pinswg_sipses"
|
||||
? ",_pinswg_sipscase_value"
|
||||
: ",_" + item.PrimaryIdAttribute + "s_value");
|
||||
|
||||
// console.log(
|
||||
// "\n==========================================\n",
|
||||
// "basic search: " + queryUrl,
|
||||
// "\n\n",
|
||||
// item.LogicalCollectionName,
|
||||
// "\n\n",
|
||||
// WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
// "\n==========================================\n"
|
||||
// );
|
||||
console.log(
|
||||
"\n==========================================\n",
|
||||
"basic search: " + queryUrl,
|
||||
"\n\n",
|
||||
item.LogicalCollectionName,
|
||||
"\n\n",
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
"\n==========================================\n"
|
||||
);
|
||||
|
||||
const resultObj = axios
|
||||
.get(
|
||||
|
||||
@@ -79,7 +79,7 @@ export default async function ApiProxy(req, res) {
|
||||
searchString = searchString.replace(/\'/g, "''");
|
||||
|
||||
var queryUrl =
|
||||
"incidents?$select=modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_lpareference,pinswg_appellantagent,pinswg_appellantfirstname,pinswg_appellantlastname&$expand=primarycontactid($select=fullname)&$filter=(contains(title, '" +
|
||||
"incidents?$select=pinswg_caseaddress,modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_lpareference,pinswg_appellantagent,pinswg_appellantfirstname,pinswg_appellantlastname&$expand=primarycontactid($select=fullname)&$filter=(contains(title, '" +
|
||||
searchString +
|
||||
"') or contains(ticketnumber, '" +
|
||||
searchString +
|
||||
|
||||
@@ -27,17 +27,43 @@ export default async function ApiProxy(req, res) {
|
||||
"pinswg_dnses?$select=pinswg_name,pinswg_anticipatedgridreferenceeastingtext,pinswg_anticipatedgridreferencenorthingtext,pinswg_projectname,pinswg_dnsid,_pinswg_associatedlpa_value,_pinswg_appellant_value&$filter=pinswg_anticipatedgridreferencenorthingtext ne null and pinswg_anticipatedgridreferenceeastingtext ne null&$count=true";
|
||||
|
||||
//console.log("dns ", queryUrl);
|
||||
var queryUrlSips =
|
||||
"pinswg_sipses?$select=pinswg_name,pinswg_anticipatedgridrefeasting,pinswg_anticipatedgridrefnorthing,pinswg_projectname,pinswg_sipscase,_pinswg_associatedlpa_value,_pinswg_appellant_value&$filter=pinswg_anticipatedgridrefeasting ne null and pinswg_anticipatedgridrefnorthing ne null&$count=true";
|
||||
|
||||
return axios
|
||||
.get(
|
||||
var coordsObj = { value: [] };
|
||||
|
||||
try {
|
||||
// First Axios request
|
||||
const dnsCoordsObj = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
res.status(400).json(error);
|
||||
});
|
||||
);
|
||||
// Merge the first response's 'value' array into the coordsObj's value array
|
||||
if (Array.isArray(dnsCoordsObj.data.value)) {
|
||||
coordsObj.value = coordsObj.value.concat(dnsCoordsObj.data.value); // Concatenate arrays
|
||||
} else if (dnsCoordsObj.data.value) {
|
||||
coordsObj.value.push(dnsCoordsObj.data.value); // Push single value if it's not an array
|
||||
}
|
||||
|
||||
// Second Axios request
|
||||
const sipsCoordsObj = await axios.get(
|
||||
WEBAPI_URL + queryUrlSips + hashAPIPath(queryUrlSips),
|
||||
azureHeaders(token.access_token)
|
||||
);
|
||||
// Merge the second response's 'value' array into the coordsObj's value array
|
||||
if (Array.isArray(sipsCoordsObj.data.value)) {
|
||||
coordsObj.value = coordsObj.value.concat(sipsCoordsObj.data.value); // Concatenate arrays
|
||||
} else if (sipsCoordsObj.data.value) {
|
||||
coordsObj.value.push(sipsCoordsObj.data.value); // Push single value if it's not an array
|
||||
}
|
||||
|
||||
Object.assign(coordsObj, { "@odata.count": coordsObj.value.length });
|
||||
|
||||
// Send the merged values as the response
|
||||
return res.status(200).json(coordsObj);
|
||||
} catch (error) {
|
||||
// Catch any errors and send an error response
|
||||
consoleLogger(error);
|
||||
return res.status(400).json(error);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user