Skip to content

Extend create/update recipe endpoints to accept ingredients and steps #1116

Description

@dgee2

Goal

Extend the recipe create and update endpoints to accept a full recipe payload including ingredients and steps.

Spec reference

docs/specs/recipe-creation-target-architecture.md — §"API changes required"

Implementation notes

  • POST /api/recipe — creates recipe with ingredient and step collections; sets OwnerUserId from provisioned caller
  • PUT /api/recipe/{recipeId} — updates recipe; owner check (403 if caller is not the owner)
  • Service-layer logic: diff and upsert ingredient collection and step collection in a single transaction (replace collection by recipeId)
  • Validate: Title non-empty; ingredient IngredientText and MeasureText non-empty; step InstructionText non-empty
  • Accept zero ingredients / zero steps (valid minimal recipe)
  • Return 409 if (OwnerUserId, Title) unique constraint would be violated

Acceptance criteria

  • POST creates recipe with ingredients and steps in a single transaction
  • PUT replaces ingredient/step collections atomically
  • Owner check on PUT returns 403 for non-owners
  • Validation errors return 400

Testing

  • Unit tests for collection diff/upsert logic
  • Integration tests: create, update with ingredient changes, non-owner update returns 403

Part of#1099

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETPull requests that update .net codeenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions