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,13 +1,6 @@
import axios from "axios";
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";
// ✅ IMPORTANT: Only include the 23 types that actually contain pinswg_lpaapplicationreference
// You can copy from your existing appealTypeArray but only keep those entities.
@@ -281,7 +274,6 @@ var appealTypeArrayWithLpaRef = [
export default async function ApiProxy(req, res) {
try {
const token = await getToken();
let lpaRef = (req.query.lpaRef || "").trim();
if (!lpaRef) {
@@ -321,10 +313,7 @@ export default async function ApiProxy(req, res) {
`&$count=true` +
`&$orderby=modifiedon desc`;
const { data } = await axios.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
);
const { data } = await relayGetData({ queryUrl });
// Normalize response rows
const normalized = (data?.value || []).map((r) => ({