39 lines
816 B
Python
39 lines
816 B
Python
import uuid
|
|
from typing import Optional, List
|
|
from decimal import Decimal
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
from barker.schemas import to_camel
|
|
from barker.schemas.product import ProductLink
|
|
|
|
|
|
class CustomerIn(BaseModel):
|
|
name: str = Field(..., min_length=1)
|
|
company: str
|
|
phone: str = Field(..., min_length=1)
|
|
address: str
|
|
|
|
class Config:
|
|
fields = {"id_": "id"}
|
|
anystr_strip_whitespace = True
|
|
alias_generator = to_camel
|
|
|
|
|
|
class Customer(CustomerIn):
|
|
id_: uuid.UUID
|
|
|
|
class Config:
|
|
fields = {"id_": "id"}
|
|
anystr_strip_whitespace = True
|
|
alias_generator = to_camel
|
|
|
|
|
|
class CustomerLink(BaseModel):
|
|
id_: uuid.UUID = Field(...)
|
|
name: Optional[str]
|
|
|
|
class Config:
|
|
fields = {"id_": "id"}
|
|
alias_generator = to_camel
|