Skip to content

Improve recipe editing: allow full editing of recipe properties #1448

@marcuscastelo

Description

@marcuscastelo

reportedBy: github-copilot.v1

Improve recipe editing: enable editing of existing recipe fields (name, items, prepared_multiplier)

Summary

  • Enable editing of the recipe fields that currently exist in the domain model: name, items, and prepared_multiplier.

Scope

  • This issue focuses on UI and application support for editing existing recipe fields. It does NOT add new schema fields (e.g., tags, prep time, servings). Schema extensions will be tracked separately.

Description

  • Users must be able to modify recipe name, add/remove/update items (ingredient entries), and adjust prepared_multiplier from the UI. Changes must be validated at the domain layer and persisted via the repository with proper error handling and telemetry.

Motivation

  • Improve usability by allowing users to edit the fields that already exist in the model without introducing immediate schema changes or data migrations.

Acceptance criteria

  • UI allows editing of name.
  • UI allows adding, removing and updating items (ingredient entries: name, quantity, unit) and saving changes.
  • UI allows adjusting prepared_multiplier and saving changes.
  • Domain validation blocks invalid saves and returns clear errors surfaced to users via showError.
  • Application performs optimistic updates with rollback on error and logs failures via logging.
  • Repository persists partial updates correctly and maintains backwards compatibility with legacy DAO shapes.
  • Unit and integration tests cover domain validation and the edit use case.

Implementation notes

  • Frontend: Update src/sections/recipe/components/RecipeEditModal.tsx (or the responsible component) to expose and validate existing fields and item list controls.
  • Domain: Use existing Zod schemas (src/modules/diet/recipe/domain/recipe.ts) for validation; ensure items schema and prepared_multiplier checks are enforced.
  • Application: Implement editRecipe use case to validate, call repository, update signals, and handle optimistic updates/rollback.
  • Infrastructure: Ensure supabaseRecipeRepository supports partial updates (update fields provided in a patch object) and DAO conversions.
  • Tests: Add unit tests for validation and integration tests for the edit flow.

Files to inspect

  • src/modules/diet/recipe/domain/recipe.ts
  • src/modules/diet/recipe/domain/recipeOperations.ts
  • src/modules/diet/recipe/application/recipe.ts
  • src/modules/diet/recipe/infrastructure/supabaseRecipeRepository.ts
  • src/sections/recipe/components/RecipeEditModal.tsx

Labels: feature, complexity-medium, ui
Assignee: marcuscastelo

Metadata

Metadata

Assignees

Labels

complexity-mediumMedium implementation complexityfeatureRequest or implement a new featureuiUI/UX related issue or improvement

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions