feat: add nutrition/food logging to fitness section
Daily food log with calorie and macro tracking against configurable diet goals (presets: WHO balanced, cut, bulk, keto, etc.). Includes USDA/BLS food search with portion-based units, favorite ingredients, custom reusable meals, per-food micronutrient detail pages, and recipe-to-log integration via AddToFoodLogButton. Extends FitnessGoal with nutrition targets and adds birth year to user profile for BMR calculation.
This commit is contained in:
@@ -5,7 +5,14 @@ const FitnessGoalSchema = new mongoose.Schema(
|
||||
username: { type: String, required: true, unique: true },
|
||||
weeklyWorkouts: { type: Number, required: true, default: 4, min: 1, max: 14 },
|
||||
sex: { type: String, enum: ['male', 'female'], default: 'male' },
|
||||
heightCm: { type: Number, min: 100, max: 250 }
|
||||
heightCm: { type: Number, min: 100, max: 250 },
|
||||
birthYear: { type: Number, min: 1900, max: 2020 },
|
||||
activityLevel: { type: String, enum: ['sedentary', 'light', 'moderate', 'very_active'], default: 'light' },
|
||||
dailyCalories: { type: Number, min: 500, max: 10000 },
|
||||
proteinMode: { type: String, enum: ['fixed', 'per_kg'] },
|
||||
proteinTarget: { type: Number, min: 0 },
|
||||
fatPercent: { type: Number, min: 0, max: 100 },
|
||||
carbPercent: { type: Number, min: 0, max: 100 },
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
@@ -15,6 +22,13 @@ interface IFitnessGoal {
|
||||
weeklyWorkouts: number;
|
||||
sex?: 'male' | 'female';
|
||||
heightCm?: number;
|
||||
birthYear?: number;
|
||||
activityLevel?: 'sedentary' | 'light' | 'moderate' | 'very_active';
|
||||
dailyCalories?: number;
|
||||
proteinMode?: 'fixed' | 'per_kg';
|
||||
proteinTarget?: number;
|
||||
fatPercent?: number;
|
||||
carbPercent?: number;
|
||||
}
|
||||
|
||||
let _model: mongoose.Model<IFitnessGoal>;
|
||||
|
||||
Reference in New Issue
Block a user