Merged PR 2202: relay GET completion + notify logging fix
Related work items: #22229
This commit is contained in:
@@ -725,3 +725,385 @@ Validation:
|
||||
Follow-ups:
|
||||
|
||||
- Optional future auth hygiene (separate guarded slice): replace verbose auth `console.log` diagnostics with structured logger usage once production logging requirements are confirmed.
|
||||
|
||||
---
|
||||
|
||||
### CL-019: TASK22229 P2-S1 relay forwarding pilot (proxy endpoint cluster)
|
||||
|
||||
date: 2026-03-24
|
||||
author: Cline
|
||||
scope: `pages/api/middleware/relayForwarding.js`, `pages/api/endpoint/{getwatchedcasesproxy_api,getmyrepresentationsproxy_api,getrepresentationsproxy_api,getawaitingsubmissionproxy_api}.js`, `tests/phase21/endpoint-handler-contract.test.cjs`
|
||||
type: change
|
||||
rationale: Start Priority-2 by piloting a shared relay forwarding helper on a bounded proxy endpoint cluster to reduce duplicated token/hash/header/axios boilerplate while preserving endpoint contracts.
|
||||
impact: Maintainability and consistency improvement with no intended behavioral contract changes; error code/status/message and success payload contracts remain unchanged for migrated endpoints.
|
||||
status: completed
|
||||
|
||||
Summary:
|
||||
|
||||
- Added shared relay helper:
|
||||
- `pages/api/middleware/relayForwarding.js`
|
||||
- exports `relayGet({ queryUrl, res, errorResponse, transformData })`
|
||||
- centralizes token fetch, relay URL + hash composition, `azureHeaders`, GET execution, success/error response handling, and logging
|
||||
- Migrated pilot endpoint cluster to `relayGet`:
|
||||
- `getwatchedcasesproxy_api.js` (with existing payload transform preserved)
|
||||
- `getmyrepresentationsproxy_api.js`
|
||||
- `getrepresentationsproxy_api.js`
|
||||
- `getawaitingsubmissionproxy_api.js` (with existing payload transform preserved)
|
||||
- Updated endpoint contract tests to mock `relayGet` for migrated routes while preserving existing assertions.
|
||||
|
||||
Validation:
|
||||
|
||||
- `node tests/phase21/api-contract-slice1.test.cjs` -> pass
|
||||
- helper: 4/4
|
||||
- file-handler: 53/53
|
||||
- email-handler: 12/12
|
||||
- endpoint-handler: 152/152
|
||||
- documents-handler: 3/3
|
||||
|
||||
Follow-ups:
|
||||
|
||||
- P2-S2 rollout: migrate the next relay-heavy endpoint batch onto `relayGet`/shared forwarding utility pattern.
|
||||
- P2-S3 hardening: add shared timeout/retry config and redacted structured relay error logging policy.
|
||||
|
||||
---
|
||||
|
||||
### CL-020: TASK22229 P2-S2 Batch 1 (account/login relay GET cluster)
|
||||
|
||||
date: 2026-03-24
|
||||
author: Cline
|
||||
scope: `pages/api/middleware/relayForwarding.js`, `pages/api/endpoint/{getaccounts_api,getemailaccountcheck_api,getpreferredlanguage_api,getlogin_api,getpersonalaccount_api,getportalloginproxy_api}.js`, `tests/phase21/endpoint-handler-contract.test.cjs`
|
||||
type: change
|
||||
rationale: Deliver first P2-S2 batch as a dedicated commit by migrating a bounded account/login endpoint cluster onto shared `relayGet` while preserving response contracts.
|
||||
impact: Reduced relay boilerplate and improved consistency with no intended endpoint contract changes.
|
||||
status: completed
|
||||
|
||||
Summary:
|
||||
|
||||
- Extended `relayGet` to support optional `requestOptionsBuilder` for handlers requiring paged header variants.
|
||||
- Migrated Batch 1 endpoints to `relayGet`:
|
||||
- `getaccounts_api.js`
|
||||
- `getemailaccountcheck_api.js`
|
||||
- `getpreferredlanguage_api.js`
|
||||
- `getlogin_api.js` (uses `azureHeadersPaged` via `requestOptionsBuilder`)
|
||||
- `getpersonalaccount_api.js`
|
||||
- `getportalloginproxy_api.js` (uses `azureHeadersPaged` via `requestOptionsBuilder`)
|
||||
- Updated phase21 endpoint contract tests to mock `relayGet` for migrated handlers, preserving existing guard/catch/success assertions.
|
||||
|
||||
Validation:
|
||||
|
||||
- `node tests/phase21/api-contract-slice1.test.cjs` -> pass
|
||||
- helper: 4/4
|
||||
- file-handler: 53/53
|
||||
- email-handler: 12/12
|
||||
- endpoint-handler: 152/152
|
||||
- documents-handler: 3/3
|
||||
|
||||
Follow-ups:
|
||||
|
||||
- Continue P2-S2 with Batch 2 as next dedicated commit on this same branch.
|
||||
|
||||
---
|
||||
|
||||
### CL-021: TASK22229 P2-S2 Batch 2 (my-portal + representation relay GET cluster)
|
||||
|
||||
date: 2026-03-24
|
||||
author: Cline
|
||||
scope: `pages/api/endpoint/{getmycases_api,getmyrepresentations_api,getwatchedcases_api,getawaitingsubmission_api,getrepresentations_api}.js`, `tests/phase21/endpoint-handler-contract.test.cjs`
|
||||
type: change
|
||||
rationale: Deliver second P2-S2 commit by migrating the next bounded portal/representation GET endpoint cluster onto shared `relayGet` while preserving route contracts.
|
||||
impact: Reduced duplicated relay boilerplate and aligned forwarding behavior with no intended response contract changes.
|
||||
status: completed
|
||||
|
||||
Summary:
|
||||
|
||||
- Migrated Batch 2 endpoints to `relayGet`:
|
||||
- `getmycases_api.js` (preserved title mapping transform)
|
||||
- `getmyrepresentations_api.js`
|
||||
- `getwatchedcases_api.js` (preserved watched-case projection transform)
|
||||
- `getawaitingsubmission_api.js` (preserved title mapping transform)
|
||||
- `getrepresentations_api.js`
|
||||
- Updated phase21 endpoint contract tests for migrated handlers by mocking `relayGet` in guard/catch test paths.
|
||||
|
||||
Validation:
|
||||
|
||||
- `node tests/phase21/api-contract-slice1.test.cjs` -> pass
|
||||
- helper: 4/4
|
||||
- file-handler: 53/53
|
||||
- email-handler: 12/12
|
||||
- endpoint-handler: 152/152
|
||||
- documents-handler: 3/3
|
||||
|
||||
Follow-ups:
|
||||
|
||||
- Continue P2-S2 with Batch 3 as the next dedicated commit on this branch.
|
||||
|
||||
---
|
||||
|
||||
### CL-022: TASK22229 P2-S2 Batch 3 (case/event relay GET cluster)
|
||||
|
||||
date: 2026-03-24
|
||||
author: Cline
|
||||
scope: `pages/api/endpoint/{getcase_api,getcasebyid_api,getincidentbyid_api,getsipsevents_api}.js`, `tests/phase21/endpoint-handler-contract.test.cjs`
|
||||
type: change
|
||||
rationale: Deliver third P2-S2 commit by migrating an additional bounded case/event endpoint cluster onto shared `relayGet` while preserving route contracts.
|
||||
impact: Further relay boilerplate reduction and consistent forwarding behavior with no intended contract changes.
|
||||
status: completed
|
||||
|
||||
Summary:
|
||||
|
||||
- Migrated Batch 3 endpoints to `relayGet`:
|
||||
- `getcase_api.js` (preserved `@odata.nextLink` normalization)
|
||||
- `getcasebyid_api.js` (preserved `@odata.nextLink` normalization and array-wrapped success payload)
|
||||
- `getincidentbyid_api.js`
|
||||
- `getsipsevents_api.js`
|
||||
- Updated phase21 endpoint contract tests to mock `relayGet` for migrated handlers in guard/catch paths.
|
||||
|
||||
Validation:
|
||||
|
||||
- `node tests/phase21/api-contract-slice1.test.cjs` -> pass
|
||||
- helper: 4/4
|
||||
- file-handler: 53/53
|
||||
- email-handler: 12/12
|
||||
- endpoint-handler: 152/152
|
||||
- documents-handler: 3/3
|
||||
|
||||
Follow-ups:
|
||||
|
||||
- Continue P2-S2 with next bounded batch (e.g. search/listing cluster) as a separate commit if required.
|
||||
|
||||
---
|
||||
|
||||
### CL-023: TASK22229 P2-S2 Batch 6 (profile/form/document-history/portal-module relay GET cluster)
|
||||
|
||||
date: 2026-03-24
|
||||
author: Cline
|
||||
scope: `pages/api/endpoint/{getpersonalaccount_api,getformdata_api,getsearchdocumenthistory_api,getsearchdocumenthistorypaged_api,getportalmoduledetails_api}.js`, `tests/phase21/endpoint-handler-contract.test.cjs`
|
||||
type: change
|
||||
rationale: Execute requested Batch 6 by migrating the next bounded set of read-only endpoint handlers to shared `relayGet` while preserving existing request validation and response/error contracts.
|
||||
impact: Reduced endpoint relay boilerplate and improved consistency; no intended behavior contract changes.
|
||||
status: completed
|
||||
|
||||
Summary:
|
||||
|
||||
- Migrated Batch 6 endpoints to shared `relayGet`:
|
||||
- `getpersonalaccount_api.js`
|
||||
- `getformdata_api.js`
|
||||
- `getsearchdocumenthistory_api.js` (uses `requestOptionsBuilder` with `azureHeadersPaged`)
|
||||
- `getsearchdocumenthistorypaged_api.js` (uses `requestOptionsBuilder` with `azureHeadersPaged`)
|
||||
- `getportalmoduledetails_api.js`
|
||||
- Preserved all existing required-query validation guards and existing error codes/messages.
|
||||
- Updated Phase 21 endpoint contract tests to inject `relayGet` mocks for migrated handlers (validation path, catch path, and success path where applicable).
|
||||
|
||||
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:
|
||||
|
||||
- Optional next bounded batch: migrate remaining legacy relay GET handlers in advanced/basic search-document/detail clusters that still use direct axios relay patterns.
|
||||
|
||||
---
|
||||
|
||||
### CL-024: TASK22229 P2-S2 Batch 7 (search-document + portal-proxy relay GET cluster)
|
||||
|
||||
date: 2026-03-24
|
||||
author: Cline
|
||||
scope: `pages/api/endpoint/{getportalmoduledetailsproxy_api,getsearchdocumentTypes_api,getsearchdocumentdetails_api,getsearchdocumentdetailspaged_api,getappealpdfdocuments_api}.js`, `tests/phase21/endpoint-handler-contract.test.cjs`
|
||||
type: change
|
||||
rationale: Continue P2-S2 in bounded commits by migrating a coherent search-document/portal-proxy GET cluster onto shared relay forwarding while preserving existing validation, transforms, and error contracts.
|
||||
impact: Reduced duplicate relay plumbing and improved consistency in search-document handlers; no intended API contract changes.
|
||||
status: completed
|
||||
|
||||
Summary:
|
||||
|
||||
- Migrated Batch 7 endpoints to shared `relayGet`:
|
||||
- `getportalmoduledetailsproxy_api.js`
|
||||
- `getsearchdocumentTypes_api.js`
|
||||
- `getsearchdocumentdetails_api.js`
|
||||
- `getsearchdocumentdetailspaged_api.js`
|
||||
- `getappealpdfdocuments_api.js`
|
||||
- Preserved existing guard behavior and error response contracts.
|
||||
- Preserved endpoint-specific transform behavior via `transformData`, including:
|
||||
- grouped search-document type payloads
|
||||
- document hashlink enrichment and published-date normalization
|
||||
- `@odata.nextLink` normalization where present
|
||||
- appeal PDF document name projection
|
||||
- Updated phase21 endpoint tests to mock `relayGet` for migrated handlers in validation/catch/success paths as applicable.
|
||||
|
||||
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 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`).
|
||||
|
||||
---
|
||||
|
||||
### CL-026: TASK22229 P2-S2 Batch 9 (appeal-id + DNS list/paged + part-saved relay GET cluster)
|
||||
|
||||
date: 2026-03-24
|
||||
author: Cline
|
||||
scope: `pages/api/endpoint/{getappealid_api,getbasicdnssearchpaged_api,getbasicpartsaveddetails_api,getdnslist_api}.js`, `tests/phase21/endpoint-handler-contract.test.cjs`
|
||||
type: change
|
||||
rationale: Continue bounded P2-S2 relay migration by moving another coherent set of read-only handlers to shared `relayGet`, preserving existing guards, transforms, and error contracts.
|
||||
impact: Reduced duplicated relay plumbing and improved consistency for DNS list/paged and appeal detail lookup endpoints; no intended API contract changes.
|
||||
status: completed
|
||||
|
||||
Summary:
|
||||
|
||||
- Migrated Batch 9 endpoints to shared `relayGet`:
|
||||
- `getappealid_api.js`
|
||||
- `getbasicdnssearchpaged_api.js`
|
||||
- `getbasicpartsaveddetails_api.js`
|
||||
- `getdnslist_api.js`
|
||||
- Preserved existing input validation guards and endpoint-specific error contracts.
|
||||
- Preserved endpoint-specific transform behavior (`@odata.nextLink` normalization in DNS list/paged handlers).
|
||||
- Updated phase21 endpoint contract tests to inject `relayGet` mocks for these migrated handlers in guard and catch-path assertions.
|
||||
|
||||
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 relay GET endpoints (`createwatchedcases_api`, `deletewatchedcasesproxy_api`, `getadvancedsearch_api`, `getadvancedsearchpaged_api`, `getbasicsearch_by_address_api`, `getbasicsearch_by_lparref_api`, `getdnscoords_api`, `getmylpacases_api`, `getportallogin_api`).
|
||||
|
||||
---
|
||||
|
||||
### CL-027: TASK22229 P2-S2 Batch 10 (portal login + my LPA cases relay GET pair)
|
||||
|
||||
date: 2026-03-24
|
||||
author: Cline
|
||||
scope: `pages/api/endpoint/{getportallogin_api,getmylpacases_api}.js`, `tests/phase21/endpoint-handler-contract.test.cjs`
|
||||
type: change
|
||||
rationale: Continue bounded relay migration by moving two remaining high-use portal retrieval endpoints to shared `relayGet` while preserving existing hash/lookup guards and response contracts.
|
||||
impact: Further relay boilerplate reduction and consistent forwarding behavior in portal login/LPA case retrieval flows; no intended API contract changes.
|
||||
status: completed
|
||||
|
||||
Summary:
|
||||
|
||||
- Migrated Batch 10 endpoints to shared `relayGet`:
|
||||
- `getportallogin_api.js` (preserved hash validation guard and error contract)
|
||||
- `getmylpacases_api.js` (preserved LPA lookup/404 guard and title transform)
|
||||
- Preserved endpoint-specific behavior:
|
||||
- `getportallogin_api`: raw + encoded hash candidate validation before relay call
|
||||
- `getmylpacases_api`: JSONPath LPA lookup with `LPA_NOT_FOUND` handling and `pinswg_title` enrichment transform
|
||||
- Updated phase21 endpoint contract tests to inject `relayGet` mocks for migrated handlers in validation/catch/success paths.
|
||||
|
||||
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 the remaining legacy relay GET candidates (`createwatchedcases_api`, `deletewatchedcasesproxy_api`, `getadvancedsearch_api`, `getadvancedsearchpaged_api`, `getbasicsearch_by_address_api`, `getbasicsearch_by_lparref_api`, `getdnscoords_api`).
|
||||
|
||||
---
|
||||
|
||||
### CL-028: TASK22229 P2-S2 Batch 11 (advanced-search-paged relay GET)
|
||||
|
||||
date: 2026-03-24
|
||||
author: Cline
|
||||
scope: `pages/api/endpoint/getadvancedsearchpaged_api.js`, `tests/phase21/endpoint-handler-contract.test.cjs`
|
||||
type: change
|
||||
rationale: Continue bounded relay migration by moving the remaining advanced-search paged GET handler to shared `relayGet` while preserving query validation and response contracts.
|
||||
impact: Reduced duplicated relay plumbing and aligned advanced paged search route with shared forwarding; no intended API contract changes.
|
||||
status: completed
|
||||
|
||||
Summary:
|
||||
|
||||
- Migrated `getadvancedsearchpaged_api.js` to shared `relayGet`.
|
||||
- Preserved existing guard behavior and error contracts:
|
||||
- `SEARCH_STRING_REQUIRED`
|
||||
- `ORDER_BY_REQUIRED`
|
||||
- `FIELD_SORT_REQUIRED`
|
||||
- `SHOW_NUMBER_OF_RECORDS_REQUIRED`
|
||||
- `INVALID_SEARCH_STRING`
|
||||
- `ADVANCED_SEARCH_PAGED_FETCH_FAILED`
|
||||
- Preserved endpoint-specific transform behavior (`@odata.nextLink` normalization via `transformData`).
|
||||
- Updated phase21 endpoint contract tests to inject `relayGet` mocks for `getadvancedsearchpaged_api` guard/catch assertions.
|
||||
|
||||
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 remaining legacy relay GET candidates (`createwatchedcases_api`, `deletewatchedcasesproxy_api`, `getadvancedsearch_api`, `getbasicsearch_by_address_api`, `getbasicsearch_by_lparref_api`, `getdnscoords_api`).
|
||||
|
||||
---
|
||||
|
||||
### CL-029: TASK22229 P2-S2 Batch 12 (remaining relay GET candidates)
|
||||
|
||||
date: 2026-03-24
|
||||
author: Cline
|
||||
scope: `pages/api/middleware/relayForwarding.js`, `pages/api/endpoint/{createwatchedcases_api,deletewatchedcasesproxy_api,getadvancedsearch_api,getbasicsearch_by_address_api,getbasicsearch_by_lparref_api,getdnscoords_api}.js`, `tests/phase21/endpoint-handler-contract.test.cjs`
|
||||
type: change
|
||||
rationale: Complete Batch 12 by migrating the remaining listed legacy relay GET candidates to shared forwarding helpers while preserving endpoint-specific validation, transforms, and error contracts.
|
||||
impact: Consolidated relay GET behavior and reduced endpoint-level relay boilerplate; no intended API contract changes.
|
||||
status: completed
|
||||
|
||||
Summary:
|
||||
|
||||
- Extended relay middleware with reusable helpers:
|
||||
- `relayGetData` now supports token reuse via `transformData` path
|
||||
- Added `forwardGetData` to support custom base URLs (used by proxy-to-local endpoint) while preserving hash behavior
|
||||
- Migrated remaining Batch 12 candidates:
|
||||
- `getadvancedsearch_api.js` -> `relayGet` + `relayGetData` for project-type enrichment loop
|
||||
- `getdnscoords_api.js` -> `relayGetData` for both DNS + SIPS source pulls
|
||||
- `getbasicsearch_by_lparref_api.js` -> `relayGetData`
|
||||
- `getbasicsearch_by_address_api.js` -> `relayGetData` for appeal-type and incident fetches
|
||||
- `deletewatchedcasesproxy_api.js` -> `forwardGetData` with `BASE_URL`
|
||||
- `createwatchedcases_api.js` -> `relayGetData` for record-exists pre-check (POST/PATCH upsert flow preserved)
|
||||
- Preserved endpoint-specific guard and error contracts (including status codes such as 500 for `BASIC_SEARCH_BY_ADDRESS_FETCH_FAILED`).
|
||||
- Updated phase21 endpoint contract tests for migrated handlers to mock `relayGetData` / `forwardGetData` where appropriate.
|
||||
|
||||
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:
|
||||
|
||||
- Batch 12 completes the previously listed remaining P2-S2 relay GET candidates.
|
||||
|
||||
@@ -63,10 +63,15 @@ export default async function ApiProxy(req, res) {
|
||||
const notifyClient = new NotifyClient(process.env.NOTIFY_API_KEY);
|
||||
//const emailReplyToId = process.env.EMAIL_REPLY_TO_ID;
|
||||
|
||||
consoleLogger({
|
||||
event: "notify_send_attempt",
|
||||
payload: redactSensitive(data)
|
||||
});
|
||||
console.info(
|
||||
"notify_send_attempt",
|
||||
redactSensitive({
|
||||
templateId: data.templateId,
|
||||
emailAddress: data.emailAddress,
|
||||
reference: data.reference,
|
||||
personalisation: data.personalisation
|
||||
})
|
||||
);
|
||||
|
||||
try {
|
||||
await notifyClient.sendEmail(data.templateId, data.emailAddress, {
|
||||
|
||||
@@ -15,26 +15,30 @@ import { consoleLogger } from "../../../actions/core/logger";
|
||||
import { getToken } from "../../../actions/core/token";
|
||||
import { hashAPIPath } from "../../../actions/core/hash";
|
||||
import { respondError, respondSuccess } from "../middleware/apiResponse";
|
||||
import { relayGetData } from "../middleware/relayForwarding";
|
||||
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
const recordExists = async (incidentId, contactId, token) => {
|
||||
const recordExists = async (incidentId, contactId, accessToken) => {
|
||||
const filter = `$filter=pinswg_WatchedCase/incidentid eq ${incidentId} and pinswg_Contact/contactid eq ${contactId}`;
|
||||
const queryUrl = `pinswg_watchlists?${filter}`;
|
||||
const url = WEBAPI_URL + queryUrl + hashAPIPath(queryUrl);
|
||||
|
||||
try {
|
||||
const res = await axios.get(url, {
|
||||
headers: {
|
||||
Authorization: "Bearer " + token.access_token,
|
||||
Accept: "application/json"
|
||||
}
|
||||
const response = await relayGetData({
|
||||
queryUrl,
|
||||
accessToken,
|
||||
requestOptionsBuilder: (token) => ({
|
||||
headers: {
|
||||
Authorization: "Bearer " + token,
|
||||
Accept: "application/json"
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
if (res.data.value && res.data.value.length > 0) {
|
||||
return res.data.value[0]; // return the existing record
|
||||
if (response.data.value && response.data.value.length > 0) {
|
||||
return response.data.value[0]; // return the existing record
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -79,7 +83,11 @@ export default async function ApiProxy(req, res) {
|
||||
const incidentId = watchedCaseMatch[1];
|
||||
const contactId = contactMatch[1];
|
||||
|
||||
const existingRecord = await recordExists(incidentId, contactId, token);
|
||||
const existingRecord = await recordExists(
|
||||
incidentId,
|
||||
contactId,
|
||||
token.access_token
|
||||
);
|
||||
|
||||
let method, queryUrl;
|
||||
|
||||
|
||||
@@ -17,16 +17,10 @@
|
||||
* 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 { 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 { forwardGetData } from "../middleware/relayForwarding";
|
||||
|
||||
const BASE_URL = process.env.API_ROOT || "http://localhost:3000";
|
||||
|
||||
@@ -45,15 +39,15 @@ export default async function ApiProxy(req, res) {
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"/api/endpoint/deletewatchedcases_api?watchedCaseID=" +
|
||||
watchedCaseID;
|
||||
|
||||
const { data } = await axios.get(
|
||||
BASE_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
);
|
||||
const { data } = await forwardGetData({
|
||||
baseUrl: BASE_URL,
|
||||
queryUrl,
|
||||
requestOptionsBuilder: (accessToken) => azureHeaders(accessToken)
|
||||
});
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
|
||||
@@ -15,16 +15,8 @@
|
||||
* 200:
|
||||
* description: hello world
|
||||
*/
|
||||
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 { respondError } from "../middleware/apiResponse";
|
||||
import { relayGet } from "../middleware/relayForwarding";
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
const emailAddress = req.query.emailAddress;
|
||||
@@ -37,24 +29,18 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"contacts?$filter=emailaddress1 eq '" +
|
||||
emailAddress +
|
||||
"'&$count=true&$select=emailaddress1, contactid";
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
);
|
||||
const queryUrl =
|
||||
"contacts?$filter=emailaddress1 eq '" +
|
||||
emailAddress +
|
||||
"'&$count=true&$select=emailaddress1, contactid";
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "ACCOUNTS_FETCH_FAILED",
|
||||
message: "Failed to fetch accounts"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -21,16 +21,10 @@
|
||||
* description: Success
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import { azureHeadersPaged } 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 { relayGet, relayGetData } from "../middleware/relayForwarding";
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
const encodedSearchString = req.query.searchstring;
|
||||
@@ -109,62 +103,63 @@ export default async function ApiProxy(req, res) {
|
||||
queryString +
|
||||
" pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
);
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(data, "@odata.nextLink")) {
|
||||
const dataStr = JSON.stringify(data["@odata.nextLink"]);
|
||||
data["@odata.nextLink"] = dataStr.split("/v8.2/")[1];
|
||||
}
|
||||
|
||||
if (searchString.projecttype != null) {
|
||||
for (let i = 0; i < data.value.length; i++) {
|
||||
const item = data.value[i];
|
||||
|
||||
try {
|
||||
const projectTypeQuery =
|
||||
"pinswg_sipses?$filter=_pinswg_sipscase_value eq " +
|
||||
item.incidentid +
|
||||
" and _pinswg_projecttype_value eq " +
|
||||
searchString.projecttype +
|
||||
"&$select=_pinswg_projecttype_value";
|
||||
|
||||
const response = await axios.get(
|
||||
WEBAPI_URL +
|
||||
projectTypeQuery +
|
||||
hashAPIPath(projectTypeQuery),
|
||||
azureHeadersPaged(token.access_token)
|
||||
);
|
||||
|
||||
if (
|
||||
response.data.value.length > 0 &&
|
||||
response.data.value[0]._pinswg_projecttype_value != null
|
||||
) {
|
||||
Object.assign(item, response.data.value[0]);
|
||||
}
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
}
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) => azureHeadersPaged(accessToken),
|
||||
transformData: async (data, accessToken) => {
|
||||
if (Object.prototype.hasOwnProperty.call(data, "@odata.nextLink")) {
|
||||
const dataStr = JSON.stringify(data["@odata.nextLink"]);
|
||||
data["@odata.nextLink"] = dataStr.split("/v8.2/")[1];
|
||||
}
|
||||
|
||||
data.value = data.value.filter(
|
||||
(item) => item._pinswg_projecttype_value != null
|
||||
);
|
||||
if (searchString.projecttype != null) {
|
||||
for (let i = 0; i < data.value.length; i++) {
|
||||
const item = data.value[i];
|
||||
|
||||
data["@odata.count"] = data.value.length;
|
||||
}
|
||||
try {
|
||||
const projectTypeQuery =
|
||||
"pinswg_sipses?$filter=_pinswg_sipscase_value eq " +
|
||||
item.incidentid +
|
||||
" and _pinswg_projecttype_value eq " +
|
||||
searchString.projecttype +
|
||||
"&$select=_pinswg_projecttype_value";
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
const projectTypeResponse = await relayGetData({
|
||||
queryUrl: projectTypeQuery,
|
||||
accessToken,
|
||||
requestOptionsBuilder: (token) =>
|
||||
azureHeadersPaged(token)
|
||||
});
|
||||
|
||||
if (
|
||||
projectTypeResponse.data.value.length > 0 &&
|
||||
projectTypeResponse.data.value[0]
|
||||
._pinswg_projecttype_value != null
|
||||
) {
|
||||
Object.assign(
|
||||
item,
|
||||
projectTypeResponse.data.value[0]
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
}
|
||||
}
|
||||
|
||||
data.value = data.value.filter(
|
||||
(item) => item._pinswg_projecttype_value != null
|
||||
);
|
||||
|
||||
data["@odata.count"] = data.value.length;
|
||||
}
|
||||
|
||||
return data;
|
||||
},
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "ADVANCED_SEARCH_FETCH_FAILED",
|
||||
message: "Failed to fetch advanced search results"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -47,17 +47,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) {
|
||||
const rawSearchString = req.query.searchstring;
|
||||
@@ -180,81 +173,23 @@ export default async function ApiProxy(req, res) {
|
||||
: "");
|
||||
}
|
||||
|
||||
console.log("adv qu: ", queryUrl);
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) =>
|
||||
azureHeadersPagedCustom(accessToken, showNumberOfRecords),
|
||||
transformData: (data) => {
|
||||
let dataStr;
|
||||
_.has(data, "@odata.nextLink") === true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPagedCustom(token.access_token, showNumberOfRecords)
|
||||
);
|
||||
|
||||
let dataStr;
|
||||
_.has(data, "@odata.nextLink") === true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
|
||||
if (_.has(searchString, "projecttype")) {
|
||||
// await updateValueArray(data, token);
|
||||
// async function updateValueArray(data, token) {
|
||||
// for (let i = 0; i < data.value.length; i++) {
|
||||
// const item = data.value[i];
|
||||
// try {
|
||||
// // Axios call using the `incidentid` to fetch additional data
|
||||
// const response = await axios.get(
|
||||
// WEBAPI_URL +
|
||||
// "pinswg_sipses?$filter=_pinswg_sipscase_value eq " +
|
||||
// item.incidentid +
|
||||
// " and _pinswg_projecttype_value eq " +
|
||||
// searchString.projecttype +
|
||||
// "&$select=_pinswg_projecttype_value" +
|
||||
// hashAPIPath(
|
||||
// "pinswg_sipses?$filter=_pinswg_sipscase_value eq " +
|
||||
// item.incidentid +
|
||||
// " and _pinswg_projecttype_value eq " +
|
||||
// searchString.projecttype +
|
||||
// "&$select=_pinswg_projecttype_value"
|
||||
// ),
|
||||
// azureHeadersPaged(token.access_token)
|
||||
// );
|
||||
// // Assuming the response contains the additional data you want to add
|
||||
// // console.log(response.data.value[0]);
|
||||
// console.log(response.data.value);
|
||||
// if (
|
||||
// response.data.value.length > 0 &&
|
||||
// response.data.value[0]
|
||||
// ._pinswg_projecttype_value != null
|
||||
// ) {
|
||||
// Object.assign(
|
||||
// item,
|
||||
// response.data.value[0]
|
||||
// ); // Update item with new data
|
||||
// } else {
|
||||
// console.log(
|
||||
// `No project type found for incident ID ${item.incidentid}`
|
||||
// );
|
||||
// }
|
||||
// } catch (error) {
|
||||
// console.error(
|
||||
// `Error fetching data for incident ID ${item.incidentid}:`,
|
||||
// error
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// data.value = data.value.filter(
|
||||
// (item) => item._pinswg_projecttype_value != null
|
||||
// );
|
||||
// data["@odata.count"] = data.value.length;
|
||||
}
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return data;
|
||||
},
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "ADVANCED_SEARCH_PAGED_FETCH_FAILED",
|
||||
message: "Failed to fetch advanced search paged results"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -28,16 +28,9 @@
|
||||
* 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 { 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;
|
||||
@@ -77,30 +70,24 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const escapedCaseReference = caseReference.split("'").join("''");
|
||||
const escapedCaseReference = caseReference.split("'").join("''");
|
||||
|
||||
const queryUrl =
|
||||
updateFormCollection +
|
||||
"?$count=true&$select=_" +
|
||||
primaryAttribute +
|
||||
"s_value&$filter=pinswg_name eq '" +
|
||||
escapedCaseReference +
|
||||
"'";
|
||||
const queryUrl =
|
||||
updateFormCollection +
|
||||
"?$count=true&$select=_" +
|
||||
primaryAttribute +
|
||||
"s_value&$filter=pinswg_name eq '" +
|
||||
escapedCaseReference +
|
||||
"'";
|
||||
|
||||
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: "APPEAL_ID_FETCH_FAILED",
|
||||
message: "Failed to fetch appeal id"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,16 +16,9 @@
|
||||
* 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 { 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";
|
||||
|
||||
const groupArray = (arr) => {
|
||||
const map = new Map();
|
||||
@@ -67,41 +60,26 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"pinswg_documents?$count=true&$filter=_pinswg_documentids_value eq " +
|
||||
incidentID +
|
||||
" and not(contains(pinswg_name,'_Appeal_Form.pdf'))&$select=pinswg_name,pinswg_isharedocumentlocations";
|
||||
|
||||
const queryUrl =
|
||||
"pinswg_documents?$count=true&$filter=_pinswg_documentids_value eq " +
|
||||
incidentID +
|
||||
" and not(contains(pinswg_name,'_Appeal_Form.pdf'))&$select=pinswg_name,pinswg_isharedocumentlocations";
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) => azureHeaders(accessToken),
|
||||
transformData: (data) => {
|
||||
data.value.forEach((item) => {
|
||||
item.name = item.pinswg_name;
|
||||
});
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
);
|
||||
// //delete data["pinswg_documentid"];
|
||||
// data.value.forEach(function (element) {
|
||||
// delete element["pinswg_documentid"];
|
||||
// });
|
||||
|
||||
// var dataArr = groupArray(data.value);
|
||||
|
||||
// // var dataStr;
|
||||
// // _.has(data, "@odata.nextLink") == true &&
|
||||
// // ((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
// // (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
|
||||
data.value.forEach((item) => {
|
||||
item.name = item.pinswg_name;
|
||||
});
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return data;
|
||||
},
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "APPEAL_PDF_DOCUMENTS_FETCH_FAILED",
|
||||
message: "Failed to fetch appeal PDF documents"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,46 +9,30 @@
|
||||
* 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 { 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) {
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' " +
|
||||
(process.env.SHOWSIPS !== "true"
|
||||
? "and attributevalue ne 846040002"
|
||||
: "") +
|
||||
"&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
|
||||
|
||||
const queryUrl =
|
||||
"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' " +
|
||||
(process.env.SHOWSIPS !== "true"
|
||||
? "and attributevalue ne 846040002"
|
||||
: "") +
|
||||
"&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
|
||||
// for sips
|
||||
// "stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
|
||||
|
||||
// for sips
|
||||
// "stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
|
||||
// "stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' 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";
|
||||
|
||||
// "stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' 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";
|
||||
|
||||
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,
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "APPEAL_TYPES_FETCH_FAILED",
|
||||
message: "Failed to fetch appeal types"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -17,16 +17,8 @@
|
||||
* 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 { 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 loggedInUserId = req.query.loggedInUserId;
|
||||
@@ -42,30 +34,25 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"incidents?$select=pinswg_environmentalstatementlocation,modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_lpareference,pinswg_appellantlastname,pinswg_appellantfirstname,pinswg_appellantagent,pinswg_agentfirstname,pinswg_agentlastname,pinswg_agentcompanyname&$expand=primarycontactid($select=fullname)&$filter=_customerid_value eq " +
|
||||
loggedInUserId +
|
||||
" and servicestage eq 1 and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true";
|
||||
|
||||
const queryUrl =
|
||||
"incidents?$select=pinswg_environmentalstatementlocation,modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_lpareference,pinswg_appellantlastname,pinswg_appellantfirstname,pinswg_appellantagent,pinswg_agentfirstname,pinswg_agentlastname,pinswg_agentcompanyname&$expand=primarycontactid($select=fullname)&$filter=_customerid_value eq " +
|
||||
loggedInUserId +
|
||||
" and servicestage eq 1 and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true";
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
transformData: (data) => {
|
||||
data.value.forEach(function (element) {
|
||||
element.pinswg_title = element.title;
|
||||
});
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
);
|
||||
|
||||
data.value.forEach(function (element) {
|
||||
element.pinswg_title = element.title;
|
||||
});
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return data;
|
||||
},
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "AWAITING_SUBMISSION_FETCH_FAILED",
|
||||
message: "Failed to fetch awaiting submissions"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,16 +10,8 @@
|
||||
* 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 { 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 loggedInUserId = req.query.loggedInUserId;
|
||||
@@ -35,29 +27,25 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"incidents?$select=pinswg_environmentalstatementlocation,modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_lpareference,pinswg_appellantlastname,pinswg_appellantfirstname,pinswg_appellantagent,pinswg_agentfirstname,pinswg_agentlastname,pinswg_agentcompanyname&$expand=primarycontactid($select=fullname)&$filter=_customerid_value eq " +
|
||||
loggedInUserId +
|
||||
" and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true";
|
||||
const queryUrl =
|
||||
"incidents?$select=pinswg_environmentalstatementlocation,modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_lpareference,pinswg_appellantlastname,pinswg_appellantfirstname,pinswg_appellantagent,pinswg_agentfirstname,pinswg_agentlastname,pinswg_agentcompanyname&$expand=primarycontactid($select=fullname)&$filter=_customerid_value eq " +
|
||||
loggedInUserId +
|
||||
" and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true";
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
);
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
transformData: (data) => {
|
||||
data.value.forEach(function (element) {
|
||||
element.pinswg_title = element.title;
|
||||
});
|
||||
|
||||
data.value.forEach(function (element) {
|
||||
element.pinswg_title = element.title;
|
||||
});
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return data;
|
||||
},
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "AWAITING_SUBMISSION_PROXY_FETCH_FAILED",
|
||||
message: "Failed to fetch awaiting submission proxy details"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,42 +16,31 @@
|
||||
* 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 { 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) {
|
||||
try {
|
||||
const token = await getToken();
|
||||
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&$expand=primarycontactid($select=fullname)&$filter=(pinswg_appealcasetype eq 846040011 or pinswg_appealcasetype eq 846040002)and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||
|
||||
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&$expand=primarycontactid($select=fullname)&$filter=(pinswg_appealcasetype eq 846040011 or pinswg_appealcasetype eq 846040002)and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||
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_FETCH_FAILED",
|
||||
message: "Failed to fetch basic DNS search results"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -42,17 +42,10 @@
|
||||
* description: Success
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import _ from "lodash";
|
||||
import { azureHeadersPagedCustom } from "../../../actions/core/headers";
|
||||
import { getToken } from "../../../actions/core/token";
|
||||
import { consoleLogger } from "../../../actions/core/logger";
|
||||
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 pageNumber = req.query.pageNumber;
|
||||
@@ -87,36 +80,33 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
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&$expand=primarycontactid($select=fullname)&$filter=(pinswg_appealcasetype eq 846040011 or pinswg_appealcasetype eq 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&$expand=primarycontactid($select=fullname)&$filter=(pinswg_appealcasetype eq 846040011 or pinswg_appealcasetype eq 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_DNS_SEARCH_PAGED_FETCH_FAILED",
|
||||
message: "Failed to fetch paged basic DNS search results"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,17 +16,10 @@
|
||||
* 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 { 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 searchString = req.query.searchString;
|
||||
@@ -39,34 +32,31 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const escapedSearchString = searchString.replace(/\'/g, "''");
|
||||
const escapedSearchString = searchString.replace(/\'/g, "''");
|
||||
|
||||
const queryUrl =
|
||||
"incidents?$select=pinswg_environmentalstatementlocation,modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_lpareference&$expand=primarycontactid($select=fullname)&$filter=(contains(title, '" +
|
||||
escapedSearchString +
|
||||
"') or contains(ticketnumber, '" +
|
||||
escapedSearchString +
|
||||
"')) and (pinswg_appealcasetype eq 846040011 or pinswg_appealcasetype eq 846040002 ) and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||
const queryUrl =
|
||||
"incidents?$select=pinswg_environmentalstatementlocation,modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_lpareference&$expand=primarycontactid($select=fullname)&$filter=(contains(title, '" +
|
||||
escapedSearchString +
|
||||
"') or contains(ticketnumber, '" +
|
||||
escapedSearchString +
|
||||
"')) and (pinswg_appealcasetype eq 846040011 or pinswg_appealcasetype eq 846040002 ) and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
);
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) => azureHeadersPaged(accessToken),
|
||||
transformData: (data) => {
|
||||
let dataStr;
|
||||
_.has(data, "@odata.nextLink") === true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
|
||||
let dataStr;
|
||||
_.has(data, "@odata.nextLink") === true &&
|
||||
((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_URL_SEARCH_FETCH_FAILED",
|
||||
message: "Failed to fetch DNS URL search results"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
import axios from "axios";
|
||||
import { azureHeadersNoOdata } 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) {
|
||||
const appealTypeName = req.query.appealTypeName;
|
||||
@@ -44,29 +37,23 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
appealTypeName +
|
||||
"?$filter=_" +
|
||||
primaryIdAttribute +
|
||||
"s_value eq " +
|
||||
incidentID +
|
||||
"&$count=true";
|
||||
|
||||
const queryUrl =
|
||||
appealTypeName +
|
||||
"?$filter=_" +
|
||||
primaryIdAttribute +
|
||||
"s_value eq " +
|
||||
incidentID +
|
||||
"&$count=true";
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersNoOdata(token.access_token)
|
||||
);
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) =>
|
||||
azureHeadersNoOdata(accessToken),
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "BASIC_PART_SAVED_DETAILS_FETCH_FAILED",
|
||||
message: "Failed to fetch basic part-saved details"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -15,16 +15,9 @@
|
||||
* description: Success
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import { azureHeadersPaged } 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) {
|
||||
const searchString = req.query.searchString;
|
||||
@@ -37,40 +30,37 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const escapedSearchString = searchString.replace(/\'/g, "''");
|
||||
const escapedSearchString = 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, '" +
|
||||
escapedSearchString +
|
||||
"') or contains(ticketnumber, '" +
|
||||
escapedSearchString +
|
||||
"') or contains(pinswg_lpareference, '" +
|
||||
escapedSearchString +
|
||||
"')) and pinswg_appealcasetype ne null " +
|
||||
(process.env.SHOWSIPS !== "true"
|
||||
? "and pinswg_appealcasetype ne 846040002 "
|
||||
: "") +
|
||||
"and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||
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, '" +
|
||||
escapedSearchString +
|
||||
"') or contains(ticketnumber, '" +
|
||||
escapedSearchString +
|
||||
"') or contains(pinswg_lpareference, '" +
|
||||
escapedSearchString +
|
||||
"')) and pinswg_appealcasetype ne null " +
|
||||
(process.env.SHOWSIPS !== "true"
|
||||
? "and pinswg_appealcasetype ne 846040002 "
|
||||
: "") +
|
||||
"and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
);
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) => azureHeadersPaged(accessToken),
|
||||
transformData: (data) => {
|
||||
if (Object.prototype.hasOwnProperty.call(data, "@odata.nextLink")) {
|
||||
const dataStr = JSON.stringify(data["@odata.nextLink"]);
|
||||
data["@odata.nextLink"] = dataStr.split("/v8.2/")[1];
|
||||
}
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(data, "@odata.nextLink")) {
|
||||
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_FETCH_FAILED",
|
||||
message: "Failed to fetch basic search results"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) => ({
|
||||
|
||||
@@ -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"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,17 +10,9 @@
|
||||
* 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 { 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 incidentID = req.query.incidentID;
|
||||
@@ -33,30 +25,26 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"incidents(" +
|
||||
incidentID +
|
||||
")?$select=ticketnumber,title,pinswg_appealcasetype";
|
||||
const queryUrl =
|
||||
"incidents(" +
|
||||
incidentID +
|
||||
")?$select=ticketnumber,title,pinswg_appealcasetype";
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
);
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
transformData: (data) => {
|
||||
if (_.has(data, "@odata.nextLink") === true) {
|
||||
const dataStr = JSON.stringify(data["@odata.nextLink"]);
|
||||
data["@odata.nextLink"] = dataStr.split("/v8.2/")[1];
|
||||
}
|
||||
|
||||
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: "CASE_FETCH_FAILED",
|
||||
message: "Failed to fetch case"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,17 +10,9 @@
|
||||
* 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 { 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 incidentID = req.query.incidentID;
|
||||
@@ -33,27 +25,23 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl = "incidents(" + incidentID + ")";
|
||||
const queryUrl = "incidents(" + incidentID + ")";
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
);
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
transformData: (data) => {
|
||||
if (_.has(data, "@odata.nextLink") === true) {
|
||||
const dataStr = JSON.stringify(data["@odata.nextLink"]);
|
||||
data["@odata.nextLink"] = dataStr.split("/v8.2/")[1];
|
||||
}
|
||||
|
||||
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: "CASE_BY_ID_FETCH_FAILED",
|
||||
message: "Failed to fetch case by id"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -15,16 +15,9 @@
|
||||
* description: Success
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import { azureHeadersPaged } 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) {
|
||||
const caseId = req.query.id;
|
||||
@@ -37,26 +30,19 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"tasks?$select=_regardingobjectid_value,subject,description,createdon,statuscode,scheduledend,scheduledstart&$count=true&$filter=_regardingobjectid_value eq " +
|
||||
caseId +
|
||||
" and contains(subject, 'Banner') and statuscode ne 5&$orderby=createdon desc";
|
||||
|
||||
const queryUrl =
|
||||
"tasks?$select=_regardingobjectid_value,subject,description,createdon,statuscode,scheduledend,scheduledstart&$count=true&$filter=_regardingobjectid_value eq " +
|
||||
caseId +
|
||||
" and contains(subject, 'Banner') and statuscode ne 5&$orderby=createdon desc";
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
);
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) => azureHeadersPaged(accessToken),
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "CASE_MESSAGE_FETCH_FAILED",
|
||||
message: "Failed to fetch case messages"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
import axios from "axios";
|
||||
import { azureHeaders } from "../../../actions/core/headers";
|
||||
import { consoleLogger } from "../../../actions/core/logger";
|
||||
import { getToken } from "../../../actions/core/token";
|
||||
import OSPoint from "ospoint";
|
||||
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 renameKeys = (obj) => {
|
||||
const keyMappings = {
|
||||
@@ -75,8 +68,6 @@ const keysToRemove = [
|
||||
];
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
const token = await getToken();
|
||||
|
||||
const queryUrl =
|
||||
"pinswg_dnses?$select=pinswg_projectlocation,pinswg_mapzoomlevel,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";
|
||||
|
||||
@@ -87,11 +78,8 @@ export default async function ApiProxy(req, res) {
|
||||
const coordsObj = { value: [] };
|
||||
|
||||
try {
|
||||
// First Axios request
|
||||
const dnsCoordsObj = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
);
|
||||
// First relay request
|
||||
const dnsCoordsObj = await relayGetData({ queryUrl });
|
||||
// Merge the first response's 'value' array into the coordsObj's value array
|
||||
if (Array.isArray(dnsCoordsObj.data.value)) {
|
||||
coordsObj.value = coordsObj.value.concat(dnsCoordsObj.data.value); // Concatenate arrays
|
||||
@@ -99,11 +87,8 @@ export default async function ApiProxy(req, res) {
|
||||
coordsObj.value.push(dnsCoordsObj.data.value); // Push single value if it's not an array
|
||||
}
|
||||
|
||||
// Second Axios request
|
||||
const sipsCoordsObj = await axios.get(
|
||||
WEBAPI_URL + queryUrlSips + hashAPIPath(queryUrlSips),
|
||||
azureHeaders(token.access_token)
|
||||
);
|
||||
// Second relay request
|
||||
const sipsCoordsObj = await relayGetData({ queryUrl: queryUrlSips });
|
||||
// Merge the second response's 'value' array into the coordsObj's value array
|
||||
if (Array.isArray(sipsCoordsObj.data.value)) {
|
||||
coordsObj.value = coordsObj.value.concat(sipsCoordsObj.data.value); // Concatenate arrays
|
||||
|
||||
@@ -1,40 +1,29 @@
|
||||
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 { 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) {
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"incidents?$select=pinswg_environmentalstatementlocation,pinswg_appealcasetype,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,statuscode,ticketnumber,title &$filter=(pinswg_appealcasetype eq 846040011 or pinswg_appealcasetype eq 846040002) and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||
|
||||
const queryUrl =
|
||||
"incidents?$select=pinswg_environmentalstatementlocation,pinswg_appealcasetype,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,statuscode,ticketnumber,title &$filter=(pinswg_appealcasetype eq 846040011 or pinswg_appealcasetype eq 846040002) and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) => azureHeaders(accessToken),
|
||||
transformData: (data) => {
|
||||
let dataStr;
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
);
|
||||
_.has(data, "@odata.nextLink") === true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
|
||||
let dataStr;
|
||||
|
||||
_.has(data, "@odata.nextLink") === true &&
|
||||
((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: "DNS_LIST_FETCH_FAILED",
|
||||
message: "Failed to fetch DNS list"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -15,16 +15,8 @@
|
||||
* 200:
|
||||
* description: hello world
|
||||
*/
|
||||
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 { respondError } from "../middleware/apiResponse";
|
||||
import { relayGet } from "../middleware/relayForwarding";
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
const emailAddress = req.query.emailAddress;
|
||||
@@ -37,24 +29,18 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"contacts?$filter=emailaddress1 eq '" +
|
||||
emailAddress +
|
||||
"'&$count=true&$select=emailaddress1, contactid";
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
);
|
||||
const queryUrl =
|
||||
"contacts?$filter=emailaddress1 eq '" +
|
||||
emailAddress +
|
||||
"'&$count=true&$select=emailaddress1, contactid";
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "EMAIL_ACCOUNT_CHECK_FAILED",
|
||||
message: "Failed to check email account"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
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 { respondError } from "../middleware/apiResponse";
|
||||
import { relayGet } from "../middleware/relayForwarding";
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
const whichForm = req.query.whichForm;
|
||||
@@ -20,26 +12,18 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"systemforms?$select=formid,name,formxml,type,objecttypecode&$filter=(objecttypecode eq 'pinswg_" +
|
||||
whichForm +
|
||||
"' and type eq 2)&$count=true&$top=201";
|
||||
|
||||
const queryUrl =
|
||||
"systemforms?$select=formid,name,formxml,type,objecttypecode&$filter=(objecttypecode eq 'pinswg_" +
|
||||
whichForm +
|
||||
"' and type eq 2)&$count=true&$top=201";
|
||||
|
||||
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,
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "FORM_DATA_FETCH_FAILED",
|
||||
message: "Failed to fetch form data"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -15,16 +15,8 @@
|
||||
* 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 { 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;
|
||||
@@ -37,28 +29,20 @@ 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_publishtoweb,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=incidentid eq " +
|
||||
searchString +
|
||||
" and pinswg_appealcasetype ne null &$orderby=createdon desc&$count=true";
|
||||
|
||||
const queryUrl =
|
||||
"incidents?$select=pinswg_environmentalstatementlocation,pinswg_publishtoweb,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=incidentid eq " +
|
||||
searchString +
|
||||
" and pinswg_appealcasetype ne null &$orderby=createdon desc&$count=true";
|
||||
|
||||
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,
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "INCIDENT_BY_ID_FETCH_FAILED",
|
||||
message: "Failed to fetch incident by id"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -15,16 +15,8 @@
|
||||
* 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 { 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 searchString = req.query.searchString;
|
||||
@@ -37,28 +29,20 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const escapedSearchString = searchString.split("'").join("''");
|
||||
|
||||
const escapedSearchString = searchString.split("'").join("''");
|
||||
const queryUrl =
|
||||
"incidents?$select=pinswg_environmentalstatementlocation,pinswg_publishtoweb,ticketnumber,title, _primarycontactid_value&$filter=incidentid eq " +
|
||||
escapedSearchString +
|
||||
" and pinswg_appealcasetype ne null &$orderby=createdon desc&$count=true";
|
||||
|
||||
const queryUrl =
|
||||
"incidents?$select=pinswg_environmentalstatementlocation,pinswg_publishtoweb,ticketnumber,title, _primarycontactid_value&$filter=incidentid eq " +
|
||||
escapedSearchString +
|
||||
" and pinswg_appealcasetype ne null &$orderby=createdon desc&$count=true";
|
||||
|
||||
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,
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "IS_PUBLISHED_FETCH_FAILED",
|
||||
message: "Failed to fetch published state"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,16 +16,9 @@
|
||||
* description: Success
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import { azureHeadersPaged } 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) {
|
||||
const parentIncidentid = req.query.parentincidentid;
|
||||
@@ -41,26 +34,19 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"incidents?$count=true&$filter=_parentcaseid_value eq " +
|
||||
parentIncidentid +
|
||||
" and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true &$select=title, incidentid";
|
||||
|
||||
const queryUrl =
|
||||
"incidents?$count=true&$filter=_parentcaseid_value eq " +
|
||||
parentIncidentid +
|
||||
" and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true &$select=title, incidentid";
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
);
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) => azureHeadersPaged(accessToken),
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "LINKED_CASES_FETCH_FAILED",
|
||||
message: "Failed to fetch linked cases"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -21,16 +21,9 @@
|
||||
* description: hello world
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import { azureHeadersPaged } 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) {
|
||||
const emailAddress = req.query.emailAddress;
|
||||
@@ -52,26 +45,21 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"contacts?$filter=emailaddress1 eq '" +
|
||||
emailAddress +
|
||||
"' and pinswg_custom_password eq '" +
|
||||
pwd +
|
||||
"'&$count=true&$select=emailaddress1,contactid,pinswg_custom_password,yomifullname,firstname,lastname";
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
);
|
||||
const queryUrl =
|
||||
"contacts?$filter=emailaddress1 eq '" +
|
||||
emailAddress +
|
||||
"' and pinswg_custom_password eq '" +
|
||||
pwd +
|
||||
"'&$count=true&$select=emailaddress1,contactid,pinswg_custom_password,yomifullname,firstname,lastname";
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) => azureHeadersPaged(accessToken),
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "LOGIN_FETCH_FAILED",
|
||||
message: "Failed to fetch login details"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,36 +12,20 @@
|
||||
*
|
||||
*/
|
||||
|
||||
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 { respondError } from "../middleware/apiResponse";
|
||||
import { relayGet } from "../middleware/relayForwarding";
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"accounts?$count=true&$filter=pinswg_isalocalplanningauthorityaccount eq 846040000&$select=name&$orderby=name asc";
|
||||
|
||||
const queryUrl =
|
||||
"accounts?$count=true&$filter=pinswg_isalocalplanningauthorityaccount eq 846040000&$select=name&$orderby=name asc";
|
||||
|
||||
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,
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "LPA_FETCH_FAILED",
|
||||
message: "Failed to fetch local planning authorities"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -17,16 +17,8 @@
|
||||
* 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 { 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 loggedInUserId = req.query.loggedInUserId;
|
||||
@@ -42,30 +34,25 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"incidents?$select=pinswg_environmentalstatementlocation,modifiedon,pinswg_publishtoweb,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_lpareference,pinswg_appellantlastname,pinswg_appellantfirstname,pinswg_appellantagent,pinswg_agentfirstname,pinswg_agentlastname,pinswg_agentcompanyname&$expand=primarycontactid($select=fullname)&$filter=_customerid_value eq " +
|
||||
loggedInUserId +
|
||||
" and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true";
|
||||
|
||||
const queryUrl =
|
||||
"incidents?$select=pinswg_environmentalstatementlocation,modifiedon,pinswg_publishtoweb,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_lpareference,pinswg_appellantlastname,pinswg_appellantfirstname,pinswg_appellantagent,pinswg_agentfirstname,pinswg_agentlastname,pinswg_agentcompanyname&$expand=primarycontactid($select=fullname)&$filter=_customerid_value eq " +
|
||||
loggedInUserId +
|
||||
" and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true";
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
transformData: (data) => {
|
||||
data.value.forEach(function (element) {
|
||||
element.pinswg_title = element.title;
|
||||
});
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
);
|
||||
|
||||
data.value.forEach(function (element) {
|
||||
element.pinswg_title = element.title;
|
||||
});
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return data;
|
||||
},
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "MY_CASES_FETCH_FAILED",
|
||||
message: "Failed to fetch my cases"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -17,18 +17,11 @@
|
||||
* description: Success
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import { JSONPath as jsonpath } from "jsonpath-plus";
|
||||
import { getLPA } from "../../../actions/services/referenceDataService";
|
||||
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 { respondError } from "../middleware/apiResponse";
|
||||
import { relayGet } from "../middleware/relayForwarding";
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
const lpaid = req.query.lpaid;
|
||||
@@ -42,7 +35,6 @@ export default async function ApiProxy(req, res) {
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const lpaList = await getLPA();
|
||||
|
||||
const lpaGUID = jsonpath({
|
||||
@@ -74,18 +66,23 @@ export default async function ApiProxy(req, res) {
|
||||
|
||||
//console.log("///////////\nPortal query: ", queryUrl, "<<<<end query");
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
);
|
||||
|
||||
data.value.forEach(function (element) {
|
||||
element.pinswg_title = element.title;
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) => azureHeaders(accessToken),
|
||||
transformData: (data) => {
|
||||
data.value.forEach(function (element) {
|
||||
element.pinswg_title = element.title;
|
||||
});
|
||||
return data;
|
||||
},
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "MY_LPA_CASES_FETCH_FAILED",
|
||||
message: "Failed to fetch my LPA cases"
|
||||
}
|
||||
});
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
status: 400,
|
||||
code: "MY_LPA_CASES_FETCH_FAILED",
|
||||
|
||||
@@ -17,16 +17,8 @@
|
||||
* 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 { 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 loggedInUserId = req.query.loggedInUserId;
|
||||
@@ -42,26 +34,18 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"pinswg_representationses?$filter= _pinswg_contact_value eq " +
|
||||
loggedInUserId +
|
||||
"&$count=true&$orderby=createdon desc";
|
||||
|
||||
const queryUrl =
|
||||
"pinswg_representationses?$filter= _pinswg_contact_value eq " +
|
||||
loggedInUserId +
|
||||
"&$count=true&$orderby=createdon desc";
|
||||
|
||||
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,
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "MY_REPRESENTATIONS_FETCH_FAILED",
|
||||
message: "Failed to fetch my representations"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -17,16 +17,8 @@
|
||||
* 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 { 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 loggedInUserId = req.query.loggedInUserId;
|
||||
@@ -42,26 +34,18 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"pinswg_representationses?$filter= _pinswg_contact_value eq " +
|
||||
loggedInUserId +
|
||||
"&$count=true&$orderby=createdon desc";
|
||||
|
||||
const queryUrl =
|
||||
"pinswg_representationses?$filter= _pinswg_contact_value eq " +
|
||||
loggedInUserId +
|
||||
"&$count=true&$orderby=createdon desc";
|
||||
|
||||
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,
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "MY_REPRESENTATIONS_PROXY_FETCH_FAILED",
|
||||
message: "Failed to fetch my representations proxy details"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
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 { 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 searchString = req.query.searchString;
|
||||
@@ -21,34 +14,31 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const escapedSearchString = searchString.replace(/\'/g, "''");
|
||||
const escapedSearchString = searchString.replace(/\'/g, "''");
|
||||
|
||||
const queryUrl =
|
||||
"incidents?$select=pinswg_environmentalstatementlocation,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, '" +
|
||||
escapedSearchString +
|
||||
"') or contains(ticketnumber, '" +
|
||||
escapedSearchString +
|
||||
"')) and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true";
|
||||
const queryUrl =
|
||||
"incidents?$select=pinswg_environmentalstatementlocation,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, '" +
|
||||
escapedSearchString +
|
||||
"') or contains(ticketnumber, '" +
|
||||
escapedSearchString +
|
||||
"')) and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true";
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
);
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) => azureHeadersPaged(accessToken),
|
||||
transformData: (data) => {
|
||||
let dataStr;
|
||||
_.has(data, "@odata.nextLink") === true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
|
||||
let dataStr;
|
||||
_.has(data, "@odata.nextLink") === true &&
|
||||
((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: "PART_SAVED_APPEAL_FETCH_FAILED",
|
||||
message: "Failed to fetch part-saved appeals"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -17,16 +17,8 @@
|
||||
* description: hello world
|
||||
*/
|
||||
|
||||
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 { respondError } from "../middleware/apiResponse";
|
||||
import { relayGet } from "../middleware/relayForwarding";
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
const contactid = req.query.contactid;
|
||||
@@ -39,24 +31,18 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"contacts(" +
|
||||
contactid +
|
||||
")?$select=firstname, lastname, emailaddress1, telephone1, company, address1_line1,address1_line2,address1_city, address1_county,address1_postalcode,pinswg_typeofinvolvement,pinswg_contact_associatedlpa,pinswg_preferredlanguage&$count=true";
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
);
|
||||
const queryUrl =
|
||||
"contacts(" +
|
||||
contactid +
|
||||
")?$select=firstname, lastname, emailaddress1, telephone1, company, address1_line1,address1_line2,address1_city, address1_county,address1_postalcode,pinswg_typeofinvolvement,pinswg_contact_associatedlpa,pinswg_preferredlanguage&$count=true";
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "PERSONAL_ACCOUNT_FETCH_FAILED",
|
||||
message: "Failed to fetch personal account"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,16 +16,10 @@
|
||||
* description: hello world
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import { azureHeadersPaged } 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) {
|
||||
const emailAddress = req.query.emailAddress;
|
||||
@@ -66,24 +60,19 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"contacts?$filter=emailaddress1 eq '" +
|
||||
emailAddress +
|
||||
"' and statuscode eq 1&$count=true&$select=emailaddress1,contactid,yomifullname,firstname,lastname";
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
);
|
||||
const queryUrl =
|
||||
"contacts?$filter=emailaddress1 eq '" +
|
||||
emailAddress +
|
||||
"' and statuscode eq 1&$count=true&$select=emailaddress1,contactid,yomifullname,firstname,lastname";
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) => azureHeadersPaged(accessToken),
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "PORTAL_LOGIN_FETCH_FAILED",
|
||||
message: "Failed to fetch portal login"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,16 +16,9 @@
|
||||
* description: hello world
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import { azureHeadersPaged } 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) {
|
||||
const emailAddress = req.query.emailAddress;
|
||||
@@ -38,24 +31,19 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"contacts?$filter=emailaddress1 eq '" +
|
||||
emailAddress +
|
||||
"'&$count=true&$select=emailaddress1,contactid,yomifullname,firstname,lastname";
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
);
|
||||
const queryUrl =
|
||||
"contacts?$filter=emailaddress1 eq '" +
|
||||
emailAddress +
|
||||
"'&$count=true&$select=emailaddress1,contactid,yomifullname,firstname,lastname";
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) => azureHeadersPaged(accessToken),
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "PORTAL_LOGIN_PROXY_FETCH_FAILED",
|
||||
message: "Failed to fetch portal login proxy details"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -23,17 +23,9 @@
|
||||
* description: hello world
|
||||
*/
|
||||
|
||||
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 { 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 appealType = req.query.appealType;
|
||||
@@ -58,30 +50,23 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const escapedCaseReference = caseReference.split("'").join("''");
|
||||
const escapedCaseReference = caseReference.split("'").join("''");
|
||||
|
||||
let queryUrl =
|
||||
appealType +
|
||||
"?$filter=pinswg_name eq '" +
|
||||
escapedCaseReference +
|
||||
"'&$count=true";
|
||||
let queryUrl =
|
||||
appealType +
|
||||
"?$filter=pinswg_name eq '" +
|
||||
escapedCaseReference +
|
||||
"'&$count=true";
|
||||
|
||||
queryUrl = queryUrl + getSelectQuery(appealType);
|
||||
queryUrl = queryUrl + getSelectQuery(appealType);
|
||||
|
||||
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,
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "PORTAL_MODULE_DETAILS_FETCH_FAILED",
|
||||
message: "Failed to fetch portal module details"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -23,17 +23,9 @@
|
||||
* description: hello world
|
||||
*/
|
||||
|
||||
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 { 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 appealType = req.query.appealType;
|
||||
@@ -58,30 +50,23 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const escapedCaseReference = caseReference.split("'").join("''");
|
||||
const escapedCaseReference = caseReference.split("'").join("''");
|
||||
|
||||
let queryUrl =
|
||||
appealType +
|
||||
"?$filter=pinswg_name eq '" +
|
||||
escapedCaseReference +
|
||||
"'&$count=true";
|
||||
let queryUrl =
|
||||
appealType +
|
||||
"?$filter=pinswg_name eq '" +
|
||||
escapedCaseReference +
|
||||
"'&$count=true";
|
||||
|
||||
queryUrl = queryUrl + getSelectQuery(appealType);
|
||||
queryUrl = queryUrl + getSelectQuery(appealType);
|
||||
|
||||
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,
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "PORTAL_MODULE_DETAILS_PROXY_FETCH_FAILED",
|
||||
message: "Failed to fetch portal module details proxy"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -15,21 +15,13 @@
|
||||
* 200:
|
||||
* description: hello world
|
||||
*/
|
||||
import axios from "axios";
|
||||
import { azureHeaders } from "../../../actions/core/headers";
|
||||
import {
|
||||
escapeODataString,
|
||||
isNonEmptyString,
|
||||
sanitizeString
|
||||
} from "../../../actions/core/guards";
|
||||
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) {
|
||||
const emailAddress = sanitizeString(req.query.emailAddress);
|
||||
@@ -42,25 +34,18 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"contacts?$filter=emailaddress1 eq '" +
|
||||
escapeODataString(emailAddress) +
|
||||
"'&$count=true&$select=pinswg_preferredlanguage,contactid";
|
||||
const queryUrl =
|
||||
"contacts?$filter=emailaddress1 eq '" +
|
||||
escapeODataString(emailAddress) +
|
||||
"'&$count=true&$select=pinswg_preferredlanguage,contactid";
|
||||
|
||||
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,
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "PREFERRED_LANGUAGE_FETCH_FAILED",
|
||||
message: "Failed to fetch preferred language"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,36 +9,20 @@
|
||||
* 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 { 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) {
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"pinswg_sipsprojecttypes?$select=pinswg_name,pinswg_sipsprojecttypeid&$orderby=pinswg_name asc&$count=true";
|
||||
|
||||
const queryUrl =
|
||||
"pinswg_sipsprojecttypes?$select=pinswg_name,pinswg_sipsprojecttypeid&$orderby=pinswg_name asc&$count=true";
|
||||
|
||||
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,
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "PROJECT_TYPES_FETCH_FAILED",
|
||||
message: "Failed to fetch project types"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -17,16 +17,8 @@
|
||||
* 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 { 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 incidentID = req.query.incidentID;
|
||||
@@ -39,26 +31,18 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"pinswg_representationses?$filter= _pinswg_case_value eq " +
|
||||
incidentID +
|
||||
" and pinswg_publishtoweb eq true&$count=true&$orderby=createdon desc";
|
||||
|
||||
const queryUrl =
|
||||
"pinswg_representationses?$filter= _pinswg_case_value eq " +
|
||||
incidentID +
|
||||
" and pinswg_publishtoweb eq true&$count=true&$orderby=createdon desc";
|
||||
|
||||
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,
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "REPRESENTATIONS_FETCH_FAILED",
|
||||
message: "Failed to fetch representations"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -17,16 +17,8 @@
|
||||
* 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 { 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 incidentID = req.query.incidentID;
|
||||
@@ -39,26 +31,18 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"pinswg_representationses?$filter= _pinswg_case_value eq " +
|
||||
incidentID +
|
||||
"&$count=true&$orderby=createdon desc";
|
||||
|
||||
const queryUrl =
|
||||
"pinswg_representationses?$filter= _pinswg_case_value eq " +
|
||||
incidentID +
|
||||
"&$count=true&$orderby=createdon desc";
|
||||
|
||||
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,
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "REPRESENTATIONS_PROXY_FETCH_FAILED",
|
||||
message: "Failed to fetch representations proxy details"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,16 +16,9 @@
|
||||
* 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 { 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";
|
||||
|
||||
const groupArray = (arr) => {
|
||||
const map = new Map();
|
||||
@@ -67,31 +60,26 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"pinswg_documents?$count=true&$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " +
|
||||
incidentID +
|
||||
" and pinswg_latestpublishedversion ne null and pinswg_latestpublisheddate ne null&$select=pinswg_isharedocumentlocations";
|
||||
|
||||
const queryUrl =
|
||||
"pinswg_documents?$count=true&$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " +
|
||||
incidentID +
|
||||
" and pinswg_latestpublishedversion ne null and pinswg_latestpublisheddate ne null&$select=pinswg_isharedocumentlocations";
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) => azureHeaders(accessToken),
|
||||
transformData: (data) => {
|
||||
data.value.forEach(function (element) {
|
||||
delete element["pinswg_documentid"];
|
||||
});
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
);
|
||||
|
||||
data.value.forEach(function (element) {
|
||||
delete element["pinswg_documentid"];
|
||||
});
|
||||
|
||||
const dataArr = groupArray(data.value);
|
||||
return respondSuccess(res, dataArr);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return groupArray(data.value);
|
||||
},
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "SEARCH_DOCUMENT_TYPES_FETCH_FAILED",
|
||||
message: "Failed to fetch search document types"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,21 +16,14 @@
|
||||
* description: Success
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import { azureHeadersPaged } 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";
|
||||
import { respondError } from "../middleware/apiResponse";
|
||||
import { relayGet } from "../middleware/relayForwarding";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
const encryptDocReference = (documentRef) => {
|
||||
var hashlink = CryptoJS.HmacSHA256(
|
||||
"documents/download/" + documentRef,
|
||||
@@ -55,43 +48,39 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"pinswg_documents?$count=true&$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " +
|
||||
incidentID +
|
||||
" and pinswg_latestpublishedversion ne null and pinswg_latestpublisheddate ne null&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference,pinswg_name,pinswg_latestpublishedversion,pinswg_latestpublisheddate,pinswg_documentpublisheddate";
|
||||
|
||||
const queryUrl =
|
||||
"pinswg_documents?$count=true&$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " +
|
||||
incidentID +
|
||||
" and pinswg_latestpublishedversion ne null and pinswg_latestpublisheddate ne null&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference,pinswg_name,pinswg_latestpublishedversion,pinswg_latestpublisheddate,pinswg_documentpublisheddate";
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
);
|
||||
|
||||
data.value.forEach(function (element) {
|
||||
Object.assign(element, {
|
||||
"pinswg_documentpublisheddate":
|
||||
element.pinswg_documentpublisheddate != null
|
||||
? element.pinswg_documentpublisheddate
|
||||
: element.pinswg_latestpublisheddate
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) => azureHeadersPaged(accessToken),
|
||||
transformData: (data) => {
|
||||
data.value.forEach(function (element) {
|
||||
Object.assign(element, {
|
||||
"pinswg_documentpublisheddate":
|
||||
element.pinswg_documentpublisheddate != null
|
||||
? element.pinswg_documentpublisheddate
|
||||
: element.pinswg_latestpublisheddate
|
||||
});
|
||||
element.pinswg_hashlink = encryptDocReference(
|
||||
element.pinswg_isharedocumentreference
|
||||
);
|
||||
});
|
||||
element.pinswg_hashlink = encryptDocReference(
|
||||
element.pinswg_isharedocumentreference
|
||||
);
|
||||
});
|
||||
|
||||
if (_.has(data, "@odata.nextLink") === true) {
|
||||
const dataStr = JSON.stringify(data["@odata.nextLink"]);
|
||||
data["@odata.nextLink"] = dataStr.split("/v8.2/")[1];
|
||||
}
|
||||
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: "SEARCH_DOCUMENT_DETAILS_FETCH_FAILED",
|
||||
message: "Failed to fetch search document details"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -42,21 +42,14 @@
|
||||
* description: Success
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
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";
|
||||
import { respondError } from "../middleware/apiResponse";
|
||||
import { relayGet } from "../middleware/relayForwarding";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
const encryptDocReference = (documentRef) => {
|
||||
var hashlink = CryptoJS.HmacSHA256(
|
||||
"documents/download/" + documentRef,
|
||||
@@ -150,53 +143,49 @@ export default async function ApiProxy(req, res) {
|
||||
//console.log("has this passed docuemntType:", documentType);
|
||||
//(documentType !="all" && " pinswg_pinswg_isharedocumentlocations eq " + )
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"pinswg_documents?$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " +
|
||||
incidentID +
|
||||
" and pinswg_latestpublishedversion ne null and pinswg_latestpublisheddate ne null" +
|
||||
docTypeQueryString +
|
||||
"&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference,pinswg_name,pinswg_latestpublishedversion,pinswg_latestpublisheddate,pinswg_documentpublisheddate&$orderby=" +
|
||||
orderby +
|
||||
" " +
|
||||
fieldSort +
|
||||
"&$count=true" +
|
||||
(typeof pageNumber != "undefined"
|
||||
? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
|
||||
: "");
|
||||
|
||||
const queryUrl =
|
||||
"pinswg_documents?$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " +
|
||||
incidentID +
|
||||
" and pinswg_latestpublishedversion ne null and pinswg_latestpublisheddate ne null" +
|
||||
docTypeQueryString +
|
||||
"&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference,pinswg_name,pinswg_latestpublishedversion,pinswg_latestpublisheddate,pinswg_documentpublisheddate&$orderby=" +
|
||||
orderby +
|
||||
" " +
|
||||
fieldSort +
|
||||
"&$count=true" +
|
||||
(typeof pageNumber != "undefined"
|
||||
? "&$skiptoken=" +
|
||||
('<cookie pagenumber="' + pageNumber + '" />')
|
||||
: "");
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPagedCustom(token.access_token, showNumberOfRecords)
|
||||
);
|
||||
|
||||
data.value.forEach(function (element) {
|
||||
Object.assign(element, {
|
||||
"pinswg_documentpublisheddate":
|
||||
element.pinswg_documentpublisheddate != null
|
||||
? element.pinswg_documentpublisheddate
|
||||
: element.pinswg_latestpublisheddate
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) =>
|
||||
azureHeadersPagedCustom(accessToken, showNumberOfRecords),
|
||||
transformData: (data) => {
|
||||
data.value.forEach(function (element) {
|
||||
Object.assign(element, {
|
||||
"pinswg_documentpublisheddate":
|
||||
element.pinswg_documentpublisheddate != null
|
||||
? element.pinswg_documentpublisheddate
|
||||
: element.pinswg_latestpublisheddate
|
||||
});
|
||||
element.pinswg_hashlink = encryptDocReference(
|
||||
element.pinswg_isharedocumentreference
|
||||
);
|
||||
});
|
||||
element.pinswg_hashlink = encryptDocReference(
|
||||
element.pinswg_isharedocumentreference
|
||||
);
|
||||
});
|
||||
|
||||
if (_.has(data, "@odata.nextLink") === true) {
|
||||
const dataStr = JSON.stringify(data["@odata.nextLink"]);
|
||||
data["@odata.nextLink"] = dataStr.split("/v8.2/")[1];
|
||||
}
|
||||
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: "SEARCH_DOCUMENT_DETAILS_PAGED_FETCH_FAILED",
|
||||
message: "Failed to fetch paged search document details"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,16 +16,9 @@
|
||||
* description: Success
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import { azureHeadersPaged } 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) {
|
||||
const documentID = req.query.documentid;
|
||||
@@ -38,24 +31,18 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " +
|
||||
documentID;
|
||||
const queryUrl =
|
||||
"pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " +
|
||||
documentID;
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
);
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) => azureHeadersPaged(accessToken),
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "SEARCH_DOCUMENT_HISTORY_FETCH_FAILED",
|
||||
message: "Failed to fetch search document history"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -42,16 +42,9 @@
|
||||
* description: Success
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import { azureHeadersPaged } 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) {
|
||||
const documentID = req.query.documentid;
|
||||
@@ -64,29 +57,22 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " +
|
||||
documentID;
|
||||
// +
|
||||
// (typeof pageNumber != "undefined"
|
||||
// ? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
|
||||
// : "");
|
||||
|
||||
const queryUrl =
|
||||
"pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " +
|
||||
documentID;
|
||||
// +
|
||||
// (typeof pageNumber != "undefined"
|
||||
// ? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
|
||||
// : "");
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
);
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
requestOptionsBuilder: (accessToken) => azureHeadersPaged(accessToken),
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "SEARCH_DOCUMENT_HISTORY_PAGED_FETCH_FAILED",
|
||||
message: "Failed to fetch paged search document history"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
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 { respondError } from "../middleware/apiResponse";
|
||||
import { relayGet } from "../middleware/relayForwarding";
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
const caseid = req.query.caseid;
|
||||
@@ -20,26 +12,18 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"pinswg_sipsevents?$filter=_pinswg_sipseventsid_value eq " +
|
||||
caseid +
|
||||
"&$count=true";
|
||||
|
||||
const queryUrl =
|
||||
"pinswg_sipsevents?$filter=_pinswg_sipseventsid_value eq " +
|
||||
caseid +
|
||||
"&$count=true";
|
||||
|
||||
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,
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "SIPS_EVENTS_FETCH_FAILED",
|
||||
message: "Failed to fetch SIPS events"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -17,16 +17,8 @@
|
||||
* 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 { 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 loggedInUserId = req.query.loggedInUserId;
|
||||
@@ -42,52 +34,48 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"pinswg_watchlists?$filter= _pinswg_contact_value eq " +
|
||||
loggedInUserId +
|
||||
"&$select=pinswg_emailnotifications,modifiedon,pinswg_appealcasetype,pinswg_watchlistid,_pinswg_watchedcase_value,statuscode,pinswg_representationsubmitted,pinswg_representationtype&$count=true&$orderby=createdon desc&$expand=pinswg_WatchedCase($select=pinswg_AssociatedLPA)";
|
||||
|
||||
const queryUrl =
|
||||
"pinswg_watchlists?$filter= _pinswg_contact_value eq " +
|
||||
loggedInUserId +
|
||||
"&$select=pinswg_emailnotifications,modifiedon,pinswg_appealcasetype,pinswg_watchlistid,_pinswg_watchedcase_value,statuscode,pinswg_representationsubmitted,pinswg_representationtype&$count=true&$orderby=createdon desc&$expand=pinswg_WatchedCase($select=pinswg_AssociatedLPA)";
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
transformData: (data) => {
|
||||
data.value.forEach(function (element) {
|
||||
element.ticketnumber = element.pinswg_WatchedCase?.ticketnumber;
|
||||
element.pinswg_title =
|
||||
element[
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
);
|
||||
|
||||
data.value.forEach(function (element) {
|
||||
element.ticketnumber = element.pinswg_WatchedCase?.ticketnumber;
|
||||
element.pinswg_title =
|
||||
element[
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
|
||||
element[
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
] =
|
||||
element.pinswg_WatchedCase?.[
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
element._pinswg_associatedlpa_value =
|
||||
element.pinswg_WatchedCase?._pinswg_associatedlpa_value;
|
||||
element[
|
||||
"_ownerid_value@OData.Community.Display.V1.FormattedValue"
|
||||
] =
|
||||
element.pinswg_WatchedCase?.[
|
||||
] =
|
||||
element.pinswg_WatchedCase?.[
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
element._pinswg_associatedlpa_value =
|
||||
element.pinswg_WatchedCase?._pinswg_associatedlpa_value;
|
||||
element[
|
||||
"_ownerid_value@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
element._ownerid_value = element.pinswg_WatchedCase?._ownerid_value;
|
||||
] =
|
||||
element.pinswg_WatchedCase?.[
|
||||
"_ownerid_value@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
element._ownerid_value =
|
||||
element.pinswg_WatchedCase?._ownerid_value;
|
||||
|
||||
delete element.pinswg_WatchedCase;
|
||||
});
|
||||
delete element.pinswg_WatchedCase;
|
||||
});
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return data;
|
||||
},
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "WATCHED_CASES_FETCH_FAILED",
|
||||
message: "Failed to fetch watched cases"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -17,16 +17,8 @@
|
||||
* 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 { 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 loggedInUserId = req.query.loggedInUserId;
|
||||
@@ -42,51 +34,48 @@ export default async function ApiProxy(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const token = await getToken();
|
||||
const queryUrl =
|
||||
"pinswg_watchlists?$filter= _pinswg_contact_value eq " +
|
||||
loggedInUserId +
|
||||
"&$select=modifiedon,pinswg_appealcasetype,pinswg_watchlistid,_pinswg_watchedcase_value,statuscode,pinswg_representationsubmitted,pinswg_representationtype&$count=true&$orderby=createdon desc&$expand=pinswg_WatchedCase($select=pinswg_AssociatedLPA)";
|
||||
const queryUrl =
|
||||
"pinswg_watchlists?$filter= _pinswg_contact_value eq " +
|
||||
loggedInUserId +
|
||||
"&$select=modifiedon,pinswg_appealcasetype,pinswg_watchlistid,_pinswg_watchedcase_value,statuscode,pinswg_representationsubmitted,pinswg_representationtype&$count=true&$orderby=createdon desc&$expand=pinswg_WatchedCase($select=pinswg_AssociatedLPA)";
|
||||
|
||||
const { data } = await axios.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
);
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
transformData: (data) => {
|
||||
data.value.forEach(function (element) {
|
||||
element.ticketnumber = element.pinswg_WatchedCase.ticketnumber;
|
||||
element.pinswg_title =
|
||||
element[
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
|
||||
data.value.forEach(function (element) {
|
||||
element.ticketnumber = element.pinswg_WatchedCase.ticketnumber;
|
||||
element.pinswg_title =
|
||||
element[
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
|
||||
element[
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
] =
|
||||
element.pinswg_WatchedCase[
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
element._pinswg_associatedlpa_value =
|
||||
element.pinswg_WatchedCase._pinswg_associatedlpa_value;
|
||||
element[
|
||||
"_ownerid_value@OData.Community.Display.V1.FormattedValue"
|
||||
] =
|
||||
element.pinswg_WatchedCase[
|
||||
] =
|
||||
element.pinswg_WatchedCase[
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
element._pinswg_associatedlpa_value =
|
||||
element.pinswg_WatchedCase._pinswg_associatedlpa_value;
|
||||
element[
|
||||
"_ownerid_value@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
element._ownerid_value = element.pinswg_WatchedCase._ownerid_value;
|
||||
] =
|
||||
element.pinswg_WatchedCase[
|
||||
"_ownerid_value@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
element._ownerid_value =
|
||||
element.pinswg_WatchedCase._ownerid_value;
|
||||
|
||||
delete element.pinswg_WatchedCase;
|
||||
});
|
||||
delete element.pinswg_WatchedCase;
|
||||
});
|
||||
|
||||
return respondSuccess(res, data);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, {
|
||||
return data;
|
||||
},
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "WATCHED_CASES_PROXY_FETCH_FAILED",
|
||||
message: "Failed to fetch watched cases proxy details"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
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 "./apiResponse";
|
||||
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
export const relayGet = async ({
|
||||
queryUrl,
|
||||
res,
|
||||
errorResponse,
|
||||
transformData,
|
||||
requestOptionsBuilder
|
||||
}) => {
|
||||
try {
|
||||
const { data, accessToken } = await relayGetData({
|
||||
queryUrl,
|
||||
requestOptionsBuilder
|
||||
});
|
||||
|
||||
return respondSuccess(
|
||||
res,
|
||||
typeof transformData === "function"
|
||||
? await transformData(data, accessToken)
|
||||
: data
|
||||
);
|
||||
} catch (error) {
|
||||
consoleLogger(error);
|
||||
return respondError(res, errorResponse);
|
||||
}
|
||||
};
|
||||
|
||||
export const relayGetData = async ({
|
||||
queryUrl,
|
||||
requestOptionsBuilder,
|
||||
accessToken
|
||||
}) => {
|
||||
return forwardGetData({
|
||||
queryUrl,
|
||||
requestOptionsBuilder,
|
||||
accessToken
|
||||
});
|
||||
};
|
||||
|
||||
export const forwardGetData = async ({
|
||||
baseUrl,
|
||||
queryUrl,
|
||||
requestOptionsBuilder,
|
||||
accessToken,
|
||||
appendHash = true
|
||||
}) => {
|
||||
const tokenAccessToken =
|
||||
typeof accessToken === "string" && accessToken.length > 0
|
||||
? accessToken
|
||||
: (await getToken()).access_token;
|
||||
|
||||
const resolvedBaseUrl = baseUrl || WEBAPI_URL;
|
||||
const finalUrl =
|
||||
resolvedBaseUrl + queryUrl + (appendHash ? hashAPIPath(queryUrl) : "");
|
||||
|
||||
const { data } = await axios.get(
|
||||
finalUrl,
|
||||
typeof requestOptionsBuilder === "function"
|
||||
? requestOptionsBuilder(tokenAccessToken)
|
||||
: azureHeaders(tokenAccessToken)
|
||||
);
|
||||
|
||||
return {
|
||||
data,
|
||||
accessToken: tokenAccessToken
|
||||
};
|
||||
};
|
||||
@@ -41,6 +41,8 @@ const loadModule = (relativePath, injected = {}) => {
|
||||
source +=
|
||||
'\nif (typeof ApiProxy !== "undefined" && !module.exports.default) module.exports.default = ApiProxy;\n';
|
||||
|
||||
const defaultRelayGet = async () => ({});
|
||||
|
||||
const context = {
|
||||
module: { exports: {} },
|
||||
exports: {},
|
||||
@@ -52,6 +54,7 @@ const loadModule = (relativePath, injected = {}) => {
|
||||
warn: () => {},
|
||||
error: () => {}
|
||||
},
|
||||
relayGet: defaultRelayGet,
|
||||
...injected
|
||||
};
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user