mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-28 05:05:12 -05:00
feat: Improved Recipe Scaling Support and Shopping List Recipe Refactor (#1847)
* propogate scale changes to print view * fixed incorrect variable reference * refactored shopping list recipe routes cleaned up existing logic added support for recipe scaling * updated current revision * adding to shopping list respects UI recipe scale * added field annotations * added tests for recipe scaling * made column nullable and set to 1 during migration
This commit is contained in:
@@ -15,6 +15,10 @@ from mealie.schema.response.pagination import PaginationBase
|
||||
class ShoppingListItemRecipeRef(MealieModel):
|
||||
recipe_id: UUID4
|
||||
recipe_quantity: NoneFloat = 0
|
||||
"""the quantity of this item in a single recipe (scale == 1)"""
|
||||
|
||||
recipe_scale: NoneFloat = 1
|
||||
"""the number of times this recipe has been added"""
|
||||
|
||||
|
||||
class ShoppingListItemRecipeRefOut(ShoppingListItemRecipeRef):
|
||||
@@ -79,6 +83,8 @@ class ShoppingListRecipeRefOut(MealieModel):
|
||||
shopping_list_id: UUID4
|
||||
recipe_id: UUID4
|
||||
recipe_quantity: float
|
||||
"""the number of times this recipe has been added"""
|
||||
|
||||
recipe: RecipeSummary
|
||||
|
||||
class Config:
|
||||
@@ -118,6 +124,14 @@ class ShoppingListOut(ShoppingListUpdate):
|
||||
orm_mode = True
|
||||
|
||||
|
||||
class ShoppingListAddRecipeParams(MealieModel):
|
||||
recipe_increment_quantity: float = 1
|
||||
|
||||
|
||||
class ShoppingListRemoveRecipeParams(MealieModel):
|
||||
recipe_decrement_quantity: float = 1
|
||||
|
||||
|
||||
from mealie.schema.labels.multi_purpose_label import MultiPurposeLabelSummary # noqa: E402
|
||||
from mealie.schema.recipe.recipe import RecipeSummary # noqa: E402
|
||||
|
||||
|
||||
Reference in New Issue
Block a user