From 084decfc1070e038a1004bf2c291c2d03939a06e Mon Sep 17 00:00:00 2001 From: Bastian Wagner Date: Fri, 13 Mar 2026 15:23:33 +0100 Subject: [PATCH] config --- src/pdf/pdf.controller.ts | 4 ++-- src/storage/minio/minio.service.ts | 24 ++++++++++++++---------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/pdf/pdf.controller.ts b/src/pdf/pdf.controller.ts index 6294ad4..3988a02 100644 --- a/src/pdf/pdf.controller.ts +++ b/src/pdf/pdf.controller.ts @@ -17,11 +17,11 @@ export class PdfController { } @Post('keyhandover') - @Header('Content-Type', 'application/pdf') + // @Header('Content-Type', 'application/pdf') async generatePdf(@Res() res: Response, @Body() dto: KeyHandoverDto): Promise { const pdfBuffer = await this.pdfService.generatePdf(dto); - res.setHeader('Content-Disposition', 'inline; filename="test.pdf"'); + // res.setHeader('Content-Disposition', 'inline; filename="test.pdf"'); res.send(pdfBuffer); } diff --git a/src/storage/minio/minio.service.ts b/src/storage/minio/minio.service.ts index 915348a..77445aa 100644 --- a/src/storage/minio/minio.service.ts +++ b/src/storage/minio/minio.service.ts @@ -4,22 +4,26 @@ import { PutObjectCommand, S3Client } from '@aws-sdk/client-s3'; @Injectable() export class MinioService { - private readonly client: S3Client; + private client: S3Client; constructor(private configService: ConfigService) { - this.client = new S3Client({ - region: 'us-east-1', - endpoint: this.configService.get('MINIOHOST') || '', - credentials: { - accessKeyId: this.configService.get('MINIOUSER') || '', - secretAccessKey: this.configService.get('MINIOACCESSKEY') || '', - }, - forcePathStyle: true, - }); + } async uploadPdf(bucket: string, key: string, pdfBuffer: Buffer): Promise { + if (!this.client) { + this.client = new S3Client({ + region: 'us-east-1', + endpoint: this.configService.get('MINIOHOST') || '', + credentials: { + accessKeyId: this.configService.get('MINIOUSER') || '', + secretAccessKey: this.configService.get('MINIOACCESSKEY') || '', + }, + forcePathStyle: true, + }); + console.log(this.configService.get('MINIOHOST')) + } await this.client.send( new PutObjectCommand({ Bucket: bucket,