Files
cal_counter/seed.py
Stef 0919048cfd Add barcode scanning and nutrition lookup feature
Introduces a new /scan route and template for barcode scanning using ZXing in the browser. Adds a /nutri/<barcode> API endpoint to fetch food item nutrition data by barcode. Updates the FoodItem model to include a barcode field and a to_dict method for JSON serialization. Also updates seed data to include a barcode.
2025-06-29 00:08:25 +02:00

24 lines
591 B
Python

from application import db, app
from models import User, FoodItem
with app.app_context():
User.query.delete()
db.session.add(User(username="admin", password="admin", is_admin=True))
db.session.add(User(username="user", password="user", is_admin=False))
FoodItem.query.delete()
db.session.add(
FoodItem(
name="AH Matcha cookie",
energy=430,
fats=19,
carbs=59,
protein=5.5,
saturated_fats=10,
sugar=35,
barcode=2278012003502,
)
)
db.session.commit()