Files
DailyMeals/MealPlan.Api/Models/Recipe.cs
Piotr Kus f15bb7a916 * Extended functionalities
* Added different UIs
2026-06-24 21:43:40 +02:00

60 lines
1.5 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace MealPlan.Api.Models;
/// <summary>
/// Maps to the existing "Recipes" table. Database-first; no migrations manage this table.
/// </summary>
[Table("Recipes")]
public class Recipe
{
[Column("Id")]
public int Id { get; set; }
[Column("Name")]
[MaxLength(255)]
public string Name { get; set; } = string.Empty;
/// <summary>Stored as INT in the DB (0..3). Mapped to the <see cref="MealCategory"/> enum.</summary>
[Column("MealCategory")]
public int MealCategory { get; set; }
[Column("Calories")]
public int? Calories { get; set; }
[Column("Protein")]
public decimal? Protein { get; set; }
[Column("Fat")]
public decimal? Fat { get; set; }
[Column("Carbs")]
public decimal? Carbs { get; set; }
[Column("PrepTimeMinutes")]
public int? PrepTimeMinutes { get; set; }
[Column("CreatedAt")]
public DateTime CreatedAt { get; set; }
[Column("UpdatedAt")]
public DateTime? UpdatedAt { get; set; }
[Column("IsActive")]
public bool IsActive { get; set; }
[Column("Source")]
[MaxLength(32)]
public string Source { get; set; } = "manual";
[Column("CreatedByUserId")]
public Guid? CreatedByUserId { get; set; }
[Column("IsDraft")]
public bool IsDraft { get; set; }
public ICollection<Ingredient> Ingredients { get; set; } = new List<Ingredient>();
public ICollection<RecipeStep> Steps { get; set; } = new List<RecipeStep>();
}