feat: add backend migration and API for maintenance receipt linking (refs #151)
Add receipt_document_id FK on maintenance_records, update types/repo/service to support receipt linking on create and return document metadata on GET. Add OCR proxy endpoint POST /api/ocr/extract/maintenance-receipt with tier gating (maintenance.receiptScan) through full chain: routes -> controller -> service -> client. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,12 @@ export const ocrRoutes: FastifyPluginAsync = async (
|
||||
handler: ctrl.extractReceipt.bind(ctrl),
|
||||
});
|
||||
|
||||
// POST /api/ocr/extract/maintenance-receipt - Maintenance receipt OCR extraction (Pro tier required)
|
||||
fastify.post('/ocr/extract/maintenance-receipt', {
|
||||
preHandler: [requireAuth, requireTier('maintenance.receiptScan')],
|
||||
handler: ctrl.extractMaintenanceReceipt.bind(ctrl),
|
||||
});
|
||||
|
||||
// POST /api/ocr/extract/manual - Manual extraction (Pro tier required)
|
||||
fastify.post('/ocr/extract/manual', {
|
||||
preHandler: [requireAuth, fastify.requireTier({ featureKey: 'document.scanMaintenanceSchedule' })],
|
||||
|
||||
Reference in New Issue
Block a user