logs
This commit is contained in:
@@ -53,10 +53,27 @@ export class KeyController {
|
|||||||
return this.service.restoreKey(req.user, id);
|
return this.service.restoreKey(req.user, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseGuards(AuthGuard)
|
|
||||||
@Delete(':id')
|
@Get(':id/handover/pdf')
|
||||||
deleteKey(@Req() req: AuthenticatedRequest, @Param('id') id: string) {
|
async getHandoverPDF(@Param('id') id: string, @Res() res: Response) {
|
||||||
return this.service.deleteKey(req.user, id);
|
console.log("GET PDF")
|
||||||
|
const { pdf, response } = await this.service.getPdf(id);
|
||||||
|
res.setHeader(
|
||||||
|
'Content-Type',
|
||||||
|
response.headers['content-type'] ?? 'application/pdf',
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.headers['content-length']) {
|
||||||
|
res.setHeader('Content-Length', response.headers['content-length']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.headers['content-disposition']) {
|
||||||
|
res.setHeader('Content-Disposition', response.headers['content-disposition']);
|
||||||
|
} else {
|
||||||
|
res.setHeader('Content-Disposition', `inline; filename="uebergabe.pdf"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
res.end(pdf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseGuards(AuthGuard)
|
@UseGuards(AuthGuard)
|
||||||
@@ -83,6 +100,7 @@ export class KeyController {
|
|||||||
|
|
||||||
@Post('pdf')
|
@Post('pdf')
|
||||||
async generatePdf(@Body() dto: KeyHandoverPDFDataDto, @Res() res: Response) {
|
async generatePdf(@Body() dto: KeyHandoverPDFDataDto, @Res() res: Response) {
|
||||||
|
console.log("GENERATE PDF")
|
||||||
const { pdf, response } = await this.service.createPdf(dto);
|
const { pdf, response } = await this.service.createPdf(dto);
|
||||||
|
|
||||||
res.setHeader(
|
res.setHeader(
|
||||||
@@ -103,24 +121,9 @@ export class KeyController {
|
|||||||
res.end(pdf);
|
res.end(pdf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id/handover/pdf')
|
@UseGuards(AuthGuard)
|
||||||
async getHandoverPDF(@Param('id') id: string, @Res() res: Response) {
|
@Delete(':id')
|
||||||
const { pdf, response } = await this.service.getPdf(id);
|
deleteKey(@Req() req: AuthenticatedRequest, @Param('id') id: string) {
|
||||||
res.setHeader(
|
return this.service.deleteKey(req.user, id);
|
||||||
'Content-Type',
|
|
||||||
response.headers['content-type'] ?? 'application/pdf',
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.headers['content-length']) {
|
|
||||||
res.setHeader('Content-Length', response.headers['content-length']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (response.headers['content-disposition']) {
|
|
||||||
res.setHeader('Content-Disposition', response.headers['content-disposition']);
|
|
||||||
} else {
|
|
||||||
res.setHeader('Content-Disposition', `inline; filename="uebergabe.pdf"`);
|
|
||||||
}
|
|
||||||
|
|
||||||
res.end(pdf);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user