31 lines
855 B
Python
31 lines
855 B
Python
import uuid
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
from . import to_camel
|
|
|
|
|
|
class ProductGroupIn(BaseModel):
|
|
name: str = Field(..., min_length=1)
|
|
nutritional: bool
|
|
ice_cream: bool
|
|
model_config = ConfigDict(str_strip_whitespace=True, alias_generator=to_camel, populate_by_name=True)
|
|
|
|
|
|
class ProductGroup(ProductGroupIn):
|
|
id_: uuid.UUID
|
|
is_fixture: bool
|
|
model_config = ConfigDict(str_strip_whitespace=True, alias_generator=to_camel, populate_by_name=True)
|
|
|
|
|
|
class ProductGroupBlank(ProductGroupIn):
|
|
name: str
|
|
is_fixture: bool
|
|
model_config = ConfigDict(str_strip_whitespace=True, alias_generator=to_camel, populate_by_name=True)
|
|
|
|
|
|
class ProductGroupLink(BaseModel):
|
|
id_: uuid.UUID = Field(...)
|
|
name: str | None = None
|
|
model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
|