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)
Esempio n. 3
0
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)	
Esempio n. 4
0
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)
Esempio n. 5
0
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}))
def deleteWines():
    for wines in Wines.query():
        wines.key.delete()
    return make_response('deleted')
Esempio n. 8
0
def deleteWines():
	for wines in Wines.query():
		wines.key.delete()
	return make_response('deleted')