From b8de41e592c986890849e04f799299037f1228b3 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Fri, 3 Feb 2023 17:00:03 +0000 Subject: [PATCH] console log cleanup --- actions/azurestorage.js | 44 ++++++++----- actions/index.js | 66 +++++++++++++++++-- pages/api/endpoint/getportallogin_api.js | 2 +- .../api/file/getawaitingsubmissionfromblob.js | 10 +-- pages/newappeal/[appealtypes].js | 2 +- pages/newappeal/index.js | 2 +- 6 files changed, 93 insertions(+), 33 deletions(-) diff --git a/actions/azurestorage.js b/actions/azurestorage.js index ff4b7302..11222605 100644 --- a/actions/azurestorage.js +++ b/actions/azurestorage.js @@ -431,11 +431,11 @@ export const downloadAllProgressFiles = async ( containerName, progressBlobObj ) => { - console.log( - "/////////////////////////\n downloading files: " + - JSON.stringify(progressBlobObj) + - "\n/////////////////////////\n" - ); + // console.log( + // "/////////////////////////\n downloading files: " + + // JSON.stringify(progressBlobObj) + + // "\n/////////////////////////\n" + // ); const containerToken = await createContainerSas(containerName); const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`; @@ -449,7 +449,7 @@ export const downloadAllProgressFiles = async ( let blobCount = 0; for (const prop in progressBlobObj) { - console.log(`Progress - ${prop}: ${progressBlobObj[prop].path}`); + //console.log(`Progress - ${prop}: ${progressBlobObj[prop].path}`); blobClient = containerClient.getBlobClient(progressBlobObj[prop].path); downloadedBlob = await blobClient.download(0); downloaded = @@ -462,7 +462,7 @@ export const downloadAllProgressFiles = async ( downloaded = downloaded.substring(0, downloaded.length - 1); for (const prop in progressBlobObj) { - console.log(`Cases - ${prop}: ${progressBlobObj[prop].caseObj}`); + //console.log(`Cases - ${prop}: ${progressBlobObj[prop].caseObj}`); blobClient = containerClient.getBlobClient( progressBlobObj[prop].caseObj ); @@ -487,11 +487,11 @@ export const downloadAllProgressFiles = async ( }; export const downloadAllRepsFiles = async (containerName, repsBlobObj) => { - console.log( - "/////////////////////////\n downloading files: " + - JSON.stringify(repsBlobObj) + - "\n/////////////////////////\n" - ); + // console.log( + // "/////////////////////////\n downloading files: " + + // JSON.stringify(repsBlobObj) + + // "\n/////////////////////////\n" + // ); const containerToken = await createContainerSas(containerName); const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`; @@ -506,7 +506,7 @@ export const downloadAllRepsFiles = async (containerName, repsBlobObj) => { let blobCount = 0; for (const prop in repsBlobObj) { - console.log(`Progress - ${prop}: ${repsBlobObj[prop].name}`); + //console.log(`Progress - ${prop}: ${repsBlobObj[prop].name}`); blobClient = containerClient.getBlobClient(repsBlobObj[prop].name); downloadedBlob = await blobClient.download(0); let repBlobObj = await streamToBuffer( @@ -578,13 +578,17 @@ export const getProgressBlobs = async (containerName, caseReference) => { blobCount++; } - console.log("this is the caasefolder:", caseReference, blobCount); + console.log( + "this is the casefolder and blobcount:", + caseReference, + blobCount + ); let blobObj = []; for await (const blob of containerClient.listBlobsFlat({ prefix: caseReference + "/" + caseReference + "_appeal.json", })) { - console.log("in here"); + console.log("getProgressBlobs in here"); blobObj.push({ "name": blob.name.split("/")[1], "path": blob.name, @@ -676,14 +680,18 @@ export const getRepslobs = async (containerName, caseReference) => { blobCount++; } - console.log("this is the caasefolder:", caseReference, blobCount); + console.log( + "this is the casefolder and blobcount:", + caseReference, + blobCount + ); let blobObj = []; for await (const blob of containerClient.findBlobsByTags( "blobType='Representation'" )) { - console.log("in here"); - console.log(blob); + // console.log("getRepslobs in here"); + // console.log(blob); blobObj.push(blob); } diff --git a/actions/index.js b/actions/index.js index 563edd11..4017f5fc 100644 --- a/actions/index.js +++ b/actions/index.js @@ -770,11 +770,11 @@ export const getAwaitingSubmission = (loggedInUserId) => { }; export const getAwaitingSubmissionFromBlob = (containerName) => { - console.log( - "///////////////////////\ngetAwaitingSubmissionFromBlob: " + - containerName + - "\n///////////////////////\n" - ); + // console.log( + // "///////////////////////\ngetAwaitingSubmissionFromBlob: " + + // containerName + + // "\n///////////////////////\n" + // ); return axios .get( BASE_URL + @@ -821,7 +821,7 @@ export const getAwaitingSubmissionFromBlobProxy = (containerName) => { BASE_URL + "/api/file/getawaitingsubmissionfromblob?container=" + containerName + - +hashAPIPath( + hashAPIPath( "/api/file/getawaitingsubmissionfromblob?container=" + containerName ) @@ -999,7 +999,17 @@ export const createNewCaseBlob = ( "&contactid=" + contactid + "&containername=" + - containerName; + containerName + + hashAPIPath( + "/api/file/createcase_api?appealTypeId=" + + appealTypeId + + "&lpaID=" + + lpaID + + "&contactid=" + + contactid + + "&containername=" + + containerName + ); var config = { method: "post", @@ -1497,6 +1507,22 @@ export const getPortalLogin = (emailAddress) => { }); }; +export const createContainerProxy = (containerName) => { + var queryUrl = + "/api/file/setupcontainer?ident=" + + containerName + + hashAPIPath("/api/file/setupcontainer?ident=" + containerName); + + return axios + .get(BASE_URL + queryUrl) + .then((res) => res.data) + .catch((error) => { + //console.log(consoleLogger(error)); + console.log("thiserror", error); + return JSON.stringify(error); + }); +}; + export const sendCaseCompleteMessage = async (containerID, caseReference) => { var queryUrl = "/api/file/createappealcompletemessage_api?container=" + @@ -1520,6 +1546,32 @@ export const sendCaseCompleteMessage = async (containerID, caseReference) => { }); }; +export const sendCaseCompleteMessageProxy = async ( + containerID, + caseReference +) => { + var queryUrl = + "/api/file/createappealcompletemessageproxy_api?container=" + + containerID + + "&tempcaseref=" + + caseReference; + + var config = { + method: "get", + url: queryUrl, + }; + + //console.log(data); + + return axios(config) + .then((res) => { + return res.data; + }) + .catch((error) => { + //console.log("API call error", error); + }); +}; + export const sendRepCompleteMessage = async (containerID, caseReference) => { var queryUrl = "/api/file/createrepcompletemessage_api?container=" + diff --git a/pages/api/endpoint/getportallogin_api.js b/pages/api/endpoint/getportallogin_api.js index 2ed5ea19..a4653bbe 100644 --- a/pages/api/endpoint/getportallogin_api.js +++ b/pages/api/endpoint/getportallogin_api.js @@ -38,7 +38,7 @@ export default async function ApiProxy(req, res) { azureHeadersPaged(token.access_token) ) .then(({ data }) => { - console.log(data); + //console.log(data); res.status(200).json(data); }) .catch((err) => { diff --git a/pages/api/file/getawaitingsubmissionfromblob.js b/pages/api/file/getawaitingsubmissionfromblob.js index 085eb474..4660d3b8 100644 --- a/pages/api/file/getawaitingsubmissionfromblob.js +++ b/pages/api/file/getawaitingsubmissionfromblob.js @@ -17,11 +17,11 @@ ApiProxy.get(async (req, res) => { var checkquerypath = "/api/file/getawaitingsubmissionfromblob?container=" + containerName; - console.log( - "///////////////////////\ngetawaitingsubmissionblob url :", - req.url, - "\n///////////////////////\n" - ); + // console.log( + // "///////////////////////\ngetawaitingsubmissionblob url :", + // req.url, + // "\n///////////////////////\n" + // ); // console.log(hashAPIPath(checkquerypath), checkHash); //console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); diff --git a/pages/newappeal/[appealtypes].js b/pages/newappeal/[appealtypes].js index 139a7917..925516f2 100644 --- a/pages/newappeal/[appealtypes].js +++ b/pages/newappeal/[appealtypes].js @@ -223,7 +223,7 @@ export const getServerSideProps = wrapper.getServerSideProps( let loggedInUser = cookies.pinsUser; let thisSession = await getSession(ctx); - console.log("nextAuth Session:", thisSession); + //console.log("nextAuth Session:", thisSession); let loggedInUserIdent = thisSession.user.id; let loggedInUserEmail = thisSession.user.email; diff --git a/pages/newappeal/index.js b/pages/newappeal/index.js index 2bcb3dfb..eb2c00a8 100644 --- a/pages/newappeal/index.js +++ b/pages/newappeal/index.js @@ -139,7 +139,7 @@ export const getServerSideProps = wrapper.getServerSideProps( console.log("/newappeal - cookies ", cookies); let thisSession = await getSession(ctx); - console.log("nextAuth Session:", thisSession); + //console.log("nextAuth Session:", thisSession); if (_.has(thisSession, "user") == false) { return {