mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-09 11:55:18 -05:00
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:
@@ -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,
|
||||
|
||||
@@ -44,3 +44,4 @@ class GroupRecipeActionPagination(PaginationBase):
|
||||
class GroupRecipeActionPayload(MealieModel):
|
||||
action: GroupRecipeActionOut
|
||||
content: Any
|
||||
scaled_amount: float
|
||||
|
||||
Reference in New Issue
Block a user