forked from pi-apps/pailot-for-pi
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathorder_tracking.py
26 lines (23 loc) · 981 Bytes
/
order_tracking.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# order_tracking.py
from flask import Blueprint, request, jsonify
from models import Order
order_tracking_bp = Blueprint('order_tracking', __name__)
@order_tracking_bp.route('/track-order', methods=['POST'])
def track_order():
order_id = request.json['order_id']
order = Order.query.get(order_id)
if order:
# Get order tracking information from logistics provider
#...
return jsonify({'message': 'Order tracking information', 'tracking_info': tracking_info})
return jsonify({'message': 'Order not found'}), 404
@order_tracking_bp.route('/update-order-status', methods=['POST'])
def update_order_status():
order_id = request.json['order_id']
order_status = request.json['order_status']
order = Order.query.get(order_id)
if order:
order.status = order_status
db.session.commit()
return jsonify({'message': 'Order status updated successfully'})
return jsonify({'message': 'Order not found'}), 404