32 lines
602 B
Python
32 lines
602 B
Python
from pydantic import BaseModel
|
|
from typing import Optional
|
|
|
|
|
|
PROTOCOLS = ["escpos_tcp"] # extend later as needed
|
|
|
|
|
|
class PrinterBase(BaseModel):
|
|
name: str
|
|
ip_address: str
|
|
port: int = 9100
|
|
is_active: bool = True
|
|
protocol: str = "escpos_tcp"
|
|
|
|
|
|
class PrinterCreate(PrinterBase):
|
|
pass
|
|
|
|
|
|
class PrinterUpdate(BaseModel):
|
|
name: Optional[str] = None
|
|
ip_address: Optional[str] = None
|
|
port: Optional[int] = None
|
|
is_active: Optional[bool] = None
|
|
protocol: Optional[str] = None
|
|
|
|
|
|
class PrinterOut(PrinterBase):
|
|
id: int
|
|
|
|
model_config = {"from_attributes": True}
|