34 lines
658 B
Python
34 lines
658 B
Python
|
import uuid
|
||
|
from pydantic import BaseModel, Field
|
||
|
|
||
|
from barker.schemas import to_camel
|
||
|
from barker.schemas.tax import TaxLink
|
||
|
|
||
|
|
||
|
class SaleCategoryIn(BaseModel):
|
||
|
name: str = Field(..., min_length=1)
|
||
|
tax: TaxLink = Field(...)
|
||
|
|
||
|
class Config:
|
||
|
fields = {"id_": "id"}
|
||
|
anystr_strip_whitespace = True
|
||
|
alias_generator = to_camel
|
||
|
|
||
|
|
||
|
class SaleCategory(SaleCategoryIn):
|
||
|
id_: uuid.UUID
|
||
|
|
||
|
class Config:
|
||
|
fields = {"id_": "id"}
|
||
|
anystr_strip_whitespace = True
|
||
|
alias_generator = to_camel
|
||
|
|
||
|
|
||
|
class SaleCategoryLink(BaseModel):
|
||
|
id_: uuid.UUID = Field(...)
|
||
|
|
||
|
class Config:
|
||
|
fields = {"id_": "id"}
|
||
|
|
||
|
|