feat: add the selected recipe servings and yields in the content of the recipe post action (#5340)

Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com>
This commit is contained in:
Felix Schneider
2025-06-18 21:57:51 +02:00
committed by GitHub
parent ac984a2d04
commit 78b55c0b98
5 changed files with 12 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
from functools import cached_property
import requests
from fastapi import APIRouter, BackgroundTasks, Depends, HTTPException, status
from fastapi import APIRouter, BackgroundTasks, Body, Depends, HTTPException, status
from fastapi.encoders import jsonable_encoder
from pydantic import UUID4
@@ -68,7 +68,9 @@ class GroupRecipeActionController(BaseUserController):
# Actions
@router.post("/{item_id}/trigger/{recipe_slug}", status_code=202)
def trigger_action(self, item_id: UUID4, recipe_slug: str, bg_tasks: BackgroundTasks) -> None:
def trigger_action(
self, item_id: UUID4, recipe_slug: str, bg_tasks: BackgroundTasks, scaled_amount: float = Body(1, embed=True)
) -> None:
recipe_action = self.repos.group_recipe_actions.get_one(item_id)
if not recipe_action:
raise HTTPException(
@@ -93,7 +95,7 @@ class GroupRecipeActionController(BaseUserController):
detail=ErrorResponse.respond(message="Not found."),
) from e
payload = GroupRecipeActionPayload(action=recipe_action, content=recipe)
payload = GroupRecipeActionPayload(action=recipe_action, content=recipe, scaled_amount=scaled_amount)
bg_tasks.add_task(
task_action,
url=recipe_action.url,

View File

@@ -44,3 +44,4 @@ class GroupRecipeActionPagination(PaginationBase):
class GroupRecipeActionPayload(MealieModel):
action: GroupRecipeActionOut
content: Any
scaled_amount: float