Skip to content

Feature : Custom Meals are now supported#507

Merged
CodeWithCJ merged 11 commits intoCodeWithCJ:mainfrom
shantnudon:main
Jan 11, 2026
Merged

Feature : Custom Meals are now supported#507
CodeWithCJ merged 11 commits intoCodeWithCJ:mainfrom
shantnudon:main

Conversation

@shantnudon
Copy link
Contributor

BREAKING CHANGES

it is preferred that the user take a backup of the data before updating.
Don't updated the app using watchtower as there are some .env changes that should be noted before making the update.

Major Changes

Previously, the app supported only hard-coded meals such as Breakfast, Lunch, Snacks, and Dinner. These meal types were fixed and could not be customized.
Now, the app supports custom meal types, allowing users to create meals like Pre-Workout, Post-Workout, Evening Snacks, etc.


Earlier, meal_type was a column used across the following tables:

  1. food_entries
  2. meal_plans
  3. meal_plan_template_assignments
  4. food_entry_meals

These tables relied on hard-coded meal values.
This has now been refactored so that all meal types are managed through a new meal_types table, which has the value for the meals.


When a user uses the app for the first time, four default meals: Breakfast, Lunch, Snacks, Dinner are automatically created.
These default meals cannot be changed, as they are shared across all users. Modifying them could break the app.

Apart from these defaults, users can create any number of additional meals.


Meal Sort Order

The default meal has a predefined sort order:

  • Breakfast → 10
  • Lunch → 20
  • Snacks → 30
  • Dinner → 40

These values must not be changed, as they are used globally by all users.
If a user wants a custom ordering, they can create their own meal, for example:

  • Bed-Tea → 1

The sort order is used by the frontend to display meals in the selected order.


Backend Changes

  • The backend now accepts meal_type_id instead of meal_type.
  • This change was necessary because different users can have meals with the same name (e.g., snack1), which could otherwise lead to query conflicts or invalid user data.
  • Updated all tables that previously used hard-coded meal_type values to reference the new meal_types table.
  • Added a new CRUD API specifically for managing meal types.

Frontend Changes

  • The Food Diary now displays meals based on data from the meal_types table instead of hard-coded values.
  • New meals can be added from Admin Settings, with full support for creating and managing custom meals.

Minor Fixes

Missing Dependency Fix

The package @dnd-kit/utilities was used in:


SparkyFitnessFrontend/src/components/EditExerciseEntryDialog.tsx

However, it was not installed and was missing from:


SparkyFitnessFrontend/package.json

The package has now been installed to fix this issue.


Environment Variable Cleanup

The app was previously using two different environment variables with different names but the same purpose:

  • SPARKY_FITNESS_APP_DB_USER
  • SPARKY_FITNESS_APP_DB_PASSWORD

These were duplicates of:

  • SPARKY_FITNESS_DB_USER
  • SPARKY_FITNESS_DB_PASSWORD

The code has been updated to only use:

  • SPARKY_FITNESS_DB_USER
  • SPARKY_FITNESS_DB_PASSWORD

This update was applied in the following files:

  • SparkyFitnessServer/utils/preflightChecks.js
  • SparkyFitnessServer/utils/dbMigrations.js
  • docker/docker-compose.dev.yml
  • docker/docker-compose.prod.yml

Not Updated

No changes were made to:


SparkyFitnessServer/services/chatService.js

This file was not updated because it was unclear what data should or should not be passed.

shantnudon and others added 11 commits January 9, 2026 15:05
reverting to SPARKY_FITNESS_APP_DB_USER. The reason is RLS needs regular user and DB upgrade/system activities needs super user. So DB_USER (superuser) and APP_DB_USER (regular user) are not duplicates.
reverting back original DB credentials.
reverting super user vs regular user confusion
@CodeWithCJ CodeWithCJ merged commit c0fb7a8 into CodeWithCJ:main Jan 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants