feat: Seiten- und Wortzahl für den Duplikatvergleich

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bjoernpoettkerandClaude Opus 5.5 committed 2026-11-02 13:55:51 +01:00
1 parent 57a460ffa2
commit 8e0c609802
10 files changed
+273 -21

No files matched your search

@@ -21,6 +21,11 @@ import { BarcodeScannerService } from '../barcode/barcode-scanner.service';
import { UserSettingsService } from '../user-settings/user-settings.service';
import { RequirePermissions } from '../auth/permissions.decorator';
import { Permission } from '../auth/permissions.enum';
import { PaperlessService } from '../paperless/paperless.service';
import {
kennzahlenAusPdf,
type VergleichKennzahlen,
} from '../paperless/vergleich-kennzahlen.util';
@Controller('api/inbox')
@RequirePermissions(Permission.VIEW_SCANNER)
@@ -30,6 +35,7 @@ export class InboxController {
private readonly postprocessor: InboxPostprocessorService,
private readonly barcodeScanner: BarcodeScannerService,
private readonly userSettingsService: UserSettingsService,
private readonly paperlessService: PaperlessService,
) {}
@Get()
@@ -250,6 +256,29 @@ export class InboxController {
return new StreamableFile(Readable.from(buffer));
}
/** Seiten-/Wortzahl des Abschnitts und des vorhandenen Paperless-Dokuments. */
@Post(':id/vergleich')
async vergleich(
@Param('id') id: string,
@Body() body: { paperlessDocumentId: number; pages: number[] },
@Request() req: any,
): Promise<VergleichKennzahlen> {
const preferredUsername: string | null =
req.user?.preferredUsername ?? null;
const { buffer } = await this.inboxService.getSegmentPdfBuffer(
id,
preferredUsername,
body.pages ?? [],
);
const [vorhanden, neu] = await Promise.all([
this.paperlessService.getDocumentKennzahlen(
Number(body.paperlessDocumentId),
),
kennzahlenAusPdf(buffer),
]);
return { vorhanden, neu };
}
@Post(':id/send-email')
@HttpCode(204)
async sendEmail(