cleaned up rep functionality

This commit is contained in:
2024-01-24 14:19:36 +00:00
parent a650452d18
commit b7a643a6b1
15 changed files with 57 additions and 235 deletions
+2 -45
View File
@@ -113,32 +113,13 @@ export default async function handler(req, res) {
var appealType = req.query.appealType;
let appealBodyObj = req.body; //JSON.parse(req.body);
// console.log(
// "//////////////////////\nappealBodyObj" +
// req +
// "\n//////////////////////\n"
// );
console.log(
"//////////////////////\nappealBodyObj" +
req.body +
"\n//////////////////////\n"
);
var containerID = appealBodyObj.containerID;
var casefolderID = appealBodyObj.casefolderID;
var caseRef = appealBodyObj.caseRef;
var filesList = appealBodyObj.filesList;
//console.log("there are files:", Object.keys(req.files).length);
var checkquerypath = "/api/file/generateappealpdf";
//console.log("-------", checkHash);
// console.log(hashAPIPath(checkquerypath) == "?hash=" + checkHash);
console.log(casefolderID, caseRef);
// Create Document Component
const MyDocument = (values) => {
switch (values.docProps.pinswg_appealcasetype) {
case "846040000":
@@ -168,12 +149,9 @@ export default async function handler(req, res) {
};
const tempCaseBlob = await getTempCaseBlob(containerID, casefolderID);
console.log("\n////////////////// the temp case blob obj:\n", tempCaseBlob);
const blobProgress = await getProgressBlobs(containerID, casefolderID).then(
(data) => {
console.log("Progress blob path:", data);
//console.log("Progress blob path:", data);
return downloadProgressFile(containerID, data.path, casefolderID);
}
);
@@ -187,14 +165,6 @@ export default async function handler(req, res) {
"caseObj": tempCaseBlob,
});
//console.log(blobProgress);
//if (hashAPIPath(checkquerypath) == "?hash=" + checkHash) {
// //createContainer(containerID).then((containerName) => {
// console.log("does this get folder name:", containerID, casefolderID);
// createRepBlob(req.body, containerID, caseRef);
const pickListData = await getPickLists(appealType);
ReactPDF.render(
@@ -203,30 +173,17 @@ export default async function handler(req, res) {
);
console.log(
"///////////////////////////////////\n file created: \n" +
"///////////////////////////////////\nfile created: " +
`tmp/${blobProgress.pinswg_name}.pdf` +
"\n/////////////////////////"
);
console.log(
"///////////////////////////////////\n uploadPDFAppealFiles: \n" +
`tmp/${appealBodyObj.pinswg_name}.pdf` +
"\n" +
containerID +
"\n" +
appealBodyObj.pinswg_name +
"\n" +
"\n/////////////////////////"
);
uploadPDFAppealFiles(
`tmp/${appealBodyObj.pinswg_name}.pdf`,
containerID,
appealBodyObj.pinswg_name
);
// to do upload file to storage account
// then remove from local folder
// fs.unlinkSync( `tmp/${appealBodyObj.repfile_name}.pdf`,);
+4 -1
View File
@@ -58,7 +58,10 @@ ApiProxy.get(async (req, res) => {
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
const blobObj = await getRepsBlobs(containerName, casefolderID)
.then(async (data) => {
console.log("----------xxxxxx------", data);
console.log(
"\n////////////////////////////\n getRepsBlobs:",
data
);
let result = await downloadAllRepsFiles(containerName, data);
return res.status(200).json(result);
})
+7 -31
View File
@@ -90,40 +90,16 @@ const SignIn = (props) => {
);
};
// export async function getServerSideProps(context) {
// //console.log("-1-1-1-1-", context.query.callbackUrl, context.locale);
// //console.log("------ " + context.query.callbackUrl);
// // setCookie(context, "next-auth.callback-url", context.query.callbackUrl, {
// // path: "/",
// // });
// const csrfToken = await getCsrfToken(context);
// let callback =
// context.locale != "cy"
// ? process.env.NEXTAUTH_URL
// : "https://" + process.env.I18N_DOMAIN + ":3000";
// context.query.callbackUrl = callback;
// let formURL =
// new URL(callback).protocol +
// "//" +
// new URL(callback).hostname +
// ":" +
// new URL(callback).port; // +
// // "/api/auth/signin/email";
// //console.log("******", formURL, callback, csrfToken);
// return {
// props: { csrfToken: csrfToken, callbackUrl: formURL, redirect: true },
// };
// }
export async function getServerSideProps(context) {
const csrfToken = await getCsrfToken(context);
console.log("-1-1-1-1-", context.query.callbackUrl, context.locale);
console.log(
"\n//////////////////////\n",
"Sign in callbackurl: " + context.query.callbackUrl,
context.locale,
"\n//////////////////////\n"
);
let formURL = context.query.callbackUrl;
console.log("formUrl:", formURL);
//console.log("formUrl:", formURL);
formURL = typeof formURL == "undefined" ? null : formURL;
return {
+11 -2
View File
@@ -137,7 +137,12 @@ export const getServerSideProps = wrapper.getServerSideProps(
const { req, res } = ctx;
const { cookies } = req;
console.log("/newappeal - cookies ", cookies);
console.log(
"\n////////////////////////////\n",
"/newappeal - cookies ",
cookies,
"\n////////////////////////////\n"
);
let thisSession = await getSession(ctx);
//console.log("nextAuth Session:", thisSession);
@@ -172,7 +177,11 @@ export const getServerSideProps = wrapper.getServerSideProps(
]
);
console.log("wewerwe s s", accountDetails);
console.log(
"\n////////////////////////////\n Acccount Details:",
accountDetails,
"\n////////////////////////////\n"
);
// const lpaData = require("../../data/lpa.json");
// const appealTypeData = require("../../data/appealtypes.json");