partial synch with ph2 updates
This commit is contained in:
@@ -306,7 +306,7 @@ export default async function ApiProxy(req, res) {
|
||||
"MetadataId": "8d31911b-b8ea-ef11-ab08-00224800be9c",
|
||||
"appealTypeID": "846040002",
|
||||
"tmpNav": "pinswg_sipsid",
|
||||
"NavigationProperty": "pinswg_SIPSids",
|
||||
"NavigationProperty": "pinswg_sipscase",
|
||||
"value": "SIP",
|
||||
},
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import { azureHeadersPaged, consoleLogger, getToken } from "../../../actions";
|
||||
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
||||
|
||||
import { getNavigationPropertyByPrimaryAttribute } from "../../../components/utils";
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
@@ -59,15 +59,27 @@ export default async function ApiProxy(req, res) {
|
||||
var incidentID = req.query.incidentID;
|
||||
var token = await getToken();
|
||||
|
||||
let navigationProperty =
|
||||
getNavigationPropertyByPrimaryAttribute(
|
||||
primaryIdAttribute
|
||||
).NavigationProperty;
|
||||
|
||||
// "?$filter=_" +
|
||||
// (primaryIdAttribute == "pinswg_sipscase"
|
||||
// ? "pinswg_sipscase_value"
|
||||
// : primaryIdAttribute + "s_value ") +
|
||||
// " eq " +
|
||||
// incidentID +
|
||||
|
||||
var queryUrl =
|
||||
appealTypeName +
|
||||
"?$filter=_" +
|
||||
(primaryIdAttribute == "pinswg_sipscase"
|
||||
? "pinswg_sipscase_value"
|
||||
: primaryIdAttribute + "s_value ") +
|
||||
" eq " +
|
||||
"?$filter=" +
|
||||
incidentID +
|
||||
"&$count=true";
|
||||
"&$count=true" +
|
||||
"&$expand=" +
|
||||
navigationProperty +
|
||||
"($select=ticketnumber)";
|
||||
|
||||
//" and statuscode eq 1&$count=true";
|
||||
|
||||
queryUrl =
|
||||
@@ -86,10 +98,18 @@ export default async function ApiProxy(req, res) {
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
let flattened = data.value.map((r) => ({
|
||||
...r,
|
||||
ticketnumber: r[navigationProperty]?.ticketnumber || null,
|
||||
}));
|
||||
|
||||
data.value = flattened;
|
||||
|
||||
var dataStr;
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
|
||||
return res.status(200).json(data);
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
Reference in New Issue
Block a user