Refactor add meal flow and remove v2 routes

Migrated add_meal_v2 routes and templates to add_meal, renaming endpoints and updating references throughout the app. Removed legacy daily_log2 route and template, consolidating to daily_log. Moved macro_arr_to_json to utils.py for reuse. Updated navigation and redirect logic to use new routes. Improved item finding and barcode scanning UI.
This commit is contained in:
2025-08-14 15:50:17 +02:00
parent 7b84ab980e
commit 73985b9b6d
10 changed files with 240 additions and 245 deletions

11
app.py
View File

@@ -12,7 +12,7 @@ from application import db, app, login_manager
from application.admin.routes import admin_bp
from application.user.routes import user_bp
from application.auth.routes import bp as auth_bp
from application.add_meal_v2.routes import bp as add_meal_v2_bp
from application.add_meal.routes import bp as add_meal_bp
from typing import Optional
# Config
@@ -30,12 +30,17 @@ def load_user(user_id: int):
app.register_blueprint(admin_bp)
app.register_blueprint(user_bp)
app.register_blueprint(auth_bp)
app.register_blueprint(add_meal_v2_bp)
app.register_blueprint(add_meal_bp)
# @app.errorhandler(404)
# def page_not_found(e):
# return redirect("/")
# Routes
def default_return(next_page: Optional[str] = None):
return redirect(url_for("user.daily_log2"))
return redirect(url_for("user.daily_log"))
if next_page:
return redirect(next_page)
if current_user.is_admin: