Introduces a new route and template for an enhanced daily log dashboard with macro nutrient summary. Refactors FoodItem model to add type annotations and a macros() method, and updates form handling to default missing values to zero. Also adds a navigation link to the new dashboard in the base template.
The logout route was relocated from the main app to the auth blueprint for better organization. The logout link in the base template was updated to reference the new route location.
Introduces a change password route, form, and template, allowing authenticated users to update their password. Updates the User model with a method to set the must_change_password flag. Adjusts login and navigation logic to support the new flow and ensures users are redirected to change their password if required.
Moved login route and logic from app.py to application/auth/routes.py under the 'auth' blueprint. Updated all references to the login route to use 'auth.login'. Added a dedicated login.html template under application/auth/templates. Adjusted login_required utility and default_return logic for consistency.
Moved the login_required logic to a new utils.py for reuse. Added a new auth blueprint and registered it in app.py. Updated user blueprint to use the shared login_required function.
Introduces a new boolean column 'must_change_password' to the User model and database schema. This field enforces password change requirements for users and is included in the model's constructor and migration.
Deleted the /food_items and /barcode_test routes from admin, along with their associated templates and the delete_food functionality. This streamlines the admin blueprint by removing unused or deprecated features.
This migration alters the 'energy_100' column in the 'food_item' table from INTEGER to Float to allow for decimal values. The downgrade reverses this change.
Added a route to serve /favicon.ico using send_from_directory and included the favicon.ico file in the static directory. This improves browser tab display and branding.
commit 7fe30bfebf
Author: Stef <stbuwalda@gmail.com>
Date: Mon Aug 11 14:32:53 2025 +0200
Improve FoodItem uniqueness and add name constraint
Refactored add_meal routes to check for existing FoodItems by name or barcode and improved form handling. Made barcode optional in FoodItemForm. Added a unique constraint on (name, owner_id) for FoodItem in both the model and database migrations, while retaining the (barcode, owner_id) constraint. Updated FoodItem relationship to cascade deletes.
Refactored add_meal routes to check for existing FoodItems by name or barcode and improved form handling. Made barcode optional in FoodItemForm. Added a unique constraint on (name, owner_id) for FoodItem in both the model and database migrations, while retaining the (barcode, owner_id) constraint. Updated FoodItem relationship to cascade deletes.
Adds logic to automatically create an admin account with default credentials if the user table is empty when the app starts. This ensures there is always an admin user available for initial setup.
Changed the Docker volume mount to map ./data to /app/instance instead of /app/data in docker-compose.yaml. Also enabled shell debug mode in entrypoint.sh by adding the -x flag to 'set -e' for easier troubleshooting.
Introduces entrypoint.sh to handle database migrations before starting the Flask app. Updates Dockerfile to use the new entrypoint script and ensures it is executable.
Added Dockerfile and docker-compose.yaml for containerization. Introduced Alembic migrations with initial schema and a migration to alter column types. Added requirements.txt for dependencies and removed temp.py cleanup script. Updated .gitignore to allow tracking of migration files.
Updated app.py to run the server on port 80 without SSL context. Enhanced the log removal route to redirect with the current offset if present in the session.
Adds session storage of the 'offset' parameter to ensure the correct date is used when adding meals and redirecting to the daily log. Updates the add_meal and user routes to handle and validate the offset, improving navigation and data consistency for users logging meals on different days.
Updated the daily log route and template to support viewing logs for previous and next days using an offset parameter. The default redirect now points to the daily log instead of the dashboard. The daily_log.html template includes navigation buttons for moving between days.
Deleted the /overview route from user routes and removed the associated overview.html template. This cleans up unused code related to the daily nutrition overview feature.
Calculates and displays total calories, protein, carbs, and fat for the current day on the daily log page. Updates both the route logic and the template to show these nutritional totals in a formatted overview.
Introduced a new route and backend logic to allow users to delete their own food log entries. Updated the daily_log.html template to display delete buttons for each log entry, improving user control over their daily food logs.