barker/barker/barker/schemas/table.py

35 lines
859 B
Python

import uuid
from pydantic import BaseModel, ConfigDict, Field
from . import to_camel
from .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
model_config = ConfigDict(str_strip_whitespace=True, alias_generator=to_camel, populate_by_name=True)
class Table(TableIn):
id_: uuid.UUID
model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
class TableBlank(BaseModel):
name: str
seats: int
is_active: bool
sort_order: int
model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
class TableLink(BaseModel):
id_: uuid.UUID = Field(...)
name: str | None = None
model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)