def delete_drinks(valid, id): if valid: data = Drink.query.get(id) if data: Drink.delete(data) else: raise abort(404) return jsonify({ 'success': True, 'delete': id })
def delete_drinks(jwt, drink_id): drink_data = None try: drink_data = Drink.query.get(drink_id) except Exception as e: logging.error(e) abort(404) if not drink_data: abort(404) try: Drink.delete(drink_data) except Exception as e: logging.error(e) abort(422) drinks = list(map(Drink.long, Drink.query.all())) result = {"success": True, "drinks": drinks} return jsonify(result), 200