diff --git a/CulinaryCommandApp/Migrations/AppDbContextModelSnapshot.cs b/CulinaryCommandApp/Migrations/AppDbContextModelSnapshot.cs index 291dbb2..e38a96e 100644 --- a/CulinaryCommandApp/Migrations/AppDbContextModelSnapshot.cs +++ b/CulinaryCommandApp/Migrations/AppDbContextModelSnapshot.cs @@ -911,18 +911,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("CreatedAt") .HasColumnType("datetime(6)"); - b.Property("ImageData") - .HasColumnType("longtext"); - b.Property("IsSubRecipe") .HasColumnType("bit(1)"); b.Property("LocationId") .HasColumnType("int"); - b.Property("PortionSize") - .HasMaxLength(128) - .HasColumnType("varchar(128)"); b.Property("RecipeType") .IsRequired() diff --git a/CulinaryCommandApp/Recipe/Entities/Recipe.cs b/CulinaryCommandApp/Recipe/Entities/Recipe.cs index e425a4e..b64b838 100644 --- a/CulinaryCommandApp/Recipe/Entities/Recipe.cs +++ b/CulinaryCommandApp/Recipe/Entities/Recipe.cs @@ -29,12 +29,6 @@ public class Recipe public bool IsSubRecipe { get; set; } = false; - [MaxLength(128)] - public string? PortionSize { get; set; } - - // Base64-encoded image (no MaxLength → LONGTEXT in MySQL) - public string? ImageData { get; set; } - public DateTime? CreatedAt { get; set; } // Optimistic concurrency token — backed by a MySQL timestamp(6) column diff --git a/CulinaryCommandApp/Recipe/Pages/RecipeForm.razor b/CulinaryCommandApp/Recipe/Pages/RecipeForm.razor index 33ded71..6e79e59 100644 --- a/CulinaryCommandApp/Recipe/Pages/RecipeForm.razor +++ b/CulinaryCommandApp/Recipe/Pages/RecipeForm.razor @@ -163,53 +163,6 @@ else {
- @* ---- Section: Recipe Image ---- *@ -
Recipe Image
- -
-
- @if (!string.IsNullOrWhiteSpace(Model.ImageData)) - { -
- Recipe preview - -
- } - else - { -
- -

No image uploaded

-

JPG, PNG or WEBP · max 5 MB

-
- } -
- - @if (!string.IsNullOrWhiteSpace(_imageError)) - { -
@_imageError
- } -
- -
- - @* ---- Section: Serving Info ---- *@ -
Serving & Nutrition
- -
-
- - -
-
-
@* ---- Section 2: Ingredient Lines ----*@ @@ -451,9 +404,6 @@ else { private bool _dataLoading; private readonly SemaphoreSlim _loadSemaphore = new(1, 1); - // Image upload - private string? _imageError; - // Reference data private List _recipeTypes = new(); private List _recipeCategories = new(); @@ -819,45 +769,6 @@ else { private void Cancel() => Nav.NavigateTo("/recipes"); - // *** Image upload *** - - private async Task HandleImageUpload(InputFileChangeEventArgs e) - { - _imageError = null; - var file = e.File; - - const long maxBytes = 5 * 1024 * 1024; // 5 MB - if (file.Size > maxBytes) - { - _imageError = "Image must be under 5 MB."; - return; - } - - if (!file.ContentType.StartsWith("image/")) - { - _imageError = "Please select a valid image file."; - return; - } - - try - { - using var ms = new System.IO.MemoryStream(); - await using var stream = file.OpenReadStream(maxBytes); - await stream.CopyToAsync(ms); - var base64 = Convert.ToBase64String(ms.ToArray()); - Model.ImageData = $"data:{file.ContentType};base64,{base64}"; - } - catch - { - _imageError = "Failed to read the image. Please try again."; - } - } - - private void RemoveImage() - { - Model.ImageData = null; - } - // *** View model for ingredient lines *** private sealed class IngredientLineViewModel { diff --git a/CulinaryCommandApp/Recipe/Pages/RecipeView.razor b/CulinaryCommandApp/Recipe/Pages/RecipeView.razor index 28dac1b..beb3424 100644 --- a/CulinaryCommandApp/Recipe/Pages/RecipeView.razor +++ b/CulinaryCommandApp/Recipe/Pages/RecipeView.razor @@ -55,17 +55,10 @@ @* Image card *@
- @if (!string.IsNullOrWhiteSpace(recipe.ImageData)) - { - @recipe.Title - } - else - { -
- - @recipe.Title -
- } +
+ + @recipe.Title +
@* Title *@ @@ -103,14 +96,6 @@ } - @if (!string.IsNullOrWhiteSpace(recipe.PortionSize)) - { -
  • - - Portion - @recipe.PortionSize -
  • - }