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
Testing
- Unit tests for collection diff/upsert logic
- Integration tests: create, update with ingredient changes, non-owner update returns 403
Part of#1099
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; setsOwnerUserIdfrom provisioned callerPUT /api/recipe/{recipeId}— updates recipe; owner check (403 if caller is not the owner)Titlenon-empty; ingredientIngredientTextandMeasureTextnon-empty; stepInstructionTextnon-empty(OwnerUserId, Title)unique constraint would be violatedAcceptance criteria
POSTcreates recipe with ingredients and steps in a single transactionPUTreplaces ingredient/step collections atomicallyPUTreturns 403 for non-ownersTesting
Part of#1099