36 lines
687 B
Python
36 lines
687 B
Python
import uuid
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
from barker.schemas import to_camel
|
|
from barker.schemas.section import SectionLink
|
|
|
|
|
|
class TableIn(BaseModel):
|
|
name: str = Field(..., min_length=1)
|
|
seats: int = Field(ge=0)
|
|
section: SectionLink
|
|
is_active: bool
|
|
sort_order: int
|
|
|
|
class Config:
|
|
anystr_strip_whitespace = True
|
|
alias_generator = to_camel
|
|
|
|
|
|
class Table(TableIn):
|
|
id_: uuid.UUID
|
|
|
|
class Config:
|
|
alias_generator = to_camel
|
|
|
|
|
|
class TableLink(BaseModel):
|
|
id_: uuid.UUID = Field(...)
|
|
name: Optional[str]
|
|
|
|
class Config:
|
|
fields = {"id_": "id"}
|
|
alias_generator = to_camel
|