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('/') 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('/getBySupplierProductId') def get_orders_by_supplier_product_id(): args = request.args supplier_product_id = args.get('supplierProductId') return sipro.api.orders.get_orders_by_supplier_product_id(supplier_product_id) @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)