feat: Backend OCR manual proxy endpoint (#129) #135
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Relates to #129
Milestone 6: Backend OCR Manual Proxy Endpoint
Add backend proxy endpoint for manual extraction that triggers async Gemini processing.
Files
backend/src/features/ocr/domain/ocr.types.tsbackend/src/features/ocr/external/ocr-client.tsbackend/src/features/ocr/domain/ocr.service.tsbackend/src/features/ocr/api/ocr.controller.tsbackend/src/features/ocr/api/ocr.routes.tsRequirements
ManualExtractionResponseandManualJobResponsetypes matching Python API responseOcrClient.submitManualJob()method that POSTs to Python/extract/manualocrService.submitManualJob()with file validation (200MB max, PDF only)OcrController.extractManual()handler for async job submissionPOST /api/ocr/extract/manualroute with auth + tier guard fordocument.scanMaintenanceScheduleGET /api/ocr/jobs/:jobIdfor manual job pollingAcceptance Criteria
Tests
backend/src/features/ocr/tests/unit/ocr-manual.test.ts(NEW)Milestone: Backend OCR Manual Proxy Endpoint
Phase: Execution | Agent: Developer | Status: PASS
Changes Made
Types (
ocr.types.ts):ManualJobSubmitRequest,ManualVehicleInfo,MaintenanceScheduleItem,ManualExtractionResult,ManualJobResponsetypes matching Python API response formatClient (
ocr-client.ts):OcrClient.submitManualJob()method that POSTs to Python/extract/manualwith PDF file + optionalvehicle_idService (
ocr.service.ts):OcrService.submitManualJob()with PDF-only validation (400) and 200MB file size limit (413)Controller (
ocr.controller.ts):OcrController.extractManual()handler with file reading, empty file check, content type validation, and 202 async responseRoutes (
ocr.routes.ts):POST /api/ocr/extract/manualwithrequireAuth+requireTier({ featureKey: 'document.scanMaintenanceSchedule' })GET /api/ocr/jobs/:jobIdreused for manual job pollingTests (
ocr-manual.test.ts):Quality Checks
Verdict: PASS | Commit:
a281cea