Change RO number to jobid.

This commit is contained in:
Patrick Fic
2022-05-04 18:13:21 -07:00
parent 05a8c90f03
commit 7754dc4653
10 changed files with 40 additions and 36 deletions

View File

@@ -7,6 +7,7 @@ import ft from "file-type";
import core from "file-type/core";
import GenerateUrl from "./MediaUrlGen";
import { FolderPaths } from "./serverInit";
import { logger } from "../server";
var Bluebird = require("bluebird");
Bluebird.promisifyAll(gm.prototype);
@@ -23,13 +24,13 @@ export default async function GenerateThumbnail(
FolderPaths.ThumbsSubDir,
path.parse(path.basename(file)).name + thumbnailExtension
);
try {
//Ensure the thumbs directory exists.
await fs.ensureDir(path.dirname(thumbPath));
try {
await access(thumbPath);
logger.debug("Thumbnail already exists for : " + thumbPath);
return path.relative(path.dirname(file), thumbPath);
} catch {}
@@ -39,6 +40,7 @@ export default async function GenerateThumbnail(
const fileOnDisk: Buffer = await fs.readFile(file);
await GeneratePdfThumbnail(file, thumbPath);
} else {
logger.debug("Thumbnail being created for : " + thumbPath);
const thumbnail = await imageThumbnail(file, {
responseType: "buffer",
height: 250,

View File

@@ -1,12 +1,12 @@
import path from "path";
import { FolderPaths } from "./serverInit";
export function PathToRoFolder(ro_number: string) {
return path.join(FolderPaths.Jobs, ro_number);
export function PathToRoFolder(jobid: string) {
return path.join(FolderPaths.Jobs, jobid);
}
export function PathToRoBillsFolder(ro_number: string) {
return path.join(FolderPaths.Jobs, ro_number, FolderPaths.BillsSubDir);
export function PathToRoBillsFolder(jobid: string) {
return path.join(FolderPaths.Jobs, jobid, FolderPaths.BillsSubDir);
}
export function PathToVendorBillsFile(vendor: string) {
return path.join(FolderPaths.Vendors, vendor);