43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
from flask import Blueprint, jsonify, request
|
|
from routes.utils import jwt_protect_blueprint
|
|
import sipro.api.orders
|
|
|
|
orders_blueprint = jwt_protect_blueprint(Blueprint('orders', __name__))
|
|
|
|
|
|
@orders_blueprint.get('/<int:order_id>')
|
|
def get_order(order_id: int):
|
|
return jsonify(id=order_id)
|
|
|
|
|
|
@orders_blueprint.get('/getOrders')
|
|
def get_orders():
|
|
args = request.args
|
|
order_by = args.get('orderBy')
|
|
desc = int(args.get('desc'))
|
|
page = int(args.get('page'))
|
|
shipment_date = args.get('shipmentDate')
|
|
status = args.get('status')
|
|
shipment_warehouse_id = int(args.get('shipmentWarehouseId'))
|
|
response = sipro.api.orders.get_orders(order_by,
|
|
desc,
|
|
page,
|
|
shipment_date,
|
|
status,
|
|
shipment_warehouse_id)
|
|
return jsonify(response)
|
|
|
|
|
|
@orders_blueprint.get('/getByProductId')
|
|
def get_orders_by_supplier_product_id():
|
|
params = dict(request.args)
|
|
# product_id = args.get('productId')
|
|
return sipro.api.orders.get_orders_from_barcode(params=params)
|
|
|
|
|
|
@orders_blueprint.get('/getOrderById')
|
|
def get_order_by_id():
|
|
args = request.args
|
|
order_id = args.get('orderId')
|
|
return sipro.api.orders.get_order_by_id(order_id)
|