mirror of
https://github.com/StefBuwalda/cal_counter.git
synced 2025-10-30 03:10:00 +00:00
Add user dashboard and per-user food item ownership
Introduces a user dashboard route and template, moving dashboard logic to a user blueprint. FoodItem now has an owner_id field and a unique constraint on (barcode, owner_id), with relationships set up in the User model. Updates food item creation to associate with the current user, and adds a utility script for dropping a temporary table.
This commit is contained in:
@@ -32,6 +32,7 @@ def barcode_test():
|
||||
def delete_food(id):
|
||||
item = FoodItem.query.get(id)
|
||||
if item:
|
||||
# if item.owner_id == current_user.id:
|
||||
db.session.delete(item)
|
||||
db.session.commit()
|
||||
return redirect(url_for("admin.food_items"))
|
||||
|
||||
Reference in New Issue
Block a user