Skip to content

Commit

Permalink
Merge pull request #1058 from ManasaBM1/priorityissue
Browse files Browse the repository at this point in the history
filtering a equipmentType is empty or undefined
  • Loading branch information
PrathibaJee authored Dec 9, 2024
2 parents 267d0c4 + f10bbba commit f9620a4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions server/service/IndividualServicesService.js
Original file line number Diff line number Diff line change
Expand Up @@ -9768,6 +9768,7 @@ exports.provideListOfActualDeviceEquipment = function (url, body, user, originat
try {
let urlParts = url.split("?fields=");
let mountName = body['mount-name'];
let equipmentType;
if (mountName == "") {
throw new createHttpError.BadRequest("mount-name must not be empty");
}
Expand All @@ -9793,11 +9794,13 @@ exports.provideListOfActualDeviceEquipment = function (url, body, user, originat
const transformedData = {
"top-level-equipment": finalJson[0]["top-level-equipment"],
"actual-equipment-list": finalJson[0]["equipment"].map((item) => {
equipmentType = item["actual-equipment"]?.["manufactured-thing"]?.["equipment-type"]?.["type-name"]
if(equipmentType !== undefined){
return {
uuid: item.uuid,
"equipment-type-name": item["actual-equipment"]?.["manufactured-thing"]?.["equipment-type"]?.["type-name"] || "",
};
}),
uuid: item.uuid,
"equipment-type-name":equipmentType,
}}
}).filter((item)=> item !== undefined)
};
returnObject = transformedData;
} else {
Expand Down

0 comments on commit f9620a4

Please sign in to comment.