38 lines
716 B
Python
38 lines
716 B
Python
import uuid
|
|
from typing import Optional
|
|
from decimal import Decimal
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
from barker.schemas import to_camel
|
|
|
|
|
|
class TaxIn(BaseModel):
|
|
name: str = Field(..., min_length=1)
|
|
rate: Decimal = Field(ge=0, multiple_of=0.01, default=0)
|
|
|
|
class Config:
|
|
fields = {"id_": "id"}
|
|
anystr_strip_whitespace = True
|
|
alias_generator = to_camel
|
|
|
|
|
|
class Tax(TaxIn):
|
|
id_: uuid.UUID
|
|
is_fixture: bool
|
|
|
|
class Config:
|
|
fields = {"id_": "id"}
|
|
anystr_strip_whitespace = True
|
|
alias_generator = to_camel
|
|
|
|
|
|
class TaxLink(BaseModel):
|
|
id_: uuid.UUID = Field(...)
|
|
name: Optional[str]
|
|
|
|
class Config:
|
|
fields = {"id_": "id"}
|
|
|
|
|