TASK22102: slice4 larger file set + production detail suppression

This commit is contained in:
2026-03-17 13:06:28 +00:00
parent 3cbd876b77
commit e68319f16c
8 changed files with 122 additions and 23 deletions
+17 -4
View File
@@ -101,6 +101,7 @@ import { statement_pdf } from "../../../components/pdftemplates/statement_pdf";
import { writtenStatement_pdf } from "../../../components/pdftemplates/writtenStatement_pdf";
import { other_pdf } from "../../../components/pdftemplates/other_pdf";
import { consoleLogger } from "../../../actions/core/logger";
import { respondError, respondSuccess } from "../middleware/apiResponse";
//const ApiProxy = nextConnect();
// ApiProxy.use(middleware);
@@ -183,14 +184,22 @@ export default async function handler(req, res) {
}
if (typeof checkHash === "undefined" || checkHash.length === 0) {
return res.status(400).json();
return respondError(res, {
status: 400,
code: "HASH_REQUIRED",
message: "hash is required"
});
}
if (
hashAPIPath(checkquerypath) !=
(checkquerypath.indexOf("?") > -1 ? "&hash=" : "?hash=") + checkHash
) {
return res.status(400).json();
return respondError(res, {
status: 400,
code: "INVALID_HASH",
message: "Invalid hash"
});
}
//console.log("-------", checkHash);
@@ -349,7 +358,7 @@ export default async function handler(req, res) {
return res.status(200).send(renderedPDFBuffer);
}
return res.status(200).json({
return respondSuccess(res, {
status: "success",
data: data,
path: `${caseRef}/${reqBodyobj.repfile_name}/files/${reqBodyobj.repfile_name}.pdf`
@@ -357,6 +366,10 @@ export default async function handler(req, res) {
})
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
return respondError(res, {
status: 400,
code: "GENERATE_PDF_FAILED",
message: "Failed to generate PDF"
});
});
}