feat: add POST /api/documents/register-local for extension import

Accepts pre-extracted text (no raw file) from the AyrisLegal Electron
app's local OCR pipeline, matches/creates a case by title, and runs
the existing AI analysis flow. Also fixes a bug in uploadDocument:
officeparser@7.x's parseOffice() now returns a result object with
.toText() instead of a plain string, which was breaking PDF/DOCX
manual uploads.
This commit is contained in:
mstfyldz
2026-08-09 11:26:36 +03:00
parent d213d68e0f
commit 67b0398b8c
2 changed files with 129 additions and 45 deletions
+2 -1
View File
@@ -1,11 +1,12 @@
import { Router } from 'express';
import multer from 'multer';
import { requireAuth } from '../middleware/auth';
import { uploadDocument } from '../controllers/document.controller';
import { uploadDocument, registerLocalDocument } from '../controllers/document.controller';
const router = Router();
const upload = multer({ storage: multer.memoryStorage() });
router.post('/upload', upload.single('file'), requireAuth, uploadDocument);
router.post('/register-local', requireAuth, registerLocalDocument);
export default router;