logs
This commit is contained in:
@@ -53,10 +53,27 @@ export class KeyController {
|
||||
return this.service.restoreKey(req.user, id);
|
||||
}
|
||||
|
||||
@UseGuards(AuthGuard)
|
||||
@Delete(':id')
|
||||
deleteKey(@Req() req: AuthenticatedRequest, @Param('id') id: string) {
|
||||
return this.service.deleteKey(req.user, id);
|
||||
|
||||
@Get(':id/handover/pdf')
|
||||
async getHandoverPDF(@Param('id') id: string, @Res() res: Response) {
|
||||
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)
|
||||
@@ -83,6 +100,7 @@ export class KeyController {
|
||||
|
||||
@Post('pdf')
|
||||
async generatePdf(@Body() dto: KeyHandoverPDFDataDto, @Res() res: Response) {
|
||||
console.log("GENERATE PDF")
|
||||
const { pdf, response } = await this.service.createPdf(dto);
|
||||
|
||||
res.setHeader(
|
||||
@@ -103,24 +121,9 @@ export class KeyController {
|
||||
res.end(pdf);
|
||||
}
|
||||
|
||||
@Get(':id/handover/pdf')
|
||||
async getHandoverPDF(@Param('id') id: string, @Res() res: Response) {
|
||||
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)
|
||||
@Delete(':id')
|
||||
deleteKey(@Req() req: AuthenticatedRequest, @Param('id') id: string) {
|
||||
return this.service.deleteKey(req.user, id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user