Package Updates

This commit is contained in:
Allan Carr
2024-07-23 09:49:47 -07:00
parent f295488195
commit 58055fd1b3
22 changed files with 1686 additions and 3807 deletions

View File

@@ -5,11 +5,7 @@ import { logger } from "../server";
import MediaFile from "../util/interfaces/MediaFile";
import ListableChecker from "../util/listableChecker";
import { PathToRoBillsFolder, PathToRoFolder } from "../util/pathGenerators";
import {
BillsRelativeFilePath,
FolderPaths,
JobRelativeFilePath,
} from "../util/serverInit";
import { BillsRelativeFilePath, FolderPaths, JobRelativeFilePath } from "../util/serverInit";
export async function JobsDeleteMedia(req: Request, res: Response) {
const jobid: string = (req.body.jobid || "").trim();
@@ -21,12 +17,12 @@ export async function JobsDeleteMedia(req: Request, res: Response) {
// Setup lists for both file locations
const jobFileList: fs.Dirent[] = (
await fs.readdir(PathToRoFolder(jobid), {
withFileTypes: true,
withFileTypes: true
})
).filter((f) => f.isFile() && ListableChecker(f));
const billFileList: fs.Dirent[] = (
await fs.readdir(PathToRoBillsFolder(jobid), {
withFileTypes: true,
withFileTypes: true
})
).filter((f) => f.isFile() && ListableChecker(f));
@@ -37,12 +33,7 @@ export async function JobsDeleteMedia(req: Request, res: Response) {
// File is in the set of requested files.
await fs.remove(JobRelativeFilePath(jobid, file.name));
await fs.remove(
path.join(
FolderPaths.Jobs,
jobid,
FolderPaths.ThumbsSubDir,
file.name.replace(/\.[^/.]+$/, ".png")
)
path.join(FolderPaths.Jobs, jobid, FolderPaths.ThumbsSubDir, file.name.replace(/\.[^/.]+$/, ".png"))
);
}
})