34 lines
668 B
Python
34 lines
668 B
Python
|
import uuid
|
||
|
from typing import Optional
|
||
|
|
||
|
from pydantic import BaseModel, Field
|
||
|
|
||
|
from barker.schemas import to_camel
|
||
|
|
||
|
|
||
|
class PrinterIn(BaseModel):
|
||
|
name: str = Field(..., min_length=1)
|
||
|
address: str = Field(..., min_length=1)
|
||
|
cut_code: Optional[str]
|
||
|
|
||
|
class Config:
|
||
|
fields = {"id_": "id"}
|
||
|
anystr_strip_whitespace = True
|
||
|
alias_generator = to_camel
|
||
|
|
||
|
|
||
|
class Printer(PrinterIn):
|
||
|
id_: uuid.UUID
|
||
|
|
||
|
class Config:
|
||
|
fields = {"id_": "id"}
|
||
|
anystr_strip_whitespace = True
|
||
|
alias_generator = to_camel
|
||
|
|
||
|
|
||
|
class PrinterLink(BaseModel):
|
||
|
id_: uuid.UUID = Field(...)
|
||
|
|
||
|
class Config:
|
||
|
fields = {"id_": "id"}
|