Merged PR 1272: added in debug and async some calls
added in debug and async some calls Related work items: #12609
This commit is contained in:
@@ -1942,6 +1942,24 @@ export const setRepInvolvment = async (caseid, contactid) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const setCaseInvolvment = async (caseid, contactid) => {
|
||||||
|
var queryUrl = "/api/file/createrepinvolvement_api";
|
||||||
|
|
||||||
|
var data = { "incidentid": caseid, "contactid": contactid };
|
||||||
|
var config = {
|
||||||
|
method: "post",
|
||||||
|
url: queryUrl,
|
||||||
|
data: data,
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await axios(config);
|
||||||
|
return res.data;
|
||||||
|
} catch (error) {
|
||||||
|
consoleLogger(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export const getAddressSearch = async (searchString) => {
|
export const getAddressSearch = async (searchString) => {
|
||||||
const params = new URLSearchParams(searchString);
|
const params = new URLSearchParams(searchString);
|
||||||
const str = params.toString();
|
const str = params.toString();
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ const CaseSummary = (props) => {
|
|||||||
: props[currentType];
|
: props[currentType];
|
||||||
let setCaseDetailsObj =
|
let setCaseDetailsObj =
|
||||||
currentType == "directResultsObj"
|
currentType == "directResultsObj"
|
||||||
? props.searchDetailsObj
|
? props.searchResultsObj.searchDetailsObj
|
||||||
: props[currentType + "Details"];
|
: props[currentType + "Details"];
|
||||||
|
|
||||||
var casesObj = {};
|
var casesObj = {};
|
||||||
|
|||||||
@@ -69,11 +69,22 @@ export const getRadioLabel = (data, radiotListName, radioListID) => {
|
|||||||
* Get the details of a case from the appeal type
|
* Get the details of a case from the appeal type
|
||||||
* @param object searchResultsObj
|
* @param object searchResultsObj
|
||||||
*/
|
*/
|
||||||
export const getSearchDetails = (searchResultsObj) => {
|
export const getSearchDetails = async (searchResultsObj) => {
|
||||||
let detailsArr = [];
|
let detailsArr = [];
|
||||||
|
|
||||||
searchResultsObj = searchResultsObj.value;
|
searchResultsObj = searchResultsObj.value;
|
||||||
const detailsObj = searchResultsObj.map((searchDetail, index) => {
|
const detailsObj = searchResultsObj.map((searchDetail, index) => {
|
||||||
|
let formMeta = getFormCollectionByID(
|
||||||
|
searchDetail.pinswg_appealcasetype
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
"------------------- Details: ",
|
||||||
|
formMeta.LogicalCollectionName,
|
||||||
|
searchDetail.title,
|
||||||
|
formMeta.PrimaryIdAttribute,
|
||||||
|
searchDetail.incidentid
|
||||||
|
);
|
||||||
|
|
||||||
if (searchDetail.pinswg_appealcasetype == null) {
|
if (searchDetail.pinswg_appealcasetype == null) {
|
||||||
detailsArr.push(
|
detailsArr.push(
|
||||||
getBasicSearchDetails(
|
getBasicSearchDetails(
|
||||||
@@ -81,22 +92,30 @@ export const getSearchDetails = (searchResultsObj) => {
|
|||||||
searchDetail.title,
|
searchDetail.title,
|
||||||
"pinswg_dnsid",
|
"pinswg_dnsid",
|
||||||
searchDetail.incidentid
|
searchDetail.incidentid
|
||||||
)
|
) || {
|
||||||
|
"@odata.count": 1,
|
||||||
|
"value": [{ "title": searchDetail.title }],
|
||||||
|
}
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
let formMeta = getFormCollectionByID(
|
|
||||||
searchDetail.pinswg_appealcasetype
|
|
||||||
);
|
|
||||||
detailsArr.push(
|
detailsArr.push(
|
||||||
getBasicSearchDetails(
|
getBasicSearchDetails(
|
||||||
formMeta.LogicalCollectionName,
|
formMeta.LogicalCollectionName,
|
||||||
searchDetail.title,
|
searchDetail.title,
|
||||||
formMeta.PrimaryIdAttribute,
|
formMeta.PrimaryIdAttribute,
|
||||||
searchDetail.incidentid
|
searchDetail.incidentid
|
||||||
)
|
) || {
|
||||||
|
"@odata.count": 1,
|
||||||
|
"value": [{ "title": searchDetail.title }],
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// Promise.all(detailsArr).then((data) => {
|
||||||
|
// console.log(data);
|
||||||
|
// console.log(detailsArr);
|
||||||
|
// return data;
|
||||||
|
// });
|
||||||
return Promise.all(detailsArr);
|
return Promise.all(detailsArr);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -117,10 +117,20 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
(store) =>
|
(store) =>
|
||||||
async ({ query, req, res }) => {
|
async ({ query, req, res }) => {
|
||||||
console.log("query-", query);
|
console.log("query-", query);
|
||||||
//console.log("search array:", Object.entries(query));
|
console.log("search array:", Object.entries(query));
|
||||||
|
|
||||||
const searchResultsObj = await getAdvancedSearch(query);
|
const searchResultsObj = await getAdvancedSearch(query);
|
||||||
const searchDetailsObj = await getSearchDetails(searchResultsObj);
|
console.log(
|
||||||
|
"=============================== Advanced Search results:",
|
||||||
|
searchResultsObj
|
||||||
|
);
|
||||||
|
const searchDetailsObj =
|
||||||
|
(await getSearchDetails(searchResultsObj)) || null;
|
||||||
|
console.log(
|
||||||
|
"=============================== Advanced Search results details:",
|
||||||
|
searchDetailsObj
|
||||||
|
);
|
||||||
|
|
||||||
const showLoginCheck = process.env.SHOWLOGIN || false;
|
const showLoginCheck = process.env.SHOWLOGIN || false;
|
||||||
const showReps = process.env.SHOWREPRESENTATIONS || false;
|
const showReps = process.env.SHOWREPRESENTATIONS || false;
|
||||||
store.dispatch(setShowReps(showReps, showLoginCheck));
|
store.dispatch(setShowReps(showReps, showLoginCheck));
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /api/endpoint/createmywatchedcases_api:
|
||||||
|
* post:
|
||||||
|
* tags: [Portal,Case]
|
||||||
|
* summary: Phase 2
|
||||||
|
* description: Create my watched cases
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: Success
|
||||||
|
*/
|
||||||
|
|
||||||
|
import axios from "axios";
|
||||||
|
import CryptoJS from "crypto-js";
|
||||||
|
import { consoleLogger, getToken } from "../../../actions";
|
||||||
|
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function ApiProxy(req, res) {
|
||||||
|
var token = await getToken();
|
||||||
|
var contactid = req.body.contactid;
|
||||||
|
var queryUrl =
|
||||||
|
"incidents(" +
|
||||||
|
req.body.incidentid +
|
||||||
|
")/pinswg_incident_contact_case_involvement/$ref";
|
||||||
|
|
||||||
|
console.log(req.body, queryUrl);
|
||||||
|
|
||||||
|
var crmUrl = "https://" + process.env.CRMURL;
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
"@odata.id": crmUrl + "/api/data/v8.2/contacts(" + contactid + ")",
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
method: "post",
|
||||||
|
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
|
headers: {
|
||||||
|
"OData-MaxVersion": "4.0",
|
||||||
|
"OData-Version": "4.0",
|
||||||
|
"Accept": "application/json",
|
||||||
|
"If-None-Match": "null",
|
||||||
|
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||||
|
"Authorization": "Bearer " + token.access_token,
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
data: data,
|
||||||
|
};
|
||||||
|
|
||||||
|
return axios(config)
|
||||||
|
.then(({ data }) => {
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
return error.status == 412
|
||||||
|
? res.status(200).json({ "record": "exists" })
|
||||||
|
: (consoleLogger(Object.assign(error, data)),
|
||||||
|
res.status(400).json(error));
|
||||||
|
});
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user