Update media file interface and how bills are returned.

This commit is contained in:
Patrick Fic
2022-05-05 15:45:42 -07:00
parent 7754dc4653
commit 270be1d360
10 changed files with 101 additions and 1987 deletions

View File

@@ -56,13 +56,13 @@ export async function BillsUploadMedia(req: Request, res: Response) {
//for each file.path, generate the thumbnail.
(req.files as Express.Multer.File[]).forEach((file) => {
const vendor: string = (req.body.vendor || "").trim();
const vendorid: string = (req.body.vendorid || "").trim();
const invoice_number: string = (req.body.invoice_number || "").trim();
copyQueue.push(
(async () => {
const target: string = path.join(
PathToVendorBillsFile(vendor),
PathToVendorBillsFile(vendorid),
file.filename
);
await fs.ensureDir(path.dirname(target));
@@ -72,9 +72,8 @@ export async function BillsUploadMedia(req: Request, res: Response) {
//Copy Queue is not awaited - we don't care if it finishes before we serve up the thumbnails from the jobs directory.
});
}
res.sendStatus(200);
// BillsListMedia(req, res);
BillsListMedia(req, res);
}
} catch (err) {
res.status(500).send(err);