changed file storage path

This commit is contained in:
Julian Krauser 2025-01-04 09:35:35 +01:00
parent dd72f37856
commit f16c5d91ba
5 changed files with 8 additions and 6 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

@ -39,7 +39,7 @@ services:
- CLUB_NAME=<tobemodified> - CLUB_NAME=<tobemodified>
- CLUB_WEBSITE=<tobemodified> - CLUB_WEBSITE=<tobemodified>
volumes: volumes:
- <volume|local path>:/app/export - <volume|local path>:/app/files
networks: networks:
- ff_internal - ff_internal
depends_on: depends_on:

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[]) {