* Extended functionalities

* Added different UIs
This commit is contained in:
2026-06-24 21:43:40 +02:00
parent 282f4864c4
commit f15bb7a916
348 changed files with 59057 additions and 498 deletions

View File

@@ -0,0 +1,227 @@
namespace MealPlan.Api.DTOs.Diet;
public class UserDailyGoalsDto
{
public int? CalorieGoal { get; set; }
public decimal? ProteinGoalG { get; set; }
public decimal? FatGoalG { get; set; }
public decimal? CarbsGoalG { get; set; }
public int? WaterGoalMl { get; set; }
}
public class MacroRemainingDto
{
public int? Goal { get; set; }
public int Consumed { get; set; }
public int? Remaining { get; set; }
public decimal? ProgressPercent { get; set; }
}
public class DecimalMacroRemainingDto
{
public decimal? Goal { get; set; }
public decimal Consumed { get; set; }
public decimal? Remaining { get; set; }
public decimal? ProgressPercent { get; set; }
}
public class DailySummaryDto
{
public DateOnly Date { get; set; }
public UserDailyGoalsDto? Goals { get; set; }
public MacroRemainingDto Calories { get; set; } = new();
public DecimalMacroRemainingDto ProteinG { get; set; } = new();
public DecimalMacroRemainingDto FatG { get; set; } = new();
public DecimalMacroRemainingDto CarbsG { get; set; } = new();
public MacroRemainingDto WaterMl { get; set; } = new();
public IReadOnlyList<MealConsumptionDto> Meals { get; set; } = Array.Empty<MealConsumptionDto>();
public IReadOnlyList<DrinkConsumptionDto> Drinks { get; set; } = Array.Empty<DrinkConsumptionDto>();
}
public class MealConsumptionDto
{
public int Id { get; set; }
public int? RecipeId { get; set; }
public int MealCategory { get; set; }
public DateOnly LogDate { get; set; }
public DateTime ConsumedAt { get; set; }
public string Name { get; set; } = string.Empty;
public decimal Portions { get; set; }
public int? Calories { get; set; }
public decimal? ProteinG { get; set; }
public decimal? FatG { get; set; }
public decimal? CarbsG { get; set; }
public string? Notes { get; set; }
}
public class LogMealDto
{
public int? RecipeId { get; set; }
public int? CatalogItemId { get; set; }
public decimal? Grams { get; set; }
public string? Name { get; set; }
public int MealCategory { get; set; }
public DateOnly? LogDate { get; set; }
public DateTime? ConsumedAt { get; set; }
public decimal Portions { get; set; } = 1m;
public int? Calories { get; set; }
public decimal? ProteinG { get; set; }
public decimal? FatG { get; set; }
public decimal? CarbsG { get; set; }
public string? Notes { get; set; }
}
public class MealMacroSnapshotDto
{
public string Name { get; set; } = string.Empty;
public decimal Portions { get; set; } = 1m;
public int? Calories { get; set; }
public decimal? ProteinG { get; set; }
public decimal? FatG { get; set; }
public decimal? CarbsG { get; set; }
}
public class RemainingAfterMealDto
{
public int? Calories { get; set; }
public decimal? ProteinG { get; set; }
public decimal? FatG { get; set; }
public decimal? CarbsG { get; set; }
}
public class MealPreviewDto
{
public MealMacroSnapshotDto Meal { get; set; } = new();
public RemainingAfterMealDto RemainingAfter { get; set; } = new();
}
public class DietSuggestionDto
{
public int CatalogItemId { get; set; }
public string Name { get; set; } = string.Empty;
public string? NamePl { get; set; }
public string CategoryCode { get; set; } = string.Empty;
public int SuggestedGrams { get; set; }
public int? Calories { get; set; }
public decimal? ProteinG { get; set; }
public decimal? FatG { get; set; }
public decimal? CarbsG { get; set; }
public string ReasonKey { get; set; } = string.Empty;
}
public class DrinkCatalogItemDto
{
public int Id { get; set; }
public string Code { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public int DefaultVolumeMl { get; set; }
public decimal? CaloriesPer100Ml { get; set; }
public string? IconEmoji { get; set; }
}
public class DrinkConsumptionDto
{
public int Id { get; set; }
public int? DrinkCatalogId { get; set; }
public DateOnly LogDate { get; set; }
public DateTime ConsumedAt { get; set; }
public string Name { get; set; } = string.Empty;
public int VolumeMl { get; set; }
public int? Calories { get; set; }
}
public class LogDrinkDto
{
public int? DrinkCatalogId { get; set; }
public string? Name { get; set; }
public int VolumeMl { get; set; }
public DateOnly? LogDate { get; set; }
public DateTime? ConsumedAt { get; set; }
public int? Calories { get; set; }
}
public class DietReminderDto
{
public int Id { get; set; }
public int ReminderType { get; set; }
public string Title { get; set; } = string.Empty;
public string? Message { get; set; }
public TimeOnly TimeOfDay { get; set; }
public int DaysOfWeekMask { get; set; }
public int? MealCategory { get; set; }
public bool IsEnabled { get; set; }
}
public class CreateDietReminderDto
{
public int ReminderType { get; set; }
public string Title { get; set; } = string.Empty;
public string? Message { get; set; }
public TimeOnly TimeOfDay { get; set; }
public int DaysOfWeekMask { get; set; } = Models.ReminderDaysMask.All;
public int? MealCategory { get; set; }
public bool IsEnabled { get; set; } = true;
}
public class UpdateDietReminderDto : CreateDietReminderDto
{
}
public class DueReminderDto
{
public int Id { get; set; }
public int ReminderType { get; set; }
public string Title { get; set; } = string.Empty;
public string? Message { get; set; }
public TimeOnly TimeOfDay { get; set; }
public int? MealCategory { get; set; }
}
public class HistoryDayDto
{
public DateOnly Date { get; set; }
public int Calories { get; set; }
public decimal ProteinG { get; set; }
public decimal FatG { get; set; }
public decimal CarbsG { get; set; }
public int WaterMl { get; set; }
public int MealCount { get; set; }
}
public class RecentMealDto
{
public int? RecipeId { get; set; }
public int? CatalogItemId { get; set; }
public string Name { get; set; } = string.Empty;
public int MealCategory { get; set; }
public decimal Portions { get; set; } = 1m;
public decimal? Grams { get; set; }
public int? Calories { get; set; }
public decimal? ProteinG { get; set; }
public decimal? FatG { get; set; }
public decimal? CarbsG { get; set; }
public DateTime LastLoggedAt { get; set; }
}
public class FavoriteRecipeDto
{
public int RecipeId { get; set; }
public string Name { get; set; } = string.Empty;
public int MealCategory { get; set; }
public int? Calories { get; set; }
}
public class FavoriteCatalogItemDto
{
public int CatalogItemId { get; set; }
public string Name { get; set; } = string.Empty;
public string? NamePl { get; set; }
public string CategoryCode { get; set; } = string.Empty;
}
public class CopyMealsResultDto
{
public DateOnly SourceDate { get; set; }
public DateOnly TargetDate { get; set; }
public int CopiedCount { get; set; }
}

View File

@@ -0,0 +1,201 @@
namespace MealPlan.Api.DTOs.Generators;
public class DietUserProfileDto
{
public decimal HeightCm { get; set; }
public decimal WeightKg { get; set; }
public int Age { get; set; }
public string Sex { get; set; } = "male";
public string ActivityLevel { get; set; } = "moderate";
public string Goal { get; set; } = "maintain";
public string? AllergiesNotes { get; set; }
public string? DislikedFoods { get; set; }
public int MealsPerDayMask { get; set; } = 15;
}
public class CreateDietGeneratorSessionDto
{
public DateOnly? PlanStartDate { get; set; }
public int PlanDayCount { get; set; } = 7;
public int CalorieToleranceKcal { get; set; } = 10;
}
public class MacroProposalDto
{
public int Calories { get; set; }
public decimal ProteinG { get; set; }
public decimal FatG { get; set; }
public decimal CarbsG { get; set; }
public string? Rationale { get; set; }
}
public class AcceptMacrosDto
{
public int? Calories { get; set; }
public decimal? ProteinG { get; set; }
public decimal? FatG { get; set; }
public decimal? CarbsG { get; set; }
}
public class DietGeneratorSessionDto
{
public int Id { get; set; }
public string Status { get; set; } = string.Empty;
public MacroProposalDto? ProposedMacros { get; set; }
public DateOnly? PlanStartDate { get; set; }
public int PlanDayCount { get; set; }
public int CalorieToleranceKcal { get; set; }
public IReadOnlyList<DietGeneratorDraftMealDto> DraftMeals { get; set; } = Array.Empty<DietGeneratorDraftMealDto>();
public IReadOnlyList<DietGeneratorDaySummaryDto> DaySummaries { get; set; } = Array.Empty<DietGeneratorDaySummaryDto>();
}
public class DietGeneratorDraftMealDto
{
public int Id { get; set; }
public DateOnly PlanDate { get; set; }
public int MealCategory { get; set; }
public int RecipeId { get; set; }
public string RecipeName { get; set; } = string.Empty;
public decimal Portions { get; set; }
public int? Calories { get; set; }
public decimal? ProteinG { get; set; }
public decimal? FatG { get; set; }
public decimal? CarbsG { get; set; }
public bool IsLocked { get; set; }
public int? PrepTimeMinutes { get; set; }
public IReadOnlyList<DietGeneratorDraftMealIngredientDto> Ingredients { get; set; } =
Array.Empty<DietGeneratorDraftMealIngredientDto>();
public IReadOnlyList<DietGeneratorDraftMealStepDto> Steps { get; set; } =
Array.Empty<DietGeneratorDraftMealStepDto>();
}
public class DietGeneratorDraftMealStepDto
{
public int Id { get; set; }
public int StepNumber { get; set; }
public string Description { get; set; } = string.Empty;
}
public class DietGeneratorDraftMealIngredientDto
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public decimal? AmountGrams { get; set; }
public string? Unit { get; set; }
public int SortOrder { get; set; }
public int? SourceIngredientId { get; set; }
}
public class DietGeneratorDaySummaryDto
{
public DateOnly PlanDate { get; set; }
public int TotalCalories { get; set; }
public int TargetCalories { get; set; }
public bool WithinTolerance { get; set; }
}
public class RegenerateDietMealDto
{
public DateOnly PlanDate { get; set; }
public int MealCategory { get; set; }
}
public class UpdateDraftMealDto
{
public int? RecipeId { get; set; }
public decimal? Portions { get; set; }
public bool? IsLocked { get; set; }
}
public class CommitDietPlanResultDto
{
public int SessionId { get; set; }
public DateOnly PlanStartDate { get; set; }
public DateOnly PlanEndDate { get; set; }
public int MealsWritten { get; set; }
}
public class RecipeGeneratorConstraintsDto
{
public string Prompt { get; set; } = string.Empty;
public int MealCategory { get; set; }
public int? TargetCalories { get; set; }
public int CalorieToleranceKcal { get; set; } = 10;
public int? MaxPrepTimeMinutes { get; set; }
public string? CuisineStyle { get; set; }
public string? DietStyle { get; set; }
public string? Exclusions { get; set; }
}
public class GeneratedIngredientDto
{
public string Name { get; set; } = string.Empty;
public decimal? AmountGrams { get; set; }
public string? Unit { get; set; }
public int? CatalogItemId { get; set; }
public string? CatalogName { get; set; }
public bool IsLinked { get; set; }
}
public class GeneratedStepDto
{
public int StepNumber { get; set; }
public string Description { get; set; } = string.Empty;
}
public class GeneratedRecipeDraftDto
{
public string DraftId { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public int MealCategory { get; set; }
public int? PrepTimeMinutes { get; set; }
public int? Calories { get; set; }
public decimal? Protein { get; set; }
public decimal? Fat { get; set; }
public decimal? Carbs { get; set; }
public IReadOnlyList<GeneratedIngredientDto> Ingredients { get; set; } = Array.Empty<GeneratedIngredientDto>();
public IReadOnlyList<GeneratedStepDto> Steps { get; set; } = Array.Empty<GeneratedStepDto>();
public int UnlinkedIngredientCount { get; set; }
}
public class RecipeGeneratorSessionDto
{
public int Id { get; set; }
public string Status { get; set; } = string.Empty;
public RecipeGeneratorConstraintsDto Constraints { get; set; } = new();
public GeneratedRecipeDraftDto? Draft { get; set; }
public IReadOnlyList<GeneratedRecipeDraftDto> Drafts { get; set; } = Array.Empty<GeneratedRecipeDraftDto>();
public int? SavedRecipeId { get; set; }
public int GenerationVersion { get; set; }
}
public class GenerateRecipesRequestDto
{
public int Count { get; set; } = 3;
}
public class CommitRecipesRequestDto
{
public IReadOnlyList<string>? DraftIds { get; set; }
}
public class RegenerateRecipePartDto
{
public string DraftId { get; set; } = string.Empty;
public string Mode { get; set; } = "ingredients";
public string? Instruction { get; set; }
}
public class CommitRecipeResultDto
{
public int SessionId { get; set; }
public int RecipeId { get; set; }
public string RecipeName { get; set; } = string.Empty;
public string DraftId { get; set; } = string.Empty;
}
public class CommitRecipesResultDto
{
public int SessionId { get; set; }
public IReadOnlyList<CommitRecipeResultDto> Saved { get; set; } = Array.Empty<CommitRecipeResultDto>();
}

View File

@@ -0,0 +1,38 @@
namespace MealPlan.Api.DTOs.IngredientCatalog;
public class IngredientCategoryDto
{
public int Id { get; set; }
public string Code { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public int ItemCount { get; set; }
}
public class IngredientNutritionItemDto
{
public int Id { get; set; }
public int CategoryId { get; set; }
public string CategoryCode { get; set; } = string.Empty;
public string CategoryName { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public string? NamePl { get; set; }
public int CaloriesPer100G { get; set; }
public decimal ProteinGPer100G { get; set; }
public decimal FatGPer100G { get; set; }
public decimal CarbsGPer100G { get; set; }
public decimal? FiberGPer100G { get; set; }
}
public class UpsertIngredientNutritionItemDto
{
public int CategoryId { get; set; }
public string Name { get; set; } = string.Empty;
public string? NamePl { get; set; }
public int CaloriesPer100G { get; set; }
public decimal ProteinGPer100G { get; set; }
public decimal FatGPer100G { get; set; }
public decimal CarbsGPer100G { get; set; }
public decimal? FiberGPer100G { get; set; }
public int SortOrder { get; set; }
public bool IsActive { get; set; } = true;
}

View File

@@ -0,0 +1,29 @@
namespace MealPlan.Api.DTOs.MealPlan;
public class MealPlanEntryDto
{
public int Id { get; set; }
public DateOnly PlanDate { get; set; }
public int MealCategory { get; set; }
public int RecipeId { get; set; }
public string RecipeName { get; set; } = string.Empty;
public decimal Portions { get; set; }
public int? Calories { get; set; }
}
public class UpsertMealPlanEntryDto
{
public DateOnly PlanDate { get; set; }
public int MealCategory { get; set; }
public int RecipeId { get; set; }
public decimal Portions { get; set; } = 1m;
}
public class ShoppingListItemDto
{
public string Name { get; set; } = string.Empty;
public string? Unit { get; set; }
public decimal? TotalGrams { get; set; }
public decimal? TotalAmount { get; set; }
public IReadOnlyList<string> Breakdown { get; set; } = Array.Empty<string>();
}

View File

@@ -0,0 +1,59 @@
using System.ComponentModel.DataAnnotations;
namespace MealPlan.Api.DTOs.Recipe;
/// <summary>Payload for creating or updating a recipe with nested ingredients and steps.</summary>
public class CreateRecipeDto
{
[Required]
[MaxLength(255)]
public string Name { get; set; } = string.Empty;
/// <summary>0 = Breakfast, 1 = SecondBreakfast, 2 = Lunch, 3 = Dinner.</summary>
[Range(0, 3)]
public int MealCategory { get; set; }
[Range(0, 100000)]
public int? Calories { get; set; }
[Range(0, 10000)]
public decimal? Protein { get; set; }
[Range(0, 10000)]
public decimal? Fat { get; set; }
[Range(0, 10000)]
public decimal? Carbs { get; set; }
[Range(0, 100000)]
public int? PrepTimeMinutes { get; set; }
public List<CreateIngredientDto> Ingredients { get; set; } = new();
public List<CreateRecipeStepDto> Steps { get; set; } = new();
}
public class CreateIngredientDto
{
[Required]
[MaxLength(255)]
public string Name { get; set; } = string.Empty;
[Range(0, 100000)]
public decimal? AmountGrams { get; set; }
[MaxLength(50)]
public string? Unit { get; set; }
public int? CatalogItemId { get; set; }
public int SortOrder { get; set; }
}
public class CreateRecipeStepDto
{
[Range(1, 1000)]
public int StepNumber { get; set; }
[Required]
public string Description { get; set; } = string.Empty;
}

View File

@@ -23,6 +23,7 @@ public class IngredientDto
public decimal? AmountGrams { get; set; }
public string? Unit { get; set; }
public int SortOrder { get; set; }
public int? CatalogItemId { get; set; }
}
public class RecipeStepDto

View File

@@ -0,0 +1,10 @@
namespace MealPlan.Api.DTOs.Recipe;
/// <summary>Summary returned after an Excel import operation.</summary>
public class RecipeImportResultDto
{
public int CreatedCount { get; set; }
public int SkippedCount { get; set; }
public List<string> Errors { get; set; } = new();
public List<int> CreatedRecipeIds { get; set; } = new();
}

View File

@@ -0,0 +1,10 @@
namespace MealPlan.Api.DTOs.Recipe;
public class RecipeMacroRecalcResultDto
{
public int RecipesProcessed { get; init; }
public int RecipesUpdated { get; init; }
public int UnlinkedIngredientRows { get; init; }
}