mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-02-03 14:33:11 -05:00
* multiple recipes per day * fix update * meal-planner rewrite * disable meal-tests * spacing Co-authored-by: hay-kot <hay-kot@pm.me>
36 lines
723 B
Python
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,
|
|
}
|