feat: Vehicle association and record creation (#149) #158
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 #149
Scope
Handle vehicle association logic and create fuel log or maintenance records from OCR results.
Vehicle Association
VehiclesService.getUserVehicles(userId). If exactly 1 vehicle, use it.pending_vehicle_associationstable with extracted_data JSONB and document_id. Create in-app notification prompting user to select vehicle.Record Creation
ReceiptExtractionResponsefields toCreateFuelLogRequest:ReceiptExtractionResponsefields toCreateMaintenanceRecordRequest:receiptDocumentIdto stored document IDFiles
backend/src/features/email-ingestion/domain/email-ingestion.service.ts(extends service from sub-issue #3)Acceptance Criteria
Milestone: Vehicle Association and Record Creation
Phase: Execution | Agent: Feature Agent | Status: PASS
Changes
Updated
backend/src/features/email-ingestion/domain/email-ingestion.service.tswith:Vehicle Association (3-way branching)
receipt_failedtemplate telling user to add a vehicle firstFuel Log Creation
ExtractedReceiptDatatoEnhancedCreateFuelLogRequestvendor->locationData.stationNamedate->dateTime(falls back to current date)gallons->fuelUnitspricePerGallon->costPerUnit(derives from total/gallons if missing)fuelType-> mapped toFuelTypeenum (gasoline/diesel/electric)odometerReading->odometerReadingMaintenance Record Creation
ExtractedReceiptDatatoCreateMaintenanceRecordRequestshopNameorvendor->shopNamedate->datetotal->costcategory-> mapped toMaintenanceCategory(routine_maintenance/repair/performance_upgrade)subtypes-> validated against category with case-insensitive matching and fallback to first valid subtypeodometerReading->odometerReadingdescription->notesreceiptDocumentIdwhen availableError Handling
referenceIdpointing to the created record for navigationValidation
fce6075onissue-16-maintenance-receipt-upload-ocrVerdict: PASS | Next: Quality review