Add logging, pdf thumbs
This commit is contained in:
@@ -14,37 +14,27 @@ export async function JobsListMedia(req: Request, res: Response) {
|
||||
})
|
||||
).filter((f) => f.isFile() && !/(^|\/)\.[^\/\.]/g.test(f.name));
|
||||
|
||||
const thumbnailGenerationQueue: Promise<void>[] = [];
|
||||
|
||||
const ret: MediaFile[] = filesList.map((file) => {
|
||||
thumbnailGenerationQueue.push(
|
||||
GenerateThumbnail(
|
||||
path.join(FolderPaths.Jobs, ro_number, file.name),
|
||||
path.join(
|
||||
FolderPaths.Jobs,
|
||||
const ret: MediaFile[] = await Promise.all(
|
||||
filesList.map(async (file) => {
|
||||
const thumbPath: string = await GenerateThumbnail(
|
||||
path.join(FolderPaths.Jobs, ro_number, file.name)
|
||||
);
|
||||
return {
|
||||
src: GenerateUrl([
|
||||
FolderPaths.StaticPath,
|
||||
FolderPaths.JobsFolder,
|
||||
ro_number,
|
||||
FolderPaths.ThumbsSubDir,
|
||||
file.name
|
||||
)
|
||||
)
|
||||
);
|
||||
return {
|
||||
src: GenerateUrl([
|
||||
FolderPaths.StaticPath,
|
||||
FolderPaths.JobsFolder,
|
||||
ro_number,
|
||||
file.name,
|
||||
]),
|
||||
thumb: GenerateUrl([
|
||||
FolderPaths.StaticPath,
|
||||
FolderPaths.JobsFolder,
|
||||
ro_number,
|
||||
FolderPaths.ThumbsSubDir,
|
||||
file.name,
|
||||
]),
|
||||
};
|
||||
});
|
||||
await Promise.all(thumbnailGenerationQueue);
|
||||
file.name,
|
||||
]),
|
||||
thumb: GenerateUrl([
|
||||
FolderPaths.StaticPath,
|
||||
FolderPaths.JobsFolder,
|
||||
ro_number,
|
||||
thumbPath,
|
||||
]),
|
||||
};
|
||||
})
|
||||
);
|
||||
|
||||
res.json(ret);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user