def registerSupplier(): arg = request.get_json() if request.method == 'GET': return SupplierHandler().getAllSuppliers() elif request.method == 'POST': return SupplierHandler().insert(request.json)
def getAllSupplier(): if request.method == 'POST': print("REQUEST: ", request.json) return SupplierHandler().insertSupplierJson(request.json) else: if not request.args: return SupplierHandler().getAllSupplier()
def getAllSuppliers(): if request.method == 'POST': return SupplierHandler().insertSupplier(request.form) else: if not request.args: return SupplierHandler().getAllSuppliers() else: return SupplierHandler().searchSuppliers(request.args)
def getSupplierById(supplier_id): if request.method == 'GET': return SupplierHandler().getSupplierById(supplier_id) elif request.method == 'PUT': return SupplierHandler().updateSupplier(supplier_id, request.json) elif request.method == 'DELETE': return SupplierHandler().deleteSupplier(supplier_id) else: return jsonify(Error="Method not allowed."), 405
def getAllSuppliers(): if request.method == 'POST': print("Request: ", request.json) return SupplierHandler().insertSupplier(request.json) else: if not request.args: return SupplierHandler().getAllSuppliers() else: return SupplierHandler().searchSuppliers(request.json)
def getSupplierByID(s_id): if request.method == 'GET': return SupplierHandler().getSupplierByID(s_id) elif request.method == 'PUT': return SupplierHandler().putSupplierByID(request.form, s_id) elif request.method == 'DELETE': return SupplierHandler().deleteSupplierByID(s_id) else: return jsonify(Error="Method not allowed"), 405
def getSupplierById(sid): if request.method == 'GET': return SupplierHandler().getSupplierById(sid) elif request.method == 'PUT': pass elif request.method == 'DELETE': pass else: return jsonify(Error="Method not allowed"), 405
def getAllSuppliers(): """ Get all suppliers""" handler = SupplierHandler() if request.method == 'GET': if not request.args: return handler.getAllSuppliers() else: return handler.searchAllSuppliersByParameter(request.form) elif request.method == 'PUT': return SupplierHandler().PutSupplier(request.form, request.get_json()) elif request.method == 'POST': return SupplierHandler().insertSupplier(request.form, request.get_json()) else: return jsonify(Error="Method not allowed"), 405
def getAnnouncementsBySupplierID(s_id): return SupplierHandler().getAnnouncementsBySupplierID(s_id)
def getAllSuppliers(): return SupplierHandler().getAll()
def getSuppliersById(id): return SupplierHandler.getSupplierById(id)
def getResourceBySupplierId(sid): return SupplierHandler().getResourceBySupplierId(sid)
def registerSupplier(): return SupplierHandler().register(request.json)
def getOrdersBySupplierID(sid): return SupplierHandler().getAllOrders(sid)
def getReservationBySupplierId(sid): return SupplierHandler().getReservationBySupplierId(sid)
def getSupplierByID(sid): handler = SupplierHandler() return handler.getSupplierByID(sid)
def getSupplierById(sid): return SupplierHandler().getSupplierById(sid)
def getResourcesBySupplierId(supplier_id): return SupplierHandler().getResourcesBySupplierId(supplier_id)
def getSupplierById(supplier_id): if request.method == 'GET': return SupplierHandler().getSupplierById(supplier_id) else: return SupplierHandler().searchSuppliers(request.args)
def getSuppliersByResource(rame): return SupplierHandler().getSuppliersOfResourceId(resource_id)
def updateCreditCard(sid, cnumber): if request.method == 'PUT': return SupplierHandler().update_credit_card(sid, cnumber, request.args) return jsonify(ERROR="Malformed URL"), 404
def getAllSuppliers(): # orders specify if we are requesting, reserving or purchasing depending on its status if request.method == 'GET': return SupplierHandler().getAllSuppliers()
def getAllSuppliers(): if not request.args: return SupplierHandler().getAllSuppliers() else: return SupplierHandler().searchSuppliers(request.args)
def getPayMethodBySupplierId(sid): return SupplierHandler().getPayMethodBySupplierId(sid)
def getAllSupplier(): if request.method == 'POST': return SupplierHandler().insert_supplier(request.args) if not request.args: return SupplierHandler().getAllSupplier() return SupplierHandler().searchSupplier(request.args)
def getTransactionsBySupplierID(s_id): return SupplierHandler().getTransactionsBySupplierID(s_id)
def getPartsBySuplierId(sid): return SupplierHandler().getPartsBySupplierId(sid)
def getResourcesByRegion(region): return SupplierHandler().getResourcesByRegion(region)
def getResourcesBySupplierID(s_id): return SupplierHandler().getResourcesBySupplierID(s_id)
def addSupplierCredicCard(sid): if request.method == 'POST': return SupplierHandler().add_credit_card(sid, request.args) return jsonify(ERROR="Malformed URL"), 404