Added bills upload & list
This commit is contained in:
7
util/generateUniqueFilename.ts
Normal file
7
util/generateUniqueFilename.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import path from "path";
|
||||
|
||||
export default function (file: Express.Multer.File) {
|
||||
return `${file.originalname}-${Math.floor(Date.now() / 1000)}${path.extname(
|
||||
file.originalname
|
||||
)}`;
|
||||
}
|
||||
6
util/interfaces/MediaFile.ts
Normal file
6
util/interfaces/MediaFile.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
interface MediaFile {
|
||||
src: string;
|
||||
thumb: string;
|
||||
}
|
||||
|
||||
export default MediaFile;
|
||||
13
util/pathGenerators.ts
Normal file
13
util/pathGenerators.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import path from "path";
|
||||
import { FolderPaths } from "./serverInit";
|
||||
|
||||
export function PathToRoFolder(ro_number: string) {
|
||||
return path.join(FolderPaths.Jobs, ro_number);
|
||||
}
|
||||
|
||||
export function PathToRoBillsFolder(ro_number: string) {
|
||||
return path.join(FolderPaths.Jobs, ro_number, FolderPaths.BillsSubDir);
|
||||
}
|
||||
export function PathToVendorBillsFile(vendor: string) {
|
||||
return path.join(FolderPaths.Vendors, vendor);
|
||||
}
|
||||
@@ -16,6 +16,7 @@ export const FolderPaths = {
|
||||
Jobs: path.join(RootDirectory, JobsFolder),
|
||||
Vendors: path.join(RootDirectory, VendorsFolder),
|
||||
ThumbsSubDir: "/thumbs",
|
||||
BillsSubDir: "/bills",
|
||||
StaticPath: "/static",
|
||||
JobsFolder,
|
||||
VendorsFolder,
|
||||
|
||||
Reference in New Issue
Block a user