27 lines
922 B
Python
27 lines
922 B
Python
from pydantic import BaseModel, Field
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
from uuid import UUID
|
|
|
|
class MenuBase(BaseModel):
|
|
name: str = Field(..., description="Name of the menu")
|
|
description: Optional[str] = Field(None, description="Description of the menu")
|
|
category: str = Field(..., description="Category of the menu")
|
|
price: int = Field(..., description="Price of the menu")
|
|
|
|
class MenuCreate(MenuBase):
|
|
pass
|
|
|
|
class MenuUpdate(MenuBase):
|
|
name: Optional[str] = Field(None, description="Name of the menu")
|
|
description: Optional[str] = Field(None, description="Description of the menu")
|
|
category: Optional[str] = Field(None, description="Category of the menu")
|
|
price: Optional[int] = Field(None, description="Price of the menu")
|
|
|
|
class MenuSchema(MenuBase):
|
|
id: UUID
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
orm_mode = True |