refactor phase 3a api-file chunk 1 targeted actions imports

This commit is contained in:
2026-03-12 11:38:18 +00:00
parent 2a3c7eac34
commit 5822930f0a
6 changed files with 30 additions and 26 deletions
@@ -1,10 +1,10 @@
import { hashAPIPath, updateAccount } from "../../../actions"; import { updateAccount } from "../../../actions/services/accountService";
import { import {
createCaseCompleteMessage, createCaseCompleteMessage,
getProgressBlobs, getProgressBlobs,
downloadProgressFile, downloadProgressFile,
createBlob, createBlob,
getCaseBlob, getCaseBlob
} from "../../../actions/azurestorage"; } from "../../../actions/azurestorage";
import _ from "lodash"; import _ from "lodash";
@@ -44,7 +44,7 @@ ApiProxy.get(async (req, res) => {
); );
Object.assign(blobProgress, { Object.assign(blobProgress, {
"appealComplete": tempCaseRef, "appealComplete": tempCaseRef
}); });
delete blobProgress["pinswg_name"]; delete blobProgress["pinswg_name"];
@@ -75,7 +75,7 @@ ApiProxy.get(async (req, res) => {
"pinswg_lpareference": "pinswg_lpareference":
blobProgress.pinswg_lpaapplicationreference, blobProgress.pinswg_lpaapplicationreference,
"description": blobProgress.pinswg_developmentdescription, "description": blobProgress.pinswg_developmentdescription,
"pinswg_caseaddress": combinedAddress, "pinswg_caseaddress": combinedAddress
}); });
//send update case.json and then create queue message //send update case.json and then create queue message
@@ -87,7 +87,7 @@ ApiProxy.get(async (req, res) => {
updateAccount( updateAccount(
contactId[1], contactId[1],
{ {
"pinswg_typeofinvolvement": 846040001, "pinswg_typeofinvolvement": 846040001
}, },
true true
).then((data) => { ).then((data) => {
@@ -104,7 +104,7 @@ ApiProxy.get(async (req, res) => {
createCaseCompleteMessage(containerName, tempCaseRef); createCaseCompleteMessage(containerName, tempCaseRef);
return res.status(200).json({ return res.status(200).json({
status: "success", status: "success"
}); });
}); });
}) })
@@ -136,8 +136,8 @@ ApiProxy.get(async (req, res) => {
export const config = { export const config = {
api: { api: {
bodyParser: false, bodyParser: false
}, }
}; };
export default ApiProxy; export default ApiProxy;
+5 -3
View File
@@ -1,7 +1,9 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import _ from "lodash"; import _ from "lodash";
import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions"; import { azureHeadersPaged } from "../../../actions/core/headers";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
import { getCaseBlob, createBlob } from "../../../actions/azurestorage"; import { getCaseBlob, createBlob } from "../../../actions/azurestorage";
import { getTempCaseRef } from "../../../components/utils"; import { getTempCaseRef } from "../../../components/utils";
import { v4 as uuidv4 } from "uuid"; import { v4 as uuidv4 } from "uuid";
@@ -44,7 +46,7 @@ export default async function ApiProxy(req, res) {
"servicestage": 1, "servicestage": 1,
"customerid_contact@odata.bind": "/contacts(" + contactid + ")", "customerid_contact@odata.bind": "/contacts(" + contactid + ")",
"pinswg_appealcasetype": appealTypeId, "pinswg_appealcasetype": appealTypeId,
"pinswg_AssociatedLPA@odata.bind": "/accounts(" + lpaID + ")", "pinswg_AssociatedLPA@odata.bind": "/accounts(" + lpaID + ")"
}; };
var newData = Object.assign(data, createCaseBody); var newData = Object.assign(data, createCaseBody);
@@ -56,7 +58,7 @@ export default async function ApiProxy(req, res) {
var newAppealObj = { var newAppealObj = {
"pinswg_name": tempCaseRef, "pinswg_name": tempCaseRef,
"pinswg_appealcasetype": appealTypeId, "pinswg_appealcasetype": appealTypeId,
"_pinswg_associatedlpa_value": lpaID, "_pinswg_associatedlpa_value": lpaID
}; };
// var config = { // var config = {
+5 -4
View File
@@ -12,7 +12,8 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import { consoleLogger, getToken } from "../../../actions"; import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
@@ -45,7 +46,7 @@ export default async function ApiProxy(req, res) {
var crmUrl = "https://" + process.env.CRMURL; var crmUrl = "https://" + process.env.CRMURL;
var data = { var data = {
"@odata.id": crmUrl + "/api/data/v8.2/contacts(" + contactid + ")", "@odata.id": crmUrl + "/api/data/v8.2/contacts(" + contactid + ")"
}; };
var config = { var config = {
@@ -58,9 +59,9 @@ export default async function ApiProxy(req, res) {
"If-None-Match": "null", "If-None-Match": "null",
"Prefer": 'odata.include-annotations="*",return=representation', "Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token, "Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json", "Content-Type": "application/json"
}, },
data: data, data: data
}; };
return axios(config) return axios(config)
@@ -1,7 +1,6 @@
import { hashAPIPath } from "../../../actions";
import { import {
getBlobs, getBlobs,
createRepCompleteMessage, createRepCompleteMessage
} from "../../../actions/azurestorage"; } from "../../../actions/azurestorage";
import nextConnect from "next-connect"; import nextConnect from "next-connect";
@@ -38,8 +37,8 @@ ApiProxy.get(async (req, res) => {
export const config = { export const config = {
api: { api: {
bodyParser: false, bodyParser: false
}, }
}; };
export default ApiProxy; export default ApiProxy;
+5 -4
View File
@@ -12,7 +12,8 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import { consoleLogger, getToken } from "../../../actions"; import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
@@ -47,7 +48,7 @@ export default async function ApiProxy(req, res) {
var data = { var data = {
"@odata.id": "@odata.id":
crmUrl + "/api/data/" + crmVersion + "/contacts(" + contactid + ")", crmUrl + "/api/data/" + crmVersion + "/contacts(" + contactid + ")"
}; };
var config = { var config = {
@@ -60,9 +61,9 @@ export default async function ApiProxy(req, res) {
"If-None-Match": "null", "If-None-Match": "null",
"Prefer": 'odata.include-annotations="*",return=representation', "Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token, "Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json", "Content-Type": "application/json"
}, },
data: data, data: data
}; };
return axios(config) return axios(config)
+4 -3
View File
@@ -1,6 +1,7 @@
import axios from "axios"; import axios from "axios";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import { getToken } from "../../../actions"; import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY; const WORDKEY = process.env.HASHKEY;
@@ -39,9 +40,9 @@ export default async function ApiProxy(req, res) {
"Accept": "application/json", "Accept": "application/json",
"Prefer": 'odata.include-annotations="*",return=representation', "Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token, "Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json", "Content-Type": "application/json"
}, },
data: data, data: data
}; };
//console.log("update case:", data); //console.log("update case:", data);