fastfood/fastfood/schemas.py

34 lines
447 B
Python

from typing import Optional
from uuid import UUID
from pydantic import BaseModel
class MenuBase(BaseModel):
title: str
description: Optional[str]
class Config:
from_attributes = True
class Menu(MenuBase):
id: UUID
class MenuRead(Menu):
submenus_count: int
dishes_count: int
class SubMenuRead(Menu):
dishes_count: int
class DishBase(MenuBase):
price: float
class Dish(DishBase, Menu):
pass