changed file storage path

This commit is contained in:
Julian Krauser 2025-01-04 09:34:45 +01:00
parent dd72f37856
commit 23e8fc3b8f
4 changed files with 7 additions and 5 deletions

View file

@ -2,5 +2,5 @@
node_modules/ node_modules/
dist/ dist/
.git/ .git/
export/ files/
.env .env

2
.gitignore vendored
View file

@ -130,6 +130,6 @@ dist
.yarn/install-state.gz .yarn/install-state.gz
.pnp.* .pnp.*
export files
.idea .idea

View file

@ -143,7 +143,9 @@ export async function getProtocolPrintoutByIdAndPrint(req: Request, res: Respons
let printout = await ProtocolPrintoutService.getById(printoutId, protocolId); let printout = await ProtocolPrintoutService.getById(printoutId, protocolId);
res.sendFile(process.cwd() + `/export/${printout.filename}.pdf`, { let filepath = FileSystemHelper.formatPath("protocol", printout.filename);
res.sendFile(filepath, {
headers: { headers: {
"Content-Type": "application/pdf", "Content-Type": "application/pdf",
}, },
@ -264,7 +266,7 @@ export async function createProtocolPrintoutById(req: Request, res: Response): P
let printout: CreateProtocolPrintoutCommand = { let printout: CreateProtocolPrintoutCommand = {
title, title,
iteration: iteration + 1, iteration: iteration + 1,
filename: FileSystemHelper.normalizePath("protocol", filename), filename: `${filename}.pdf`,
protocolId, protocolId,
}; };
await ProtocolPrintoutCommandHandler.create(printout); await ProtocolPrintoutCommandHandler.create(printout);

View file

@ -29,7 +29,7 @@ export abstract class FileSystemHelper {
} }
static formatPath(...args: string[]) { static formatPath(...args: string[]) {
return join(process.cwd(), "export", ...args); return join(process.cwd(), "files", ...args);
} }
static normalizePath(...args: string[]) { static normalizePath(...args: string[]) {