Add FoodLog model and update relationships

Introduces the FoodLog model to track user food consumption, adds relationships between User, FoodItem, and FoodLog, and updates seed.py to include sample FoodLog data. Also fixes route redirection to use the correct blueprint namespace.
This commit is contained in:
2025-07-01 13:06:26 +02:00
parent f2fd288bd7
commit 7bf8a754db
3 changed files with 32 additions and 4 deletions

View File

@@ -76,11 +76,13 @@ def add_food_item():
)
db.session.commit()
print("[DEBUG] New item added")
return redirect(url_for("food_item", barcode=form.barcode.data))
return redirect(
url_for("user.food_item", barcode=form.barcode.data)
)
else:
print("[DEBUG] Invalid form")
if form.barcode.data:
return redirect(url_for("food_item", barcode=form.barcode.data))
return redirect(url_for("user.food_item", barcode=form.barcode.data))
else:
return redirect(url_for("scan"))