TASK22102: slice4 larger file set + production detail suppression
This commit is contained in:
@@ -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"
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user