refactor(api): migrate batch 12 remaining relay-get candidates

This commit is contained in:
2026-03-24 10:27:27 +00:00
parent bf1ba9bc1e
commit da29e789c0
9 changed files with 194 additions and 172 deletions
@@ -1,14 +1,8 @@
import axios from "axios";
import { JSONPath as jsonpath } from "jsonpath-plus";
import { azureHeaders } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
import { hashAPIPath } from "../../../actions/core/hash";
import { respondError, respondSuccess } from "../middleware/apiResponse";
const WEBAPI_URL =
process.env.RELAY_ROOT ||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
import { relayGetData } from "../middleware/relayForwarding";
const escapeODataString = (value = "") =>
String(value).replace(/'/g, "''").trim();
@@ -366,15 +360,15 @@ const fetchSearchResultsForAppealType = async (item, token, params) => {
"\n\n",
item.LogicalCollectionName,
"\n\n",
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
queryUrl,
"\n==========================================\n"
);
try {
const { data } = await axios.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
);
const { data } = await relayGetData({
queryUrl,
accessToken: token.access_token
});
return (data.value || []).map((record) => ({
...record,
@@ -391,10 +385,10 @@ const fetchIncident = async (incidentId, token) => {
const queryUrl = buildIncidentQueryUrl(incidentId);
try {
const { data } = await axios.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
);
const { data } = await relayGetData({
queryUrl,
accessToken: token.access_token
});
return data?.value?.[0] || null;
} catch (error) {