cleared debug, updated new appeal add about you
This commit is contained in:
@@ -22,22 +22,27 @@ const hashAPIPath = (queryPath) => {
|
||||
};
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var createCaseBody = req.body;
|
||||
var contactid = req.query.contactid;
|
||||
var appealTypeId = req.query.appealTypeId;
|
||||
var lpaID = req.query.lpaID;
|
||||
var queryUrl = "incidents";
|
||||
var token = await getToken();
|
||||
|
||||
var data = JSON.stringify({
|
||||
var data = {
|
||||
"title": "insertion test case",
|
||||
"caseorigincode": 3,
|
||||
"servicestage": 1,
|
||||
"customerid_contact@odata.bind": "/contacts(" + contactid + ")",
|
||||
"pinswg_appealcasetype": appealTypeId,
|
||||
"pinswg_AssociatedLPA@odata.bind": "/accounts(" + lpaID + ")",
|
||||
});
|
||||
};
|
||||
var newData = Object.assign(data, createCaseBody);
|
||||
|
||||
console.log(data, WEBAPI_URL + queryUrl);
|
||||
delete newData.lpaTypes;
|
||||
delete newData.appealTypes;
|
||||
|
||||
console.log("/////Create Case:", newData);
|
||||
|
||||
var config = {
|
||||
method: "post",
|
||||
@@ -50,7 +55,7 @@ export default async function ApiProxy(req, res) {
|
||||
"Authorization": "Bearer " + token.access_token,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
data: data,
|
||||
data: JSON.stringify(data),
|
||||
};
|
||||
|
||||
var apiResponse = _.isEmpty(req.query)
|
||||
|
||||
@@ -40,7 +40,7 @@ export default async function ApiProxy(req, res) {
|
||||
|
||||
return axios(config)
|
||||
.then(({ data }) => {
|
||||
console.log("deleted awaitingsubmission case - " + incidentID);
|
||||
//console.log("deleted awaitingsubmission case - " + incidentID);
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
|
||||
@@ -40,7 +40,6 @@ export default async function ApiProxy(req, res) {
|
||||
|
||||
return axios(config)
|
||||
.then(({ data }) => {
|
||||
console.log("deleted ");
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
|
||||
@@ -74,7 +74,7 @@ export default async function ApiProxy(req, res) {
|
||||
? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
|
||||
: "");
|
||||
|
||||
console.log("adv qu: ", queryUrl);
|
||||
//console.log("adv qu: ", queryUrl);
|
||||
|
||||
var apiResponse = _.isEmpty(searchString)
|
||||
? res.status(400).json()
|
||||
|
||||
@@ -37,7 +37,8 @@ export default async function ApiProxy(req, res) {
|
||||
"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'LDP' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
|
||||
//"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'Developments of National Significance' and value ne 'LDP' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
|
||||
|
||||
console.log(queryUrl);
|
||||
//console.log(queryUrl);
|
||||
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
|
||||
@@ -35,7 +35,7 @@ export default async function ApiProxy(req, res) {
|
||||
data.value.forEach(function (element) {
|
||||
element.pinswg_title = element.title;
|
||||
});
|
||||
console.log(data);
|
||||
//console.log(data);
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
|
||||
@@ -27,7 +27,7 @@ export default async function ApiProxy(req, res) {
|
||||
var queryUrl =
|
||||
"incidents?$select=description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype eq 846040011 and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||
|
||||
console.log(queryUrl);
|
||||
//console.log(queryUrl);
|
||||
|
||||
return axios
|
||||
.get(
|
||||
|
||||
@@ -32,7 +32,7 @@ export default async function ApiProxy(req, res) {
|
||||
searchString +
|
||||
"')) and pinswg_appealcasetype eq 846040011 and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||
|
||||
console.log("basic search ", queryUrl);
|
||||
//console.log("basic search ", queryUrl);
|
||||
|
||||
var apiResponse = _.isEmpty(req.query)
|
||||
? res.status(400).json()
|
||||
|
||||
@@ -32,7 +32,7 @@ export default async function ApiProxy(req, res) {
|
||||
searchString +
|
||||
"')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||
|
||||
console.log("basic search ", queryUrl);
|
||||
//console.log("basic search ", queryUrl);
|
||||
|
||||
var apiResponse = _.isEmpty(req.query)
|
||||
? res.status(400).json()
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import { getToken, azureHeaders } 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 incidentID = req.query.incidentID;
|
||||
var token = await getToken();
|
||||
var queryUrl = "incidents(" + incidentID + ")?$select=ticketnumber,title";
|
||||
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
var dataStr;
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
}
|
||||
@@ -26,7 +26,8 @@ export default async function ApiProxy(req, res) {
|
||||
var queryUrl =
|
||||
"pinswg_dnses?$select=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";
|
||||
|
||||
console.log("dns ", queryUrl);
|
||||
//console.log("dns ", queryUrl);
|
||||
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
|
||||
@@ -30,7 +30,7 @@ export default async function ApiProxy(req, res) {
|
||||
pwd +
|
||||
"'&$count=true&$select=emailaddress1,contactid,pinswg_custom_password,yomifullname,firstname,lastname";
|
||||
|
||||
console.log(_.isEmpty(req.query));
|
||||
//console.log(_.isEmpty(req.query));
|
||||
|
||||
var apiResponse = _.isEmpty(req.query)
|
||||
? res.status(400).json()
|
||||
|
||||
@@ -8,37 +8,17 @@ 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 whichForm = req.query.whichForm;
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"EntityDefinitions(LogicalName='pinswg_" +
|
||||
// var queryUrl =
|
||||
// "EntityDefinitions(LogicalName='pinswg_" +
|
||||
// whichForm +
|
||||
// "')/Attributes?$count=true&$select=LogicalName,RequiredLevel";
|
||||
|
||||
const mandatoryFieldsData = require("../../../data/mandatoryfields/pinswg_" +
|
||||
whichForm +
|
||||
"')/Attributes?$count=true&$select=LogicalName,RequiredLevel";
|
||||
".json");
|
||||
|
||||
console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
return res.status(200).json(mandatoryFieldsData);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ export default async function ApiProxy(req, res) {
|
||||
searchString +
|
||||
"')) and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true";
|
||||
|
||||
console.log("basic search ", queryUrl);
|
||||
//console.log("basic search ", queryUrl);
|
||||
|
||||
var apiResponse = _.isEmpty(req.query)
|
||||
? res.status(400).json()
|
||||
|
||||
@@ -8,35 +8,17 @@ 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 (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||
};
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var whichForm = req.query.whichForm;
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"EntityDefinitions(LogicalName='pinswg_" +
|
||||
// var queryUrl =
|
||||
// "EntityDefinitions(LogicalName='pinswg_" +
|
||||
// whichForm +
|
||||
// "')/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=OptionSet,GlobalOptionSet&$count=true";
|
||||
|
||||
const pickListData = require("../../../data/picklistdata/pinswg_" +
|
||||
whichForm +
|
||||
"')/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=OptionSet,GlobalOptionSet&$count=true";
|
||||
".json");
|
||||
|
||||
console.log("get pick list for " + whichForm + ": ", queryUrl);
|
||||
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
return res.status(200).json(pickListData);
|
||||
}
|
||||
|
||||
@@ -44,14 +44,13 @@ export default async function ApiProxy(req, res) {
|
||||
data: data,
|
||||
};
|
||||
|
||||
console.log("update case:", data);
|
||||
//console.log("update case:", data);
|
||||
|
||||
return axios(config)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("is it", error);
|
||||
res.status(400);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user