Added additional time logging.

This commit is contained in:
Patrick Fic
2022-05-17 15:52:49 -07:00
parent fa0213ce99
commit 6173dc188d
8 changed files with 2237 additions and 1766 deletions

View File

@@ -24,7 +24,12 @@ export const BillsMediaUploadMulter = multer({
const jobid: string = (req.body.jobid || "").trim();
const DestinationFolder: string = PathToRoBillsFolder(jobid);
fs.ensureDirSync(DestinationFolder);
cb(null, DestinationFolder);
cb(
jobid === "" || jobid === null
? new Error("Job ID not specified.")
: null,
DestinationFolder
);
},
filename: function (req, file, cb) {
logger.info("Uploading file: ", {
@@ -32,7 +37,12 @@ export const BillsMediaUploadMulter = multer({
});
const invoice_number: string = (req.body.invoice_number || "").trim();
cb(null, generateUniqueBillFilename(file, invoice_number));
cb(
invoice_number === "" || invoice_number === null
? new Error("Invoice number not specified.")
: null,
generateUniqueBillFilename(file, invoice_number)
);
},
}),
});