Add attachment support for fuel and recurring expenses with camera capture

Co-authored-by: aiulian25 <17886483+aiulian25@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-11-12 21:39:52 +00:00
parent 339cd94b26
commit 8a5b916a39
8 changed files with 487 additions and 9 deletions

View file

@ -505,7 +505,8 @@ def fuel_records(vehicle_id):
'distance': r.distance,
'fuel_economy': r.fuel_economy,
'unit': r.unit,
'notes': r.notes
'notes': r.notes,
'document_path': r.document_path
} for r in records]), 200
elif request.method == 'POST':
@ -625,7 +626,8 @@ def recurring_expenses(vehicle_id):
'start_date': e.start_date.isoformat(),
'next_due_date': e.next_due_date.isoformat(),
'is_active': e.is_active,
'notes': e.notes
'notes': e.notes,
'document_path': e.document_path
} for e in expenses]), 200
elif request.method == 'POST':
@ -651,7 +653,8 @@ def recurring_expenses(vehicle_id):
frequency=frequency,
start_date=start_date,
next_due_date=next_due,
notes=data.get('notes')
notes=data.get('notes'),
document_path=data.get('document_path')
)
db.session.add(expense)
@ -847,7 +850,8 @@ def fuel_record_operations(vehicle_id, record_id):
'odometer': record.odometer,
'fuel_amount': record.fuel_amount,
'cost': record.cost,
'notes': record.notes or ''
'notes': record.notes or '',
'document_path': record.document_path or ''
})
elif request.method == 'PUT':
@ -857,6 +861,7 @@ def fuel_record_operations(vehicle_id, record_id):
record.fuel_amount = data.get('fuel_amount', record.fuel_amount)
record.cost = data.get('cost', record.cost)
record.notes = data.get('notes', record.notes)
record.document_path = data.get('document_path', record.document_path)
db.session.commit()
return jsonify({'message': 'Fuel record updated successfully'})