refactor: replace direct Paperless upload with client-side document download functionality
Build and Push Multi-Platform Images / build-and-push (push) Successful in 36s

This commit is contained in:
2026-05-06 09:30:53 +02:00
parent 4f1f030423
commit e08a5697f0
5 changed files with 34 additions and 137 deletions
@@ -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')