refactor(api): migrate batch 8 endpoints to relayGet
This commit is contained in:
@@ -939,3 +939,38 @@ Validation:
|
||||
Follow-ups:
|
||||
|
||||
- Continue with next bounded P2-S2 batch from remaining legacy GET endpoints (e.g., advanced/basic paged search-detail clusters and related non-migrated proxies).
|
||||
|
||||
---
|
||||
|
||||
### CL-025: TASK22229 P2-S2 Batch 8 (basic search details + DNS details relay GET cluster)
|
||||
|
||||
date: 2026-03-24
|
||||
author: Cline
|
||||
scope: `pages/api/endpoint/{getbasicsearchpaged_api,getbasicsearchdetails_api,getbasicsearchdetailspaged_api,getbasicdnssearchdetails_api,getbasicdnssearchdetailspaged_api}.js`, `tests/phase21/endpoint-handler-contract.test.cjs`
|
||||
type: change
|
||||
rationale: Continue the P2-S2 relay migration using bounded commits by moving the remaining basic-search-details and DNS-details GET handlers to shared `relayGet`, preserving existing guards and response contracts.
|
||||
impact: Reduced duplicated relay plumbing and more consistent forwarding behavior across search-detail handlers; no intended API contract changes.
|
||||
status: completed
|
||||
|
||||
Summary:
|
||||
|
||||
- Migrated Batch 8 endpoints to shared `relayGet`:
|
||||
- `getbasicsearchpaged_api.js`
|
||||
- `getbasicsearchdetails_api.js`
|
||||
- `getbasicsearchdetailspaged_api.js`
|
||||
- `getbasicdnssearchdetails_api.js`
|
||||
- `getbasicdnssearchdetailspaged_api.js`
|
||||
- Preserved existing validation guards and error contracts.
|
||||
- Preserved existing endpoint-specific transforms:
|
||||
- `@odata.nextLink` normalization in paged responses
|
||||
- flattened ticketnumber enrichment for search detail handlers
|
||||
- Updated phase21 endpoint contract tests to inject `relayGet` mocks for migrated handlers in validation and catch-path tests.
|
||||
|
||||
Validation:
|
||||
|
||||
- `node tests/phase21/endpoint-handler-contract.test.cjs` -> pass (152/152)
|
||||
- `npm run lint` -> warnings only (pre-existing `react-hooks/exhaustive-deps`; no new lint errors)
|
||||
|
||||
Follow-ups:
|
||||
|
||||
- Continue P2-S2 with next bounded batch from remaining legacy GET endpoints (currently: `createwatchedcases_api`, `deletewatchedcasesproxy_api`, `getadvancedsearch_api`, `getadvancedsearchpaged_api`, `getappealid_api`, `getbasicdnssearchpaged_api`, `getbasicpartsaveddetails_api`, `getbasicsearch_by_address_api`, `getbasicsearch_by_lparref_api`, `getdnscoords_api`, `getdnslist_api`, `getmylpacases_api`, `getportallogin_api`).
|
||||
|
||||
@@ -10,18 +10,10 @@
|
||||
* description: Success
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import _ from "lodash";
|
||||
import { azureHeaders } from "../../../actions/core/headers";
|
||||
import { consoleLogger } from "../../../actions/core/logger";
|
||||
import { getToken } from "../../../actions/core/token";
|
||||
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
||||
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 { respondError } from "../middleware/apiResponse";
|
||||
import { relayGet } from "../middleware/relayForwarding";
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
const caseReference = req.query.caseReference;
|
||||
@@ -37,28 +29,21 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
let queryUrl =
|
||||
"pinswg_dnses?$filter=pinswg_name eq '" +
|
||||
caseReference +
|
||||
"&$count=true";
|
||||
|
||||
let queryUrl =
|
||||
"pinswg_dnses?$filter=pinswg_name eq '" +
|
||||
caseReference +
|
||||
"&$count=true";
|
||||
queryUrl = queryUrl + getSelectQuery("pinswg_dnses");
|
||||
|
||||
queryUrl = queryUrl + getSelectQuery("pinswg_dnses");
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
);
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) => azureHeaders(accessToken),
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "BASIC_DNS_SEARCH_DETAILS_FETCH_FAILED",
|
||||
message: "Failed to fetch basic DNS search details"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,18 +9,11 @@
|
||||
* 200:
|
||||
* description: Success
|
||||
*/
|
||||
import axios from "axios";
|
||||
import _ from "lodash";
|
||||
import { azureHeadersPaged } from "../../../actions/core/headers";
|
||||
import { consoleLogger } from "../../../actions/core/logger";
|
||||
import { getToken } from "../../../actions/core/token";
|
||||
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
||||
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 { respondError } from "../middleware/apiResponse";
|
||||
import { relayGet } from "../middleware/relayForwarding";
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
const caseReference = req.query.caseReference;
|
||||
@@ -36,33 +29,29 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
let queryUrl =
|
||||
"pinswg_dnses?$filter=pinswg_name eq '" +
|
||||
caseReference +
|
||||
"&$count=true";
|
||||
|
||||
let queryUrl =
|
||||
"pinswg_dnses?$filter=pinswg_name eq '" +
|
||||
caseReference +
|
||||
"&$count=true";
|
||||
queryUrl = queryUrl + getSelectQuery("pinswg_dnses");
|
||||
|
||||
queryUrl = queryUrl + getSelectQuery("pinswg_dnses");
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) => azureHeadersPaged(accessToken),
|
||||
transformData: (data) => {
|
||||
if (_.has(data, "@odata.nextLink") === true) {
|
||||
const dataStr = JSON.stringify(data["@odata.nextLink"]);
|
||||
data["@odata.nextLink"] = dataStr.split("/v8.2/")[1];
|
||||
}
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
);
|
||||
|
||||
if (_.has(data, "@odata.nextLink") === true) {
|
||||
const dataStr = JSON.stringify(data["@odata.nextLink"]);
|
||||
data["@odata.nextLink"] = dataStr.split("/v8.2/")[1];
|
||||
}
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return data;
|
||||
},
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "BASIC_DNS_SEARCH_DETAILS_PAGED_FETCH_FAILED",
|
||||
message: "Failed to fetch paged basic DNS search details"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -29,18 +29,11 @@
|
||||
* description: Success
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import { azureHeaders } from "../../../actions/core/headers";
|
||||
import { consoleLogger } from "../../../actions/core/logger";
|
||||
import { getToken } from "../../../actions/core/token";
|
||||
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
||||
import { getNavigationPropertyByPrimaryAttribute } from "../../../components/utils";
|
||||
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 { respondError } from "../middleware/apiResponse";
|
||||
import { relayGet } from "../middleware/relayForwarding";
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
const appealTypeName = req.query.appealTypeName;
|
||||
@@ -77,67 +70,63 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const navigationProperty =
|
||||
getNavigationPropertyByPrimaryAttribute(
|
||||
primaryIdAttribute
|
||||
).NavigationProperty;
|
||||
|
||||
const navigationProperty =
|
||||
getNavigationPropertyByPrimaryAttribute(
|
||||
primaryIdAttribute
|
||||
).NavigationProperty;
|
||||
let queryUrl =
|
||||
appealTypeName +
|
||||
"?$filter=_" +
|
||||
(primaryIdAttribute == "pinswg_sipscase"
|
||||
? "pinswg_sipscase_value"
|
||||
: primaryIdAttribute + "s_value ") +
|
||||
" eq " +
|
||||
incidentID +
|
||||
"&$count=true" +
|
||||
"&$expand=" +
|
||||
navigationProperty +
|
||||
"($select=ticketnumber)";
|
||||
|
||||
let queryUrl =
|
||||
appealTypeName +
|
||||
"?$filter=_" +
|
||||
(primaryIdAttribute == "pinswg_sipscase"
|
||||
? "pinswg_sipscase_value"
|
||||
: primaryIdAttribute + "s_value ") +
|
||||
" eq " +
|
||||
incidentID +
|
||||
"&$count=true" +
|
||||
"&$expand=" +
|
||||
navigationProperty +
|
||||
"($select=ticketnumber)";
|
||||
//" and statuscode eq 1&$count=true";
|
||||
|
||||
//" and statuscode eq 1&$count=true";
|
||||
// queryUrl =
|
||||
// queryUrl +
|
||||
// getSelectQuery(appealTypeName) +
|
||||
// ",_" +
|
||||
// (primaryIdAttribute == "pinswg_sipscase"
|
||||
// ? "pinswg_sipscase_value"
|
||||
// : primaryIdAttribute + "s_value");
|
||||
|
||||
// queryUrl =
|
||||
// queryUrl +
|
||||
// getSelectQuery(appealTypeName) +
|
||||
// ",_" +
|
||||
// (primaryIdAttribute == "pinswg_sipscase"
|
||||
// ? "pinswg_sipscase_value"
|
||||
// : primaryIdAttribute + "s_value");
|
||||
queryUrl = queryUrl + getSelectQuery(appealTypeName);
|
||||
|
||||
queryUrl = queryUrl + getSelectQuery(appealTypeName);
|
||||
// console.log(
|
||||
// "\n==========================================\n",
|
||||
// "\nSearch Details query ",
|
||||
// "\nAppealType: " + appealTypeName,
|
||||
// "\nIncident ID: " + incidentID,
|
||||
// "\n\nQuery url: " + queryUrl,
|
||||
// "\n==========================================\n"
|
||||
// );
|
||||
|
||||
// console.log(
|
||||
// "\n==========================================\n",
|
||||
// "\nSearch Details query ",
|
||||
// "\nAppealType: " + appealTypeName,
|
||||
// "\nIncident ID: " + incidentID,
|
||||
// "\n\nQuery url: " + queryUrl,
|
||||
// "\n==========================================\n"
|
||||
// );
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) => azureHeaders(accessToken),
|
||||
transformData: (data) => {
|
||||
let flattened = data.value.map((r) => ({
|
||||
...r,
|
||||
ticketnumber: r[navigationProperty]?.ticketnumber || null
|
||||
}));
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
);
|
||||
data.value = flattened;
|
||||
|
||||
let flattened = data.value.map((r) => ({
|
||||
...r,
|
||||
ticketnumber: r[navigationProperty]?.ticketnumber || null
|
||||
}));
|
||||
|
||||
data.value = flattened;
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return data;
|
||||
},
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "BASIC_SEARCH_DETAILS_FETCH_FAILED",
|
||||
message: "Failed to fetch basic search details"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -29,19 +29,12 @@
|
||||
* description: Success
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import _ from "lodash";
|
||||
import { azureHeadersPaged } from "../../../actions/core/headers";
|
||||
import { consoleLogger } from "../../../actions/core/logger";
|
||||
import { getToken } from "../../../actions/core/token";
|
||||
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
||||
import { getNavigationPropertyByPrimaryAttribute } from "../../../components/utils";
|
||||
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 { respondError } from "../middleware/apiResponse";
|
||||
import { relayGet } from "../middleware/relayForwarding";
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
const appealTypeName = req.query.appealTypeName;
|
||||
@@ -78,64 +71,60 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const navigationProperty =
|
||||
getNavigationPropertyByPrimaryAttribute(
|
||||
primaryIdAttribute
|
||||
).NavigationProperty;
|
||||
|
||||
const navigationProperty =
|
||||
getNavigationPropertyByPrimaryAttribute(
|
||||
primaryIdAttribute
|
||||
).NavigationProperty;
|
||||
// "?$filter=_" +
|
||||
// (primaryIdAttribute == "pinswg_sipscase"
|
||||
// ? "pinswg_sipscase_value"
|
||||
// : primaryIdAttribute + "s_value ") +
|
||||
// " eq " +
|
||||
// incidentID +
|
||||
|
||||
// "?$filter=_" +
|
||||
// (primaryIdAttribute == "pinswg_sipscase"
|
||||
// ? "pinswg_sipscase_value"
|
||||
// : primaryIdAttribute + "s_value ") +
|
||||
// " eq " +
|
||||
// incidentID +
|
||||
let queryUrl =
|
||||
appealTypeName +
|
||||
"?$filter=" +
|
||||
incidentID +
|
||||
"&$count=true" +
|
||||
"&$expand=" +
|
||||
navigationProperty +
|
||||
"($select=ticketnumber)";
|
||||
|
||||
let queryUrl =
|
||||
appealTypeName +
|
||||
"?$filter=" +
|
||||
incidentID +
|
||||
"&$count=true" +
|
||||
"&$expand=" +
|
||||
navigationProperty +
|
||||
"($select=ticketnumber)";
|
||||
//" and statuscode eq 1&$count=true";
|
||||
|
||||
//" and statuscode eq 1&$count=true";
|
||||
queryUrl =
|
||||
queryUrl +
|
||||
getSelectQuery(appealTypeName) +
|
||||
",_" +
|
||||
(primaryIdAttribute == "pinswg_sipscase"
|
||||
? "pinswg_sipscase_value"
|
||||
: primaryIdAttribute + "s_value");
|
||||
|
||||
queryUrl =
|
||||
queryUrl +
|
||||
getSelectQuery(appealTypeName) +
|
||||
",_" +
|
||||
(primaryIdAttribute == "pinswg_sipscase"
|
||||
? "pinswg_sipscase_value"
|
||||
: primaryIdAttribute + "s_value");
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) => azureHeadersPaged(accessToken),
|
||||
transformData: (data) => {
|
||||
let flattened = data.value.map((r) => ({
|
||||
...r,
|
||||
ticketnumber: r[navigationProperty]?.ticketnumber || null
|
||||
}));
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
);
|
||||
data.value = flattened;
|
||||
|
||||
let flattened = data.value.map((r) => ({
|
||||
...r,
|
||||
ticketnumber: r[navigationProperty]?.ticketnumber || null
|
||||
}));
|
||||
if (_.has(data, "@odata.nextLink") === true) {
|
||||
const dataStr = JSON.stringify(data["@odata.nextLink"]);
|
||||
data["@odata.nextLink"] = dataStr.split("/v8.2/")[1];
|
||||
}
|
||||
|
||||
data.value = flattened;
|
||||
|
||||
if (_.has(data, "@odata.nextLink") === true) {
|
||||
const dataStr = JSON.stringify(data["@odata.nextLink"]);
|
||||
data["@odata.nextLink"] = dataStr.split("/v8.2/")[1];
|
||||
}
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return data;
|
||||
},
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "BASIC_SEARCH_DETAILS_PAGED_FETCH_FAILED",
|
||||
message: "Failed to fetch paged basic search details"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -42,17 +42,10 @@
|
||||
* description: Success
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import _ from "lodash";
|
||||
import { azureHeadersPagedCustom } 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 { respondError } from "../middleware/apiResponse";
|
||||
import { relayGet } from "../middleware/relayForwarding";
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
let searchString = req.query.searchString;
|
||||
@@ -96,48 +89,45 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
searchString = searchString.replace(/\'/g, "''");
|
||||
|
||||
searchString = searchString.replace(/\'/g, "''");
|
||||
const queryUrl =
|
||||
"incidents?$select=pinswg_environmentalstatementlocation,pinswg_caseaddress,modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_lpareference,pinswg_appellantagent,pinswg_appellantfirstname,pinswg_appellantlastname&$expand=primarycontactid($select=fullname)&$filter=(contains(title, '" +
|
||||
searchString +
|
||||
"') or contains(ticketnumber, '" +
|
||||
searchString +
|
||||
"') or contains(pinswg_lpareference, '" +
|
||||
searchString +
|
||||
"')) and pinswg_appealcasetype ne null " +
|
||||
(process.env.SHOWSIPS !== "true"
|
||||
? "and pinswg_appealcasetype ne 846040002 "
|
||||
: "") +
|
||||
"and pinswg_publishtoweb eq true&$orderby=" +
|
||||
orderby +
|
||||
" " +
|
||||
fieldSort +
|
||||
"&$count=true" +
|
||||
(typeof pageNumber != "undefined"
|
||||
? "&$skiptoken=" + '<cookie pagenumber="' + pageNumber + '" />'
|
||||
: "");
|
||||
|
||||
const queryUrl =
|
||||
"incidents?$select=pinswg_environmentalstatementlocation,pinswg_caseaddress,modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_lpareference,pinswg_appellantagent,pinswg_appellantfirstname,pinswg_appellantlastname&$expand=primarycontactid($select=fullname)&$filter=(contains(title, '" +
|
||||
searchString +
|
||||
"') or contains(ticketnumber, '" +
|
||||
searchString +
|
||||
"') or contains(pinswg_lpareference, '" +
|
||||
searchString +
|
||||
"')) and pinswg_appealcasetype ne null " +
|
||||
(process.env.SHOWSIPS !== "true"
|
||||
? "and pinswg_appealcasetype ne 846040002 "
|
||||
: "") +
|
||||
"and pinswg_publishtoweb eq true&$orderby=" +
|
||||
orderby +
|
||||
" " +
|
||||
fieldSort +
|
||||
"&$count=true" +
|
||||
(typeof pageNumber != "undefined"
|
||||
? "&$skiptoken=" + '<cookie pagenumber="' + pageNumber + '" />'
|
||||
: "");
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) =>
|
||||
azureHeadersPagedCustom(accessToken, showNumberOfRecords),
|
||||
transformData: (data) => {
|
||||
if (_.has(data, "@odata.nextLink") === true) {
|
||||
const dataStr = JSON.stringify(data["@odata.nextLink"]);
|
||||
data["@odata.nextLink"] = dataStr.split("/v8.2/")[1];
|
||||
}
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPagedCustom(token.access_token, showNumberOfRecords)
|
||||
);
|
||||
|
||||
if (_.has(data, "@odata.nextLink") === true) {
|
||||
const dataStr = JSON.stringify(data["@odata.nextLink"]);
|
||||
data["@odata.nextLink"] = dataStr.split("/v8.2/")[1];
|
||||
}
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return data;
|
||||
},
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "BASIC_SEARCH_PAGED_FETCH_FAILED",
|
||||
message: "Failed to fetch paged basic search results"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1794,6 +1794,7 @@ test("getbasicsearchdetails returns APPEAL_TYPE_NAME_REQUIRED when appealTypeNam
|
||||
const mod = loadModule("pages/api/endpoint/getbasicsearchdetails_api.js", {
|
||||
respondError: respondErrorMock,
|
||||
respondSuccess: respondSuccessMock,
|
||||
relayGet: async () => ({}),
|
||||
getToken: async () => ({ access_token: "token" }),
|
||||
getSelectQuery: () => "&$select=title",
|
||||
getNavigationPropertyByPrimaryAttribute: () => ({
|
||||
@@ -1825,6 +1826,8 @@ test("getbasicsearchdetails catch path returns BASIC_SEARCH_DETAILS_FETCH_FAILED
|
||||
const mod = loadModule("pages/api/endpoint/getbasicsearchdetails_api.js", {
|
||||
respondError: respondErrorMock,
|
||||
respondSuccess: respondSuccessMock,
|
||||
relayGet: async ({ res, errorResponse }) =>
|
||||
respondErrorMock(res, errorResponse),
|
||||
getToken: async () => ({ access_token: "token" }),
|
||||
getSelectQuery: () => "&$select=title",
|
||||
getNavigationPropertyByPrimaryAttribute: () => ({
|
||||
@@ -1863,6 +1866,7 @@ test("getbasicsearchdetailspaged returns APPEAL_TYPE_NAME_REQUIRED when appealTy
|
||||
{
|
||||
respondError: respondErrorMock,
|
||||
respondSuccess: respondSuccessMock,
|
||||
relayGet: async () => ({}),
|
||||
getToken: async () => ({ access_token: "token" }),
|
||||
getSelectQuery: () => "&$select=title",
|
||||
getNavigationPropertyByPrimaryAttribute: () => ({
|
||||
@@ -1898,6 +1902,8 @@ test("getbasicsearchdetailspaged catch path returns BASIC_SEARCH_DETAILS_PAGED_F
|
||||
{
|
||||
respondError: respondErrorMock,
|
||||
respondSuccess: respondSuccessMock,
|
||||
relayGet: async ({ res, errorResponse }) =>
|
||||
respondErrorMock(res, errorResponse),
|
||||
getToken: async () => ({ access_token: "token" }),
|
||||
getSelectQuery: () => "&$select=title",
|
||||
getNavigationPropertyByPrimaryAttribute: () => ({
|
||||
@@ -1936,6 +1942,7 @@ test("getbasicsearchpaged returns ORDER_BY_REQUIRED when orderby missing", async
|
||||
const mod = loadModule("pages/api/endpoint/getbasicsearchpaged_api.js", {
|
||||
respondError: respondErrorMock,
|
||||
respondSuccess: respondSuccessMock,
|
||||
relayGet: async () => ({}),
|
||||
getToken: async () => ({ access_token: "token" }),
|
||||
hashAPIPath: () => "&hash=expected",
|
||||
azureHeadersPagedCustom: () => ({}),
|
||||
@@ -1962,6 +1969,8 @@ test("getbasicsearchpaged catch path returns BASIC_SEARCH_PAGED_FETCH_FAILED", a
|
||||
const mod = loadModule("pages/api/endpoint/getbasicsearchpaged_api.js", {
|
||||
respondError: respondErrorMock,
|
||||
respondSuccess: respondSuccessMock,
|
||||
relayGet: async ({ res, errorResponse }) =>
|
||||
respondErrorMock(res, errorResponse),
|
||||
getToken: async () => ({ access_token: "token" }),
|
||||
hashAPIPath: () => "&hash=expected",
|
||||
azureHeadersPagedCustom: () => ({}),
|
||||
@@ -2187,6 +2196,7 @@ test("getbasicdnssearchdetails returns CASE_REFERENCE_REQUIRED when caseReferenc
|
||||
{
|
||||
respondError: respondErrorMock,
|
||||
respondSuccess: respondSuccessMock,
|
||||
relayGet: async () => ({}),
|
||||
getToken: async () => ({ access_token: "token" }),
|
||||
getSelectQuery: () => "&$select=pinswg_name",
|
||||
hashAPIPath: () => "&hash=expected",
|
||||
@@ -2213,6 +2223,8 @@ test("getbasicdnssearchdetails catch path returns BASIC_DNS_SEARCH_DETAILS_FETCH
|
||||
{
|
||||
respondError: respondErrorMock,
|
||||
respondSuccess: respondSuccessMock,
|
||||
relayGet: async ({ res, errorResponse }) =>
|
||||
respondErrorMock(res, errorResponse),
|
||||
getToken: async () => ({ access_token: "token" }),
|
||||
getSelectQuery: () => "&$select=pinswg_name",
|
||||
hashAPIPath: () => "&hash=expected",
|
||||
@@ -2243,6 +2255,7 @@ test("getbasicdnssearchdetailspaged returns CASE_REFERENCE_REQUIRED when caseRef
|
||||
{
|
||||
respondError: respondErrorMock,
|
||||
respondSuccess: respondSuccessMock,
|
||||
relayGet: async () => ({}),
|
||||
getToken: async () => ({ access_token: "token" }),
|
||||
getSelectQuery: () => "&$select=pinswg_name",
|
||||
hashAPIPath: () => "&hash=expected",
|
||||
@@ -2270,6 +2283,8 @@ test("getbasicdnssearchdetailspaged catch path returns BASIC_DNS_SEARCH_DETAILS_
|
||||
{
|
||||
respondError: respondErrorMock,
|
||||
respondSuccess: respondSuccessMock,
|
||||
relayGet: async ({ res, errorResponse }) =>
|
||||
respondErrorMock(res, errorResponse),
|
||||
getToken: async () => ({ access_token: "token" }),
|
||||
getSelectQuery: () => "&$select=pinswg_name",
|
||||
hashAPIPath: () => "&hash=expected",
|
||||
|
||||
Reference in New Issue
Block a user