endpoint for removing me from meal

master
Marek Baczynski 6 years ago
parent ce75733204
commit 25024433a4

@ -131,6 +131,15 @@ def addme():
else:
return render_template('appresponse.html', message='You are already a registered eater')
@app.route("/removeme")
@login_required
def removeme():
meal_id = request.args.get('meal')
query = 'UPDATE meals SET eaters = array_remove(eaters, :user_id) where id = :meal_id;'
r = db_engine.execute(text(query), user_id=current_user.user_id, meal_id = meal_id)
return render_template('appresponse.html', message='You were removed from that meal')
@app.route('/')
def index():
return render_template('meal_list.html', leaderboard=getLeaderboard(), meals=getUpcomingMeals())

Loading…
Cancel
Save