filters in orders by product
This commit is contained in:
@@ -30,9 +30,9 @@ def get_orders():
|
||||
|
||||
@orders_blueprint.get('/getByProductId')
|
||||
def get_orders_by_supplier_product_id():
|
||||
args = request.args
|
||||
product_id = args.get('productId')
|
||||
return sipro.api.orders.get_orders_by_product_id(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')
|
||||
|
||||
@@ -19,10 +19,10 @@ class SiproClient:
|
||||
self.initialized = True
|
||||
logger_instance.info('SiproClient successfully initialized')
|
||||
|
||||
def method(self, http_method: str, method: str, data: dict = None, raw=False):
|
||||
def method(self, http_method: str, method: str, data: dict = None, raw=False, params: dict = None):
|
||||
url = self.api_url + '/assemblr' + method
|
||||
headers = {'Authorization': self.token}
|
||||
response = requests.request(http_method, url, headers=headers, json=data)
|
||||
response = requests.request(http_method, url, headers=headers, json=data, params=params)
|
||||
if raw:
|
||||
return response
|
||||
return response.json()
|
||||
|
||||
@@ -34,3 +34,9 @@ def get_orders(order_by: str, desc: int, page: int, shipment_date: str, status:
|
||||
method = f'{router}/getOrders?orderBy={order_by}&desc={desc}&page={page}&shipmentDate={shipment_date}&status={status}&shipmentWarehouseId={shipment_warehouse_id}'
|
||||
response = client.method('GET', method)
|
||||
return response
|
||||
|
||||
|
||||
def get_orders_from_barcode(params: dict):
|
||||
method = f'{router}/getByProductId'
|
||||
response = client.method('GET', method, params=params)
|
||||
return response
|
||||
|
||||
Reference in New Issue
Block a user