def wineByName(): if not request.args.get('name'): abort(400) name = request.args.get('name') auxJSON = [] winesByName = Wines.query(Wines.name == name) auxJSON = Wines.toJSONlist(winesByName) return make_response(jsonify({'winesbyname': auxJSON}), 200)
def wineByType(): if not request.args.get('type'): abort(400) wine_type = request.args.get('type') auxJSON = [] winesByType = Wines.query(Wines.wine_type == wine_type) auxJSON = Wines.toJSONlist(winesByType) return make_response(jsonify({'winesbytype': auxJSON}), 200)
def wineByName(): if not request.args.get('name'): abort(400) name = request.args.get('name') auxJSON = [] winesByName = Wines.query(Wines.name == name) auxJSON = Wines.toJSONlist(winesByName) return make_response(jsonify({'winesbyname':auxJSON}), 200)
def wineByType(): if not request.args.get('type'): abort(400) wine_type = request.args.get('type') auxJSON = [] winesByType = Wines.query(Wines.wine_type == wine_type) auxJSON = Wines.toJSONlist(winesByType) return make_response(jsonify({'winesbytype':auxJSON}), 200)
def wineBetweenPrices(): if not request.args.get('min') or not request.args.get('max'): abort(400) minimum = float(request.args.get('min')) maximum = float(request.args.get('max')) auxJSON = [] winesBetweenPrices = Wines.query(Wines.price >= minimum, Wines.price <= maximum) auxJSON = Wines.toJSONlist(winesBetweenPrices) return make_response(jsonify({'winesbetweenprices':auxJSON}))
def wineBetweenPrices(): if not request.args.get('min') or not request.args.get('max'): abort(400) minimum = float(request.args.get('min')) maximum = float(request.args.get('max')) auxJSON = [] winesBetweenPrices = Wines.query(Wines.price >= minimum, Wines.price <= maximum) auxJSON = Wines.toJSONlist(winesBetweenPrices) return make_response(jsonify({'winesbetweenprices': auxJSON}))