262 lines
6.7 KiB
JavaScript
262 lines
6.7 KiB
JavaScript
import { BASE_URL } from "../core/env";
|
|
import { consoleLogger } from "../core/logger";
|
|
import { getJson } from "../clients/endpointClient";
|
|
import {
|
|
logAndReturnResponse,
|
|
logAndReturnEmptyValueErrorResponse
|
|
} from "./httpServiceUtils";
|
|
|
|
export const getBasicSearch = (searchString) => {
|
|
return getJson(
|
|
BASE_URL +
|
|
"/api/endpoint/getbasicsearch_api?searchString=" +
|
|
searchString
|
|
).catch(logAndReturnResponse);
|
|
};
|
|
|
|
export const getBasicDNSURLSearch = (searchString) => {
|
|
return getJson(
|
|
BASE_URL +
|
|
"/api/endpoint/getbasicdnsurlsearch_api?searchString=" +
|
|
searchString
|
|
).catch(logAndReturnResponse);
|
|
};
|
|
|
|
export const getAddressSearchPaged = (
|
|
searchString,
|
|
pageNumber,
|
|
orderBy,
|
|
fieldSort,
|
|
showNumberOfRecords
|
|
) => {
|
|
return getJson(
|
|
"/api/endpoint/getbasicsearch_by_address_paged_api?searchString=" +
|
|
searchString +
|
|
"&pageNumber=" +
|
|
pageNumber +
|
|
"&orderby=" +
|
|
orderBy +
|
|
"&fieldSort=" +
|
|
fieldSort +
|
|
"&showNumberOfRecords=" +
|
|
showNumberOfRecords
|
|
).catch(logAndReturnResponse);
|
|
};
|
|
|
|
export const getBasicSearchPaged = (
|
|
searchString,
|
|
pageNumber,
|
|
orderBy,
|
|
fieldSort,
|
|
showNumberOfRecords
|
|
) => {
|
|
return getJson(
|
|
"/api/endpoint/getbasicsearchpaged_api?searchString=" +
|
|
searchString +
|
|
"&pageNumber=" +
|
|
pageNumber +
|
|
"&orderby=" +
|
|
orderBy +
|
|
"&fieldSort=" +
|
|
fieldSort +
|
|
"&showNumberOfRecords=" +
|
|
showNumberOfRecords
|
|
).catch(logAndReturnResponse);
|
|
};
|
|
|
|
export const getDNSCoords = () => {
|
|
return getJson(BASE_URL + "/api/endpoint/getdnscoords_api").catch(
|
|
logAndReturnEmptyValueErrorResponse
|
|
);
|
|
};
|
|
|
|
export const getDNSList = (searchString) => {
|
|
return getJson(BASE_URL + "/api/endpoint/getdnslist_api").catch(
|
|
logAndReturnResponse
|
|
);
|
|
};
|
|
|
|
export const getBasicDNSSearch = (searchString) => {
|
|
return getJson(BASE_URL + "/api/endpoint/getbasicdnssearch_api").catch(
|
|
logAndReturnResponse
|
|
);
|
|
};
|
|
|
|
export const getBasicDNSSearchPaged = (
|
|
pageNumber,
|
|
orderBy,
|
|
fieldSort,
|
|
showNumberOfRecords
|
|
) => {
|
|
return getJson(
|
|
"/api/endpoint/getbasicdnssearchpaged_api?pageNumber=" +
|
|
pageNumber +
|
|
"&orderby=" +
|
|
orderBy +
|
|
"&fieldSort=" +
|
|
fieldSort +
|
|
"&showNumberOfRecords=" +
|
|
showNumberOfRecords
|
|
).catch(logAndReturnResponse);
|
|
};
|
|
|
|
export const getAdvancedSearch = (searchString) => {
|
|
return getJson(
|
|
BASE_URL +
|
|
"/api/endpoint/getadvancedsearch_api?searchstring=" +
|
|
JSON.stringify(searchString)
|
|
).catch(logAndReturnEmptyValueErrorResponse);
|
|
};
|
|
|
|
export const getAdvancedSearchPaged = (
|
|
searchString,
|
|
pageNumber,
|
|
orderBy,
|
|
fieldSort,
|
|
showNumberOfRecords
|
|
) => {
|
|
return getJson(
|
|
"/api/endpoint/getadvancedsearchpaged_api?searchstring=" +
|
|
JSON.stringify(searchString) +
|
|
"&pageNumber=" +
|
|
pageNumber +
|
|
"&orderby=" +
|
|
orderBy +
|
|
"&fieldSort=" +
|
|
fieldSort +
|
|
"&showNumberOfRecords=" +
|
|
showNumberOfRecords
|
|
).catch(logAndReturnEmptyValueErrorResponse);
|
|
};
|
|
|
|
export const getBasicSearchDetails = async (
|
|
appealTypeName,
|
|
caseReference,
|
|
primaryIdAttribute,
|
|
incidentID
|
|
) => {
|
|
return getJson(
|
|
BASE_URL +
|
|
"/api/endpoint/getbasicsearchdetails_api?appealTypeName=" +
|
|
appealTypeName +
|
|
"&primaryIdAttribute=" +
|
|
primaryIdAttribute +
|
|
"&incidentID=" +
|
|
incidentID
|
|
).catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getBasicPartSavedDetails = (
|
|
appealTypeName,
|
|
caseReference,
|
|
primaryIdAttribute,
|
|
incidentID
|
|
) => {
|
|
return getJson(
|
|
BASE_URL +
|
|
"/api/endpoint/getbasicpartsaveddetails_api?appealTypeName=" +
|
|
appealTypeName +
|
|
"&primaryIdAttribute=" +
|
|
primaryIdAttribute +
|
|
"&incidentID=" +
|
|
incidentID
|
|
).catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getBasicSearchDetailsPaged = async (
|
|
appealTypeName,
|
|
caseReference,
|
|
primaryIdAttribute,
|
|
incidentIDs
|
|
) => {
|
|
if (!incidentIDs || incidentIDs.length === 0) return [];
|
|
|
|
const filter = incidentIDs
|
|
.map((id) => {
|
|
const suffix =
|
|
primaryIdAttribute === "pinswg_sipscase"
|
|
? `_${primaryIdAttribute}_value`
|
|
: `_${primaryIdAttribute}s_value`;
|
|
|
|
return `${suffix} eq ${id}`;
|
|
})
|
|
.join(" or ");
|
|
|
|
const url = `/api/endpoint/getbasicsearchdetailspaged_api?appealTypeName=${appealTypeName}&primaryIdAttribute=${primaryIdAttribute}&incidentID=${encodeURIComponent(
|
|
filter
|
|
)}`;
|
|
|
|
try {
|
|
const data = await getJson(url);
|
|
return data.value || [];
|
|
} catch (error) {
|
|
consoleLogger(error);
|
|
return [];
|
|
}
|
|
};
|
|
|
|
export const getSearchDocumentDetails = (incidentID) => {
|
|
return getJson(
|
|
"/api/endpoint/getsearchdocumentdetails_api?incidentid=" + incidentID
|
|
).catch((error) => {
|
|
consoleLogger(error);
|
|
throw error;
|
|
});
|
|
};
|
|
|
|
export const getSearchDocumentTypes = (incidentID) => {
|
|
return getJson(
|
|
"/api/endpoint/getsearchdocumentTypes_api?incidentid=" + incidentID
|
|
).catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getSearchDocumentDetailsPaged = (
|
|
incidentID,
|
|
pageNumber,
|
|
orderBy,
|
|
fieldSort,
|
|
showNumberOfRecords,
|
|
documentType
|
|
) => {
|
|
return getJson(
|
|
"/api/endpoint/getsearchdocumentdetailspaged_api?incidentid=" +
|
|
incidentID +
|
|
"&pageNumber=" +
|
|
pageNumber +
|
|
"&orderby=" +
|
|
orderBy +
|
|
"&fieldSort=" +
|
|
fieldSort +
|
|
"&showNumberOfRecords=" +
|
|
showNumberOfRecords +
|
|
"&documentType=" +
|
|
documentType
|
|
).catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getLinkedCases = (parentIncidentid) => {
|
|
return getJson(
|
|
"/api/endpoint/getlinkedcases_api?parentincidentid=" + parentIncidentid
|
|
).catch((error) => {
|
|
consoleLogger(error);
|
|
});
|
|
};
|
|
|
|
export const getAddressSearch = async (searchString) => {
|
|
const params = new URLSearchParams(searchString);
|
|
const str = params.toString();
|
|
|
|
var queryUrl =
|
|
BASE_URL + "/api/endpoint/getbasicsearch_by_address_api?" + str;
|
|
|
|
return getJson(queryUrl).catch(logAndReturnEmptyValueErrorResponse);
|
|
};
|