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

@@ -10,13 +10,13 @@ import { PathToRoFolder } from "../util/pathGenerators";
export async function JobsMoveMedia(req: Request, res: Response) {
const jobid: string = (req.body.jobid || "").trim();
const from_ro: string = (req.body.from_ro || "").trim();
const from_jobid: string = (req.body.from_jobid || "").trim();
const files: string[] = req.body.files; //Just file names.
//Validate the request is valid and contains everything that it needs.
if (from_ro === "") {
res.status(400).json({ error: "from_ro must be specified. " });
if (from_jobid === "") {
res.status(400).json({ error: "from_jobid must be specified. " });
return;
}
if (files.length === 0) {
@@ -31,14 +31,14 @@ export async function JobsMoveMedia(req: Request, res: Response) {
files.forEach((file) => {
movingQueue.push(
fs.move(
path.join(FolderPaths.Jobs, from_ro, file),
path.join(FolderPaths.Jobs, from_jobid, file),
path.join(FolderPaths.Jobs, jobid, file)
)
);
movingQueue.push(
fs.move(
path.join(FolderPaths.Jobs, from_ro, FolderPaths.ThumbsSubDir, file),
path.join(FolderPaths.Jobs, from_jobid, FolderPaths.ThumbsSubDir, file),
path.join(FolderPaths.Jobs, jobid, FolderPaths.ThumbsSubDir, file)
)
);