Merged PR 2121: missing case ref failing sip reps pdf

missing case ref failing sip reps pdf

Related work items: #21254
This commit is contained in:
Robert Bond
2026-02-20 16:17:22 +00:00
3 changed files with 81 additions and 77 deletions
+4 -3
View File
@@ -125,8 +125,8 @@ SHOWMAPS = true
API_ROOT = "http://localhost:3000" API_ROOT = "http://localhost:3000"
CY_API_ROOT = "http://cymru.local:3000" CY_API_ROOT = "http://cymru.local:3000"
I18N_DOMAIN = "cymru.local" I18N_DOMAIN = "cymru.local"
DOCAPI_OFFLINE = "07:00:00,16:00:00" # DOCAPI_OFFLINE = "07:00:00,16:00:00"
# DOCAPI_OFFLINE = "01:00:00,04:00:00" DOCAPI_OFFLINE = "01:00:00,04:00:00"
SHOWFILTERDOCS = true SHOWFILTERDOCS = true
@@ -191,7 +191,8 @@ AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwdevuks.blob.core.windows.net
// New test key // New test key
AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwtestuks" AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwtestuks"
AZURE_STORAGE_ACCOUNT_KEY = 5NdDO9GGlbTFLHFOXZRw8H2C0Ow5bFTvHwUHEbStyzg2mbd1uwHSeBSvM/dkN+HfdwrFzqAkwL5P+AStdO6cig== # AZURE_STORAGE_ACCOUNT_KEY = 5NdDO9GGlbTFLHFOXZRw8H2C0Ow5bFTvHwUHEbStyzg2mbd1uwHSeBSvM/dkN+HfdwrFzqAkwL5P+AStdO6cig==
AZURE_STORAGE_ACCOUNT_KEY = bqJAz5pYQVGee8dnVhlsqW+xHwinNTjgY2AmojNyB+d4uAotMR20WcO4Op13yB+9dFaXAkkjtIA4+AStHT/IYg==
AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwtestuks.blob.core.windows.net AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwtestuks.blob.core.windows.net
// New preprod key // New preprod key
+72 -69
View File
@@ -11,7 +11,7 @@ const {
ContainerSASPermissions, ContainerSASPermissions,
generateBlobSASQueryParameters, generateBlobSASQueryParameters,
SASProtocol, SASProtocol
} = require("@azure/storage-blob"); } = require("@azure/storage-blob");
const { const {
QueueServiceClient, QueueServiceClient,
@@ -23,7 +23,7 @@ const {
generateAccountSASQueryParameters, generateAccountSASQueryParameters,
generateQueueSASQueryParameters, generateQueueSASQueryParameters,
StorageSharedKeyCredential, StorageSharedKeyCredential,
QueueClient, QueueClient
} = require("@azure/storage-queue"); } = require("@azure/storage-queue");
const STORAGE_PATH = process.env.AZURE_PEDW_STORAGE_ENDPOINT; const STORAGE_PATH = process.env.AZURE_PEDW_STORAGE_ENDPOINT;
const STORAGE_CONTAINER = process.env.AZURE_PEDW_CONTAINER; const STORAGE_CONTAINER = process.env.AZURE_PEDW_CONTAINER;
@@ -67,7 +67,7 @@ export const createContainerSas = async (containerName) => {
permissions: ContainerSASPermissions.parse(containerPermissions), permissions: ContainerSASPermissions.parse(containerPermissions),
protocol: SASProtocol.HttpsAndHttp, protocol: SASProtocol.HttpsAndHttp,
startsOn: TEN_MINUTES_BEFORE_NOW, startsOn: TEN_MINUTES_BEFORE_NOW,
expiresOn: TEN_MINUTES_AFTER_NOW, expiresOn: TEN_MINUTES_AFTER_NOW
}; };
// console.log( // console.log(
@@ -126,7 +126,7 @@ export const createBlobSas = async (containerName, blobName) => {
permissions: BlobSASPermissions.parse(blobPermissionsForAnonymousUser), permissions: BlobSASPermissions.parse(blobPermissionsForAnonymousUser),
protocol: SASProtocol.HttpsAndHttp, protocol: SASProtocol.HttpsAndHttp,
startsOn: TEN_MINUTES_BEFORE_NOW, startsOn: TEN_MINUTES_BEFORE_NOW,
expiresOn: TEN_MINUTES_AFTER_NOW, expiresOn: TEN_MINUTES_AFTER_NOW
}; };
const sasToken = generateBlobSASQueryParameters( const sasToken = generateBlobSASQueryParameters(
@@ -187,7 +187,7 @@ export const getBlobs = async (containerName, casefolderID) => {
const blobObj = []; const blobObj = [];
for await (const blob of containerClient.listBlobsFlat({ for await (const blob of containerClient.listBlobsFlat({
prefix: casefolderID + "/files/", prefix: casefolderID + "/files/"
})) { })) {
let blobDocumentType = blob.name let blobDocumentType = blob.name
.split("/")[2] .split("/")[2]
@@ -241,7 +241,7 @@ export const getBlobs = async (containerName, casefolderID) => {
containerName + containerName +
"&casefolderID=" + "&casefolderID=" +
casefolderID casefolderID
), )
}); });
} }
//console.log("blobObj:", blobObj); //console.log("blobObj:", blobObj);
@@ -277,7 +277,7 @@ export const createBlob = async (formContent, containerName, caseref) => {
const tags = { const tags = {
containerid: containerName, containerid: containerName,
caseID: caseID, caseID: caseID,
blobType: "Appeal", blobType: "Appeal"
}; };
//console.log("the tags:", tags); //console.log("the tags:", tags);
@@ -310,7 +310,7 @@ export const createRepBlob = async (formContent, containerName, caseref) => {
const tags = { const tags = {
containerid: containerName, containerid: containerName,
caseID: formContent.ticketnumber || formContent.caseRef, caseID: formContent.ticketnumber || formContent.caseRef,
blobType: "Representation", blobType: "Representation"
}; };
//console.log("the tags:", tags); //console.log("the tags:", tags);
@@ -356,7 +356,7 @@ export const createAppealPDFBlob = async (
const uploadOptions = { const uploadOptions = {
blockSize: 4 * 1024 * 1024, // 4 MiB max block size blockSize: 4 * 1024 * 1024, // 4 MiB max block size
concurrency: 2, // maximum number of parallel transfer workers concurrency: 2, // maximum number of parallel transfer workers
maxSingleShotSize: 8 * 1024 * 1024, // 8 MiB initial transfer size maxSingleShotSize: 8 * 1024 * 1024 // 8 MiB initial transfer size
}; };
console.log("blobName:", blobName); console.log("blobName:", blobName);
const blockBlobClient = containerClient.getBlockBlobClient(blobName); const blockBlobClient = containerClient.getBlockBlobClient(blobName);
@@ -371,7 +371,7 @@ export const createAppealPDFBlob = async (
caseID: caseID, caseID: caseID,
blobType: "Appeal PDF", blobType: "Appeal PDF",
ishareLocation: whichLocation, ishareLocation: whichLocation,
documentLocationId: whichLocation, documentLocationId: whichLocation
}; };
//console.log("the tags:", tags); //console.log("the tags:", tags);
@@ -405,7 +405,7 @@ export const createRepPDFBlob = async (
const uploadOptions = { const uploadOptions = {
blockSize: 4 * 1024 * 1024, // 4 MiB max block size blockSize: 4 * 1024 * 1024, // 4 MiB max block size
concurrency: 2, // maximum number of parallel transfer workers concurrency: 2, // maximum number of parallel transfer workers
maxSingleShotSize: 8 * 1024 * 1024, // 8 MiB initial transfer size maxSingleShotSize: 8 * 1024 * 1024 // 8 MiB initial transfer size
}; };
console.log("blobName:", blobName); console.log("blobName:", blobName);
@@ -417,23 +417,23 @@ export const createRepPDFBlob = async (
repName.indexOf("_IP_") > 0 repName.indexOf("_IP_") > 0
? "846040005" ? "846040005"
: repName.indexOf("_Statement_") > 0 : repName.indexOf("_Statement_") > 0
? "846040002" ? "846040002"
: repName.indexOf("_Questionnaire_") > 0 : repName.indexOf("_Questionnaire_") > 0
? "846040001" ? "846040001"
: repName.indexOf("_Comments") > 0 : repName.indexOf("_Comments") > 0
? "846040003" ? "846040003"
: repName.indexOf("_Impact") > 0 : repName.indexOf("_Impact") > 0
? "846040029" ? "846040029"
: repName.indexOf("_Consultation_Response_") > 0 : repName.indexOf("_Consultation_Response_") > 0
? "846040036" ? "846040036"
: "846040002"; : "846040002";
const tags = { const tags = {
containerid: containerName, containerid: containerName,
caseID: caseID, caseID: caseID,
blobType: "Representation PDF", blobType: "Representation PDF",
ishareLocation: whichLocation, ishareLocation: whichLocation,
documentLocationId: whichLocation, documentLocationId: whichLocation
}; };
//console.log("the tags:", tags); //console.log("the tags:", tags);
@@ -447,7 +447,7 @@ export const deleteBlob = async (containerName, blobName) => {
const creds = new DefaultAzureCredential(); const creds = new DefaultAzureCredential();
const options = { const options = {
deleteSnapshots: "include", // or 'only' deleteSnapshots: "include" // or 'only'
}; };
const containerToken = await createContainerSas(containerName); const containerToken = await createContainerSas(containerName);
@@ -467,7 +467,7 @@ export const deleteBlobCase = async (containerName, blobName) => {
const creds = new DefaultAzureCredential(); const creds = new DefaultAzureCredential();
const options = { const options = {
deleteSnapshots: "include", // or 'only' deleteSnapshots: "include" // or 'only'
}; };
const containerToken = await createContainerSas(containerName); const containerToken = await createContainerSas(containerName);
@@ -479,7 +479,7 @@ export const deleteBlobCase = async (containerName, blobName) => {
console.log("blob to delete:", blobName); console.log("blob to delete:", blobName);
for await (const blob of containerClient.listBlobsFlat({ for await (const blob of containerClient.listBlobsFlat({
prefix: blobName, prefix: blobName
})) { })) {
console.log(" ------ :", blob.name); console.log(" ------ :", blob.name);
containerClient.deleteBlob(blob.name); containerClient.deleteBlob(blob.name);
@@ -497,7 +497,7 @@ export const deleteBlobRep = async (containerName, blobName) => {
const creds = new DefaultAzureCredential(); const creds = new DefaultAzureCredential();
const options = { const options = {
deleteSnapshots: "include", // or 'only' deleteSnapshots: "include" // or 'only'
}; };
const containerToken = await createContainerSas(containerName); const containerToken = await createContainerSas(containerName);
@@ -507,7 +507,7 @@ export const deleteBlobRep = async (containerName, blobName) => {
console.log("blob to delete:", blobName); console.log("blob to delete:", blobName);
for await (const blob of containerClient.listBlobsFlat({ for await (const blob of containerClient.listBlobsFlat({
prefix: blobName, prefix: blobName
})) { })) {
console.log("------ :", blob.name); console.log("------ :", blob.name);
const blockBlobClient = containerClient.getBlockBlobClient(blob.name); const blockBlobClient = containerClient.getBlockBlobClient(blob.name);
@@ -602,21 +602,24 @@ export const uploadFile = async (formContent, containerName, foldername) => {
) )
? "846040000" ? "846040000"
: files[prop][0].fieldName.indexOf("_IP_") > 0 : files[prop][0].fieldName.indexOf("_IP_") > 0
? "846040005" ? "846040005"
: files[prop][0].fieldName.indexOf("_Statement_") > 0 : files[prop][0].fieldName.indexOf("_Statement_") > 0
? "846040002" ? "846040002"
: files[prop][0].fieldName.indexOf("_Questionnaire_") > : files[prop][0].fieldName.indexOf(
0 "_Questionnaire_"
? "846040001" ) > 0
: files[prop][0].fieldName.indexOf("_Comments_") > 0 ? "846040001"
? "846040003" : files[prop][0].fieldName.indexOf("_Comments_") >
: files[prop][0].fieldName.indexOf("_Impact_") > 0 0
? "846040001" ? "846040003"
: files[prop][0].fieldName.indexOf( : files[prop][0].fieldName.indexOf("_Impact_") >
"_Consultation_Response_" 0
) > 0 ? "846040001"
? "846040036" : files[prop][0].fieldName.indexOf(
: "846040000"; "_Consultation_Response_"
) > 0
? "846040036"
: "846040000";
const tags = { const tags = {
containerid: containerName, containerid: containerName,
@@ -624,7 +627,7 @@ export const uploadFile = async (formContent, containerName, foldername) => {
documentType: files[prop][0].fieldName.split(".")[1], documentType: files[prop][0].fieldName.split(".")[1],
blobType: "RepresentationFile", blobType: "RepresentationFile",
ishareLocation: whichLocation, ishareLocation: whichLocation,
documentLocationId: whichLocation, documentLocationId: whichLocation
}; };
const withTags = blockBlobClient.setTags(tags); const withTags = blockBlobClient.setTags(tags);
const withMeta = blockBlobClient.setMetadata(tags); const withMeta = blockBlobClient.setMetadata(tags);
@@ -735,14 +738,14 @@ export const uploadSingleFile = async (
{ {
pattern: pattern:
/_Statement_of_Case|_-_Statement_of_Case|_-_Application_Form|_-_Site_Ownership_Certificate|_-_Decision_Notice|_-_Site_Location_Plan|_-_Plans_Drawing_Documents|_-_Additional_Plans_Drawings_Documents|_-_Design_and_Access_Statement|_-_NSB_LPA_Additional_Documents|_-_LPA_Correspondence|_-_LPA_Original_Permission|_-_LPA's_Registration_Letter|_-_Environmental_Statement|_-_Cost_of_Application|_-_Other_Relevant_Material|_-_S106_Agreement_or_Unilateral_Undertaking/, /_Statement_of_Case|_-_Statement_of_Case|_-_Application_Form|_-_Site_Ownership_Certificate|_-_Decision_Notice|_-_Site_Location_Plan|_-_Plans_Drawing_Documents|_-_Additional_Plans_Drawings_Documents|_-_Design_and_Access_Statement|_-_NSB_LPA_Additional_Documents|_-_LPA_Correspondence|_-_LPA_Original_Permission|_-_LPA's_Registration_Letter|_-_Environmental_Statement|_-_Cost_of_Application|_-_Other_Relevant_Material|_-_S106_Agreement_or_Unilateral_Undertaking/,
value: "846040000", value: "846040000"
}, },
{ pattern: /_IP_/, value: "846040005" }, { pattern: /_IP_/, value: "846040005" },
{ pattern: /_Statement_/, value: "846040002" }, { pattern: /_Statement_/, value: "846040002" },
{ pattern: /_Questionnaire_/, value: "846040001" }, { pattern: /_Questionnaire_/, value: "846040001" },
{ pattern: /_Comments_/, value: "846040003" }, { pattern: /_Comments_/, value: "846040003" },
{ pattern: /_Impact_/, value: "846040001" }, { pattern: /_Impact_/, value: "846040001" },
{ pattern: /_Consultation_Response_/, value: "846040036" }, { pattern: /_Consultation_Response_/, value: "846040036" }
]; ];
// Find a matching pattern or fallback to default // Find a matching pattern or fallback to default
@@ -763,7 +766,7 @@ export const uploadSingleFile = async (
documentType: files[prop][0].fieldName.split(".")[1], documentType: files[prop][0].fieldName.split(".")[1],
blobType: "RepresentationFile", blobType: "RepresentationFile",
ishareLocation: whichLocation, ishareLocation: whichLocation,
documentLocationId: whichLocation, documentLocationId: whichLocation
}; };
const withTags = await blockBlobClient.setTags(tags); const withTags = await blockBlobClient.setTags(tags);
const withMeta = await blockBlobClient.setMetadata(tags); const withMeta = await blockBlobClient.setMetadata(tags);
@@ -800,7 +803,7 @@ export const uploadRepFiles = async (
const tags = { const tags = {
containerid: containerName, containerid: containerName,
caseID: formContent.split("tmp/")[0], caseID: formContent.split("tmp/")[0],
documentType: "Rep docs", documentType: "Rep docs"
}; };
console.log(tags); console.log(tags);
const withTags = await blockBlobClient.setTags(tags); const withTags = await blockBlobClient.setTags(tags);
@@ -845,7 +848,7 @@ export const uploadPDFRepFiles = async (
containerid: containerName, containerid: containerName,
caseID: foldername.split("/")[0], caseID: foldername.split("/")[0],
documentType: repType, documentType: repType,
blobType: "RepresentationPDF", blobType: "RepresentationPDF"
}; };
//console.log("the tags:", tags); //console.log("the tags:", tags);
@@ -898,7 +901,7 @@ export const uploadPDFAppealFiles = async (
const tags = { const tags = {
containerid: containerName, containerid: containerName,
caseID: foldername.split("/")[0], caseID: foldername.split("/")[0],
blobType: "AppealPDF", blobType: "AppealPDF"
}; };
//console.log("the tags:", tags); //console.log("the tags:", tags);
@@ -937,7 +940,7 @@ export const uploadPDFCaseFiles = async (
const tags = { const tags = {
containerid: containerName, containerid: containerName,
caseID: foldername.split("/")[0], caseID: foldername.split("/")[0],
blobType: "AppealPDF", blobType: "AppealPDF"
}; };
//console.log("the tags:", tags); //console.log("the tags:", tags);
@@ -1143,7 +1146,7 @@ export const downloadAllRepsFiles = async (containerName, repsBlobObj) => {
return { return {
"@odata.count": blobCount, "@odata.count": blobCount,
"value": downloaded, "value": downloaded
}; };
}; };
@@ -1182,7 +1185,7 @@ export const getCaseBlob = async (
const tags = { const tags = {
containerid: containerName, containerid: containerName,
caseID: caseReference, caseID: caseReference,
blobType: "Case", blobType: "Case"
}; };
//console.log("the tags:", tags); //console.log("the tags:", tags);
@@ -1213,7 +1216,7 @@ export const getProgressBlobs = async (containerName, caseReference) => {
let blobCount = 0; let blobCount = 0;
for await (const blob of containerClient.listBlobsFlat({ for await (const blob of containerClient.listBlobsFlat({
prefix: caseReference, prefix: caseReference
})) { })) {
blobCount++; blobCount++;
} }
@@ -1226,7 +1229,7 @@ export const getProgressBlobs = async (containerName, caseReference) => {
let blobObj = []; let blobObj = [];
for await (const blob of containerClient.listBlobsFlat({ for await (const blob of containerClient.listBlobsFlat({
prefix: caseReference + "/" + caseReference + "_appeal.json", prefix: caseReference + "/" + caseReference + "_appeal.json"
})) { })) {
console.log("getProgressBlobs in here", blob.name.split("/")); console.log("getProgressBlobs in here", blob.name.split("/"));
blobObj.push({ blobObj.push({
@@ -1259,14 +1262,14 @@ export const getProgressBlobs = async (containerName, caseReference) => {
containerName + containerName +
"&casefolderID=" + "&casefolderID=" +
caseReference caseReference
), )
}); });
} }
blobObj = _.sortBy(blobObj, [ blobObj = _.sortBy(blobObj, [
function (o) { function (o) {
return o.lastModified; return o.lastModified;
}, }
]).reverse()[0]; ]).reverse()[0];
return blobObj; return blobObj;
@@ -1295,7 +1298,7 @@ export const getAllProgressBlobs = async (containerName) => {
blob.name.split("/")[0] + blob.name.split("/")[0] +
"/" + "/" +
blob.name.split("/")[0] + blob.name.split("/")[0] +
"_case.json", "_case.json"
// "isCurrentVersion": blob.isCurrentVersion, // "isCurrentVersion": blob.isCurrentVersion,
// "contentLength": blob.properties.contentLength, // "contentLength": blob.properties.contentLength,
// "contentType": blob.contentType, // "contentType": blob.contentType,
@@ -1352,7 +1355,7 @@ export const getRepsBlobs = async (containerName) => {
includeMetadata: true, includeMetadata: true,
includeSnapshots: false, includeSnapshots: false,
includeTags: true, includeTags: true,
includeVersions: true, includeVersions: true
}; };
let blobObj = []; let blobObj = [];
@@ -1367,7 +1370,7 @@ export const getRepsBlobs = async (containerName) => {
blobObj.push({ blobObj.push({
"name": blob.name.split("/")[2], "name": blob.name.split("/")[2],
"path": blob.name, "path": blob.name,
"size": blobClient.getProperties().contentLength, "size": blobClient.getProperties().contentLength
}); });
} }
@@ -1391,7 +1394,7 @@ export const getRepsFilesBlobs = async (
const blobObj = []; const blobObj = [];
for await (const blob of containerClient.listBlobsFlat({ for await (const blob of containerClient.listBlobsFlat({
prefix: casefolderID + "/" + filenamePrefix + "/files/", prefix: casefolderID + "/" + filenamePrefix + "/files/"
})) { })) {
let blobDocumentType = blob.name let blobDocumentType = blob.name
.split("/")[2] .split("/")[2]
@@ -1454,7 +1457,7 @@ export const getRepsFilesBlobs = async (
blob.name.split("/")[0] + blob.name.split("/")[0] +
"/" + "/" +
blob.name.split("/")[1] blob.name.split("/")[1]
), )
}); });
} }
console.log("blobObj:", blobObj); console.log("blobObj:", blobObj);
@@ -1497,7 +1500,7 @@ export const createQueueSas = async (queueName) => {
var sas_signature_val = { var sas_signature_val = {
expiresOn: TEN_MINUTES_AFTER_NOW, expiresOn: TEN_MINUTES_AFTER_NOW,
permissions: permission, permissions: permission,
queueName: queueName, queueName: queueName
}; };
const sasToken = generateQueueSASQueryParameters( const sasToken = generateQueueSASQueryParameters(
@@ -1541,7 +1544,7 @@ export const createCaseCompleteMessage = async (
caseReference + caseReference +
"_case.json", "_case.json",
filespath: filespath:
endpointURL + "/" + containerName + "/" + caseReference + "/files", endpointURL + "/" + containerName + "/" + caseReference + "/files"
// uploadUrl: fileRecord.uploadUrl, // uploadUrl: fileRecord.uploadUrl,
// filename: fileRecord.file.name, // filename: fileRecord.file.name,
@@ -1602,7 +1605,7 @@ export const createRepCompleteMessage = async (
caseReference + caseReference +
"/" + "/" +
filename + filename +
"/files", "/files"
}; };
console.log("======================", message, "====================="); console.log("======================", message, "=====================");
@@ -1628,7 +1631,7 @@ export const listContainers = async (
includeDeleted: false, includeDeleted: false,
includeMetadata: true, includeMetadata: true,
includeSystem: true, includeSystem: true,
prefix: containerNamePrefix, prefix: containerNamePrefix
}; };
console.log( console.log(
"\n\n\n=================================================\n", "\n\n\n=================================================\n",
@@ -1671,7 +1674,7 @@ export const listBlobHierarchical = async (
includeTags: true, // include indexable tags includeTags: true, // include indexable tags
includeUncommitedBlobs: false, // include uncommitted blobs includeUncommitedBlobs: false, // include uncommitted blobs
includeVersions: false, // include all blob version includeVersions: false, // include all blob version
prefix: "", // filter by blob name prefix prefix: "" // filter by blob name prefix
}; };
let i = 1; let i = 1;
@@ -1757,7 +1760,7 @@ export async function listBlobHierarchicalForUser(containerClient) {
? lastModifiedDate.toISOString() ? lastModifiedDate.toISOString()
: null, : null,
createdOn: createdOnDate ? createdOnDate.toISOString() : null, createdOn: createdOnDate ? createdOnDate.toISOString() : null,
displayDate, displayDate
}); });
} }
return blobNames; return blobNames;
@@ -1772,7 +1775,7 @@ export async function listContainersForUser(
includeDeleted: false, includeDeleted: false,
includeMetadata: true, includeMetadata: true,
includeSystem: true, includeSystem: true,
prefix: containerNamePrefix, prefix: containerNamePrefix
}; };
const results = []; const results = [];
@@ -1790,7 +1793,7 @@ export async function listContainersForUser(
if (blobNames && blobNames.length > 0) { if (blobNames && blobNames.length > 0) {
results.push({ results.push({
container: containerItem.name, container: containerItem.name,
blobs: blobNames, blobs: blobNames
}); });
} }
} }
+5 -5
View File
@@ -79,7 +79,7 @@ import {
createRepBlob, createRepBlob,
uploadFile, uploadFile,
uploadPDFRepFiles, uploadPDFRepFiles,
createRepPDFBlob, createRepPDFBlob
} from "../../../actions/azurestorage"; } from "../../../actions/azurestorage";
import { hashAPIPath } from "../../../actions"; import { hashAPIPath } from "../../../actions";
@@ -89,7 +89,7 @@ import ReactPDF, {
Text, Text,
View, View,
StyleSheet, StyleSheet,
PDFViewer, PDFViewer
} from "@react-pdf/renderer"; } from "@react-pdf/renderer";
import middleware from "../middleware/middleware"; import middleware from "../middleware/middleware";
import nextConnect from "next-connect"; import nextConnect from "next-connect";
@@ -143,7 +143,7 @@ export default async function handler(req, res) {
newblobList = removeNullObjects(newblobList); newblobList = removeNullObjects(newblobList);
Object.assign(blobList, { Object.assign(blobList, {
"filesList": newblobList, "filesList": newblobList
}); });
return blobList; return blobList;
@@ -166,7 +166,7 @@ export default async function handler(req, res) {
var containerID = reqBodyobj.containerID; var containerID = reqBodyobj.containerID;
var casefolderID = reqBodyobj.casefolderID; var casefolderID = reqBodyobj.casefolderID;
var caseRef = reqBodyobj.ticketnumber; var caseRef = reqBodyobj.ticketnumber || reqBodyobj.caseRef;
var representationType = reqBodyobj.representationType; var representationType = reqBodyobj.representationType;
var repRaiser = reqBodyobj.lastname; var repRaiser = reqBodyobj.lastname;
var localeSelect = reqBodyobj.locale; var localeSelect = reqBodyobj.locale;
@@ -315,7 +315,7 @@ export default async function handler(req, res) {
return res.status(200).json({ return res.status(200).json({
status: "success", status: "success",
data: data, data: data,
path: `${caseRef}/${reqBodyobj.repfile_name}/files/${reqBodyobj.repfile_name}.pdf`, path: `${caseRef}/${reqBodyobj.repfile_name}/files/${reqBodyobj.repfile_name}.pdf`
}); });
}) })
.catch((error) => { .catch((error) => {