Merged PR 2296: added in statuscode and summary description
added in statuscode and summary description Related work items: #22612, #22616
This commit is contained in:
@@ -14,6 +14,7 @@ const renameKeys = (obj) => {
|
||||
"pinswg_anticipatedgridrefnorthing": "northing",
|
||||
"pinswg_projectname": "projectTitle",
|
||||
"pinswg_dnsid": "dnsId",
|
||||
"pinswg_sipsid": "sipsId",
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue":
|
||||
"lpaDisplayName",
|
||||
"_pinswg_associatedlpa_value": "lpaId",
|
||||
@@ -31,6 +32,11 @@ const renameKeys = (obj) => {
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip nested case objects - we flatten them below
|
||||
if (key === "pinswg_sipscase" || key === "pinswg_DNSIds") {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the key exists in the mapping
|
||||
if (keyMappings[key]) {
|
||||
renamedObj[keyMappings[key]] = obj[key];
|
||||
@@ -39,6 +45,28 @@ const renameKeys = (obj) => {
|
||||
}
|
||||
});
|
||||
|
||||
// Flatten SIPS case response
|
||||
if (obj.pinswg_sipscase) {
|
||||
renamedObj.statusCode = obj.pinswg_sipscase.statuscode;
|
||||
renamedObj.statusCodeDescription =
|
||||
obj.pinswg_sipscase[
|
||||
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
renamedObj.description = obj.pinswg_sipscase.description;
|
||||
renamedObj.incidentId = obj.pinswg_sipscase.incidentid;
|
||||
}
|
||||
|
||||
// Flatten DNS case response
|
||||
if (obj.pinswg_DNSIds) {
|
||||
renamedObj.statusCode = obj.pinswg_DNSIds.statuscode;
|
||||
renamedObj.statusCodeDescription =
|
||||
obj.pinswg_DNSIds[
|
||||
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
renamedObj.description = obj.pinswg_DNSIds.description;
|
||||
renamedObj.incidentId = obj.pinswg_DNSIds.incidentid;
|
||||
}
|
||||
|
||||
// Recursively rename keys in nested objects
|
||||
if (obj.center) {
|
||||
renamedObj.locationCenter = {
|
||||
@@ -69,11 +97,11 @@ const keysToRemove = [
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
const queryUrl =
|
||||
"pinswg_dnses?$select=pinswg_projectlocation,pinswg_mapzoomlevel,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";
|
||||
"pinswg_dnses?$select=pinswg_projectlocation,pinswg_mapzoomlevel,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&$expand=pinswg_DNSIds($select=description,statuscode)";
|
||||
|
||||
//console.log("dns ", queryUrl);
|
||||
const queryUrlSips =
|
||||
"pinswg_sipses?$select=pinswg_projectlocation,pinswg_mapzoomlevel,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";
|
||||
"pinswg_sipses?$select=pinswg_projectlocation,pinswg_mapzoomlevel,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&$expand=pinswg_sipscase($select=description,statuscode)";
|
||||
|
||||
const coordsObj = { value: [] };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user