45 lines
863 B
Python
45 lines
863 B
Python
import uuid
|
|
|
|
from typing import List, Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
from . import to_camel
|
|
from .product_link import ProductLink
|
|
|
|
|
|
class MenuCategoryIn(BaseModel):
|
|
name: str = Field(..., min_length=1)
|
|
is_active: bool
|
|
is_fixture: bool
|
|
|
|
class Config:
|
|
anystr_strip_whitespace = True
|
|
alias_generator = to_camel
|
|
|
|
|
|
class MenuCategory(MenuCategoryIn):
|
|
id_: uuid.UUID
|
|
sort_order: int
|
|
|
|
class Config:
|
|
anystr_strip_whitespace = True
|
|
alias_generator = to_camel
|
|
|
|
|
|
class MenuCategoryBlank(MenuCategoryIn):
|
|
name: str
|
|
|
|
class Config:
|
|
anystr_strip_whitespace = True
|
|
alias_generator = to_camel
|
|
|
|
|
|
class MenuCategoryLink(BaseModel):
|
|
id_: uuid.UUID = Field(...)
|
|
name: Optional[str]
|
|
products: Optional[List[ProductLink]]
|
|
|
|
class Config:
|
|
fields = {"id_": "id"}
|