Commit Graph

65 Commits

Author SHA1 Message Date
72fe1b602b Update routes.py
Fixed a bug where redirect was incorrect after adding an item
2025-08-11 16:36:51 +02:00
Stef
79f7364c5a Update auto_bump_main.yml v0.1.0 2025-08-11 16:19:48 +02:00
Stef
5a5a9c5ca3 Create auto_bump_main.yml 2025-08-11 16:08:59 +02:00
Stef
47e725cb4f Update docker-ghcr.yml 2025-08-11 15:42:48 +02:00
5f0312e4f0 Add favicon support and static favicon file
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.
2025-08-11 15:13:45 +02:00
dff722a4af Update base.html 2025-08-11 15:02:44 +02:00
d15ade61f2 Remove barcode scanner feature and template
Deleted the /scan route and its associated scan.html template, removing the barcode scanner functionality from the application.
2025-08-11 15:02:40 +02:00
9f37944af1 Delete docker-compose.yaml 2025-08-11 14:44:26 +02:00
06fe4f22c0 Merge branch 'main' into development 2025-08-11 14:34:23 +02:00
6ad7ffa62b Squashed commit of the following:
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.
2025-08-11 14:33:13 +02:00
7fe30bfebf 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.
2025-08-11 14:32:53 +02:00
Stef
ad7f787ce5 Update docker-ghcr.yml 2025-08-11 02:46:00 +02:00
Stef
5d86c27bd3 Update docker-ghcr.yml 2025-08-11 02:42:57 +02:00
Stef
d737e808eb Create docker-ghcr.yml 2025-08-11 02:39:17 +02:00
85728c47c1 Update routes.py 2025-08-11 02:12:02 +02:00
1c31b431e4 Update docker-compose.yaml 2025-08-11 02:05:33 +02:00
6ecec986b7 Update app.py 2025-08-11 02:00:42 +02:00
ef2d969654 Create default admin user if no users exist
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.
2025-08-11 01:57:31 +02:00
2f89097219 Update Dockerfile 2025-08-11 01:53:22 +02:00
f9760cae07 Update volume mount and enable shell debug mode
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.
2025-08-11 01:31:06 +02:00
135e226db8 Add entrypoint script for Docker container
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.
2025-08-11 01:25:02 +02:00
7f806e52dd Update docker-compose.yaml 2025-08-11 01:13:37 +02:00
b3269c4113 Update docker-compose.yaml 2025-08-11 01:10:42 +02:00
66204e7e4a Add Docker, migrations, and initial database setup
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.
2025-08-11 00:49:46 +02:00
b8bd8d802b Change server port to 80 and improve log removal redirect
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.
2025-08-07 21:36:25 +02:00
f81329cedd Preserve date offset in meal logging flow
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.
2025-08-07 21:15:38 +02:00
4a480eeee3 Update scan_barcode.html 2025-08-07 20:49:31 +02:00
e3119a69fc Add day navigation to daily log view
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.
2025-08-07 20:49:10 +02:00
4b068063ed Update base.html 2025-08-07 20:31:13 +02:00
26cbb48d1d Remove overview route and template
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.
2025-08-07 20:29:03 +02:00
f1a6f81540 Add daily nutrition summary to daily log page
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.
2025-08-07 20:28:46 +02:00
b575180b0a Add ability to remove food logs from daily log
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.
2025-08-07 20:19:23 +02:00
dd5923a03e Refactor search box and suggestions layout in scan_barcode.html
Reorganized the search input and suggestions into a single container with improved positioning and removed the duplicate suggestions list. Also removed the start/stop scanning buttons section for a cleaner UI.
2025-08-07 19:32:42 +02:00
017f88846e Add search and autocomplete to barcode scan page
Enhanced the barcode scanner page with a search box and autocomplete suggestions for food items. Updated backend routes to support searching by both barcode and name, and added a new /query endpoint for AJAX search. Refactored step3 and step3_alt1 routes to handle both barcode and name inputs.
2025-08-07 19:23:58 +02:00
b282f333fd Remove manual food item addition and barcode scanning
Deleted routes and templates related to manual food item entry and barcode scanning, including add_food_item, add_food_item_manual, food_item, log_food, and related session-based selection routes. Updated navigation in base.html to remove links to these features and added links to overview, daily log, and dashboard. Simplified daily_log.html to format log amounts, and removed unused imports and forms from routes.py.
2025-08-07 17:09:47 +02:00
c552a4571e Add barcode-based meal logging workflow
Introduces a new add_meal blueprint with routes and templates for scanning barcodes, adding new food items, and logging meals. Updates FoodItemForm and FoodLogForm validation, changes FoodLog.amount to float, and integrates the new workflow into the daily log UI. Refactors user routes and templates to support the new meal logging process.
2025-08-07 17:00:56 +02:00
5ae82e379e Refactor food item flow and barcode handling
Updated routes and templates to improve the process of adding and logging food items by barcode. The add_food_item route now accepts a barcode parameter, and barcode lookups redirect to item creation if not found. The log_food flow now uses session variables for item and meal selection, and the get_item.html template uses fetch to handle barcode lookups and redirects accordingly.
2025-07-08 11:43:22 +02:00
bb5b2e8bc7 Change barcode field from integer to string
Updated the barcode field in FoodItem model and form from integer to string to support barcodes with leading zeros or non-numeric values. Added validation to ensure barcode contains only digits. Updated seed data to use string barcodes.
2025-07-08 11:06:03 +02:00
5b378cad38 Add barcode scanning and meal selection features
Introduces a barcode scanner page using the camera for food item entry, adds routes for selecting meal types and scanning products, and updates the test.html template to allow adding items to specific meals. Also updates branding in base.html, changes the Flask secret key, and enables SSL by default in app.py.
2025-07-08 11:00:30 +02:00
30e5e959cd Add daily overview and part_of_day to food logs
Introduces 'overview' and 'test' routes and templates for daily nutrition summaries. Updates FoodLog model to include 'part_of_day' and 'date_' fields for better log categorization. Adjusts log creation and seed data to support new fields. Removes SSL context from app run for local development.
2025-07-07 14:44:50 +02:00
74ce42c578 Add food logging functionality for users
Introduces a new FoodLogForm and a /log_food/<item_id> route to allow users to log food consumption. Updates the food item route to redirect to the log page, adds a log_food.html template, and updates the Bootstrap CDN version in base.html.
2025-07-07 13:23:50 +02:00
0e44c36e09 Restrict food deletion to item owner
Added a check to ensure only the owner of a FoodItem can delete it. This improves security by preventing unauthorized deletions.
2025-07-02 16:08:25 +02:00
7bf8a754db 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.
2025-07-01 13:06:26 +02:00
f2fd288bd7 Update .gitignore 2025-07-01 12:11:48 +02:00
e67c18be0d Prefer rear camera for video device selection
Updated the camera selection logic to prioritize devices labeled as 'back' or 'rear' when initializing the video input for scanning. Falls back to the first available device if no rear camera is found.
2025-07-01 12:11:13 +02:00
12d7e0c30c Enable HTTPS and external access in Flask app
Updated app.run to bind to 0.0.0.0 for external access and enabled HTTPS using cert.pem and key.pem SSL context.
2025-07-01 12:11:02 +02:00
acd8a68c1f Update base.html 2025-07-01 12:10:52 +02:00
1b79925b49 Move food item routes to user blueprint
Refactored food item related routes from app.py to application/user/routes.py under the user blueprint. Updated template and JS references to use the blueprint route names, improving code organization and modularity.
2025-06-29 17:52:03 +02:00
a6f6cdf346 Add manual food item entry and update food item management
Introduces a new route and template for manually adding food items. Updates food item edit and delete operations to use the food item's ID instead of barcode and adds ownership checks. Adjusts form and model to make barcode optional, and updates navigation and dashboard templates to reflect these changes.
2025-06-29 17:41:58 +02:00
e00bfee948 Refactor food item nutrition field names for consistency
Standardized field names for nutritional values in FoodItem model and throughout the codebase, changing 'fats_100g' to 'fat_100', 'saturated_fats_100g' to 'saturated_fat_100', and similar updates for other fields. Updated all references in models, templates, routes, and seed data to match the new naming convention for improved clarity and consistency.
2025-06-29 16:36:05 +02:00