refactor: replace direct Paperless upload with client-side document download functionality
Build and Push Multi-Platform Images / build-and-push (push) Successful in 36s
Build and Push Multi-Platform Images / build-and-push (push) Successful in 36s
This commit is contained in:
@@ -176,21 +176,18 @@ export class InboxController {
|
||||
await this.inboxService.updateSource(id, body.source, preferredUsername);
|
||||
}
|
||||
|
||||
@Post(':id/save-to-paperless')
|
||||
@HttpCode(204)
|
||||
async saveToPaperless(
|
||||
@Get(':id/download')
|
||||
async download(
|
||||
@Param('id') id: string,
|
||||
@Body() body: {
|
||||
title: string;
|
||||
date?: string;
|
||||
documentTypeId?: number;
|
||||
correspondentId?: number;
|
||||
tagIds?: number[];
|
||||
},
|
||||
@Request() req: any,
|
||||
): Promise<void> {
|
||||
@Res({ passthrough: true }) res: Response,
|
||||
): Promise<StreamableFile> {
|
||||
const preferredUsername: string | null = req.user?.preferredUsername ?? null;
|
||||
await this.inboxService.saveToPaperless(id, preferredUsername, body);
|
||||
const { buffer, filename } = await this.inboxService.getEditedPdfBuffer(id, preferredUsername);
|
||||
const { Readable } = await import('stream');
|
||||
res.setHeader('Content-Type', 'application/pdf');
|
||||
res.setHeader('Content-Disposition', `attachment; filename="${encodeURIComponent(filename)}"`);
|
||||
return new StreamableFile(Readable.from(buffer));
|
||||
}
|
||||
|
||||
@Post(':id/send-email')
|
||||
|
||||
Reference in New Issue
Block a user