Commit 9369fb5f authored by Ahmad Anvari's avatar Ahmad Anvari

add order

parent 77b5a6d5
from app import app
from middlewares.auth import login_required
from flask import request, jsonify
from flask import request, jsonify, g
from db.product import Product
from db.order import Order
......@@ -26,7 +26,7 @@ from db.order import Order
def add_order():
body = request.json
product_id = body["product_id"]
user_id = request.user.get_id()
user_id = g.user.get_id()
o = Order(user_id=user_id, product_id=product_id)
id = o.store()
return jsonify({"id": id})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment