import { hashAPIPath } from "../../../actions"; import { createCaseCompleteMessage, getProgressBlobs, downloadProgressFile, createBlob, } from "../../../actions/azurestorage"; import nextConnect from "next-connect"; import middleware from "../middleware/middleware"; const ApiProxy = nextConnect(); ApiProxy.use(middleware); ApiProxy.get(async (req, res) => { var containerName = req.query.container; var tempCaseRef = req.query.tempcaseref; var checkHash = req.query.hash; console.log("/////Create Case Message:\n", tempCaseRef, "\n//////////////"); // console.log(hashAPIPath(checkquerypath), checkHash); // console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); var checkquerypath = "/api/file/createappealcompletemessage_api?container=" + containerName + "&tempcaseref=" + tempCaseRef; // const blobProgress = await getProgressBlobs( // containerName, // tempCaseRef // ).then((data) => { // return downloadProgressFile(containerName, data.path, tempCaseRef); // }); // Object.assign(blobProgress, { // "appealComplete": true, // }); //http: if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) { await createCaseCompleteMessage(containerName, tempCaseRef) .then((data) => { //createBlob(JSON.stringify(blobProgress), containerName, tempCaseRef); return res.status(200).json(data); }) .catch((error) => { //console.log(error); return res.status(400).json(error); }); }); export const config = { api: { bodyParser: false, }, }; export default ApiProxy;