Fix route registration by moving main block to end of file
Co-authored-by: aiulian25 <17886483+aiulian25@users.noreply.github.com>
This commit is contained in:
parent
8a5b916a39
commit
0eb54dfd30
2 changed files with 9 additions and 5 deletions
|
|
@ -796,11 +796,6 @@ def export_data(data_type):
|
|||
df.to_csv(output_file, index=False)
|
||||
return send_from_directory('/tmp', f'{data_type}_{vehicle_id}.csv', as_attachment=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
with app.app_context():
|
||||
db.create_all()
|
||||
app.run(host='0.0.0.0', port=5000, debug=False)
|
||||
|
||||
# Edit/Delete operations for Service Records
|
||||
@app.route('/api/vehicles/<int:vehicle_id>/service-records/<int:record_id>', methods=['GET', 'PUT', 'DELETE'])
|
||||
@login_required
|
||||
|
|
@ -902,3 +897,8 @@ def reminder_operations(vehicle_id, reminder_id):
|
|||
db.session.delete(reminder)
|
||||
db.session.commit()
|
||||
return jsonify({'message': 'Reminder deleted successfully'})
|
||||
|
||||
if __name__ == '__main__':
|
||||
with app.app_context():
|
||||
db.create_all()
|
||||
app.run(host='0.0.0.0', port=5000, debug=False)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@ echo "Initializing database..."
|
|||
cd /app/backend
|
||||
python init_db.py
|
||||
|
||||
# Run migrations
|
||||
echo "Running database migrations..."
|
||||
python migrate_attachments.py
|
||||
|
||||
# Set database file permissions
|
||||
if [ -f /app/data/masina_dock.db ]; then
|
||||
chmod 666 /app/data/masina_dock.db
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue