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:
Robert Bond
2026-05-07 10:20:28 +00:00
parent 1a2c3ede3b
commit 12a28a4be0
+30 -2
View File
@@ -14,6 +14,7 @@ const renameKeys = (obj) => {
"pinswg_anticipatedgridrefnorthing": "northing", "pinswg_anticipatedgridrefnorthing": "northing",
"pinswg_projectname": "projectTitle", "pinswg_projectname": "projectTitle",
"pinswg_dnsid": "dnsId", "pinswg_dnsid": "dnsId",
"pinswg_sipsid": "sipsId",
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue": "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue":
"lpaDisplayName", "lpaDisplayName",
"_pinswg_associatedlpa_value": "lpaId", "_pinswg_associatedlpa_value": "lpaId",
@@ -31,6 +32,11 @@ const renameKeys = (obj) => {
return; 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 // Check if the key exists in the mapping
if (keyMappings[key]) { if (keyMappings[key]) {
renamedObj[keyMappings[key]] = obj[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 // Recursively rename keys in nested objects
if (obj.center) { if (obj.center) {
renamedObj.locationCenter = { renamedObj.locationCenter = {
@@ -69,11 +97,11 @@ const keysToRemove = [
export default async function ApiProxy(req, res) { export default async function ApiProxy(req, res) {
const queryUrl = 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); //console.log("dns ", queryUrl);
const queryUrlSips = 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: [] }; const coordsObj = { value: [] };