mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-12 13:25:14 -05:00
feat(backend): 🗃️ Add CRUD opertaions for Food and Units
This commit is contained in:
@@ -11,6 +11,7 @@ from pydantic.utils import GetterDict
|
||||
from slugify import slugify
|
||||
|
||||
from .comments import CommentOut
|
||||
from .units_and_foods import IngredientFood, IngredientUnit
|
||||
|
||||
|
||||
class CreateRecipe(CamelModel):
|
||||
@@ -73,23 +74,11 @@ class Nutrition(CamelModel):
|
||||
orm_mode = True
|
||||
|
||||
|
||||
class RecipeIngredientFood(CamelModel):
|
||||
name: str = ""
|
||||
description: str = ""
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
|
||||
|
||||
class RecipeIngredientUnit(RecipeIngredientFood):
|
||||
pass
|
||||
|
||||
|
||||
class RecipeIngredient(CamelModel):
|
||||
title: Optional[str]
|
||||
note: Optional[str]
|
||||
unit: Optional[RecipeIngredientUnit]
|
||||
food: Optional[RecipeIngredientFood]
|
||||
unit: Optional[IngredientUnit]
|
||||
food: Optional[IngredientFood]
|
||||
disable_amount: bool = True
|
||||
quantity: int = 1
|
||||
|
||||
|
||||
24
mealie/schema/recipe/units_and_foods.py
Normal file
24
mealie/schema/recipe/units_and_foods.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from fastapi_camelcase import CamelModel
|
||||
|
||||
|
||||
class CreateIngredientFood(CamelModel):
|
||||
name: str
|
||||
description: str = ""
|
||||
|
||||
|
||||
class CreateIngredientUnit(CreateIngredientFood):
|
||||
abbreviation: str = ""
|
||||
|
||||
|
||||
class IngredientFood(CreateIngredientFood):
|
||||
id: int
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
|
||||
|
||||
class IngredientUnit(CreateIngredientUnit):
|
||||
id: int
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
Reference in New Issue
Block a user