Files
mealie/mealie/schema/shopping_list.py
Hayden ef87f2231d feature/mealplanner-rewrite (#417)
* multiple recipes per day

* fix update

* meal-planner rewrite

* disable meal-tests

* spacing

Co-authored-by: hay-kot <hay-kot@pm.me>
2021-05-22 21:04:19 -08:00

36 lines
723 B
Python

from typing import Optional
from fastapi_camelcase import CamelModel
from mealie.db.models.shopping_list import ShoppingList
from pydantic.utils import GetterDict
class ListItem(CamelModel):
title: Optional[str]
text: str = ""
quantity: int = 1
checked: bool = False
class Config:
orm_mode = True
class ShoppingListIn(CamelModel):
name: str
group: Optional[str]
items: list[ListItem]
class ShoppingListOut(ShoppingListIn):
id: int
class Config:
orm_mode = True
@classmethod
def getter_dict(cls, ormModel: ShoppingList):
return {
**GetterDict(ormModel),
"group": ormModel.group.name,
}