fastfood/fastfood/schemas.py

45 lines
576 B
Python
Raw Normal View History

2024-01-20 03:29:15 +03:00
from uuid import UUID
from pydantic import BaseModel
class MenuBase(BaseModel):
title: str
description: str | None
2024-01-21 08:12:51 +03:00
class Config:
2024-01-20 03:29:15 +03:00
from_attributes = True
class Menu(MenuBase):
2024-01-20 03:29:15 +03:00
id: UUID
class MenuRead(Menu):
submenus_count: int
dishes_count: int
class SubMenuRead(Menu):
dishes_count: int
2024-01-21 08:12:51 +03:00
class DishBase(MenuBase):
price: str
2024-01-21 08:12:51 +03:00
class Dish(DishBase, Menu):
pass
class Dish_db(MenuBase):
price: float
class SubMenuSummary(Menu):
dishes: list[Dish_db]
class MenuSummary(Menu):
submenus: list[SubMenuSummary]