Goal
Allow users with the recipe:publish permission to publish and unpublish recipes, making them visible at their public slug URL.
Spec reference
docs/specs/recipe-creation-target-architecture.md — §"Access and publication model – Admin publication control"
Implementation notes
- Auth0 permission
recipe:publish; add a corresponding ASP.NET Core authorization policy
PUT /api/recipe/{recipeId}/publication (admin only):
- Publish action: creates or reactivates
RecipePublication row with generated slug; emits RecipePublished outbox event
- Unpublish action: sets
UnpublishedAtUtc/UnpublishedByUserId; emits RecipeUnpublished outbox event
- Request body:
{ action: "publish" | "unpublish" }
- Extend search projection consumer (from E5.4) to handle
RecipePublished and RecipeUnpublished events: update IsPublishedExternally field on RecipeSearchIndex row
- 403 for callers without
recipe:publish; 404 if recipe not found
Acceptance criteria
Testing
- Integration tests: publish success, unpublish success, non-admin 403
- Integration test: search index
IsPublishedExternally updated after consumer cycle
Part of#1103
Goal
Allow users with the
recipe:publishpermission to publish and unpublish recipes, making them visible at their public slug URL.Spec reference
docs/specs/recipe-creation-target-architecture.md— §"Access and publication model – Admin publication control"Implementation notes
recipe:publish; add a corresponding ASP.NET Core authorization policyPUT /api/recipe/{recipeId}/publication(admin only):RecipePublicationrow with generated slug; emitsRecipePublishedoutbox eventUnpublishedAtUtc/UnpublishedByUserId; emitsRecipeUnpublishedoutbox event{ action: "publish" | "unpublish" }RecipePublishedandRecipeUnpublishedevents: updateIsPublishedExternallyfield onRecipeSearchIndexrowrecipe:publish; 404 if recipe not foundAcceptance criteria
RecipePublicationrow and emits outbox eventUnpublishedAtUtcand emits outbox eventRecipeSearchIndex.IsPublishedExternallyupdated by consumer after event processedTesting
IsPublishedExternallyupdated after consumer cyclePart of#1103