24 lines
650 B
Python
24 lines
650 B
Python
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
|
|
class IsoThreadBase(BaseModel):
|
|
diameter_mm: float = Field(..., gt=0, description="Nominal diameter in mm")
|
|
pitch_mm: float = Field(..., gt=0, description="Thread pitch in mm")
|
|
depth_mm: float | None = Field(None, gt=0, description="Thread depth in mm")
|
|
|
|
|
|
class IsoThreadCreate(IsoThreadBase):
|
|
pass
|
|
|
|
|
|
class IsoThreadUpdate(BaseModel):
|
|
diameter_mm: float | None = Field(None, gt=0)
|
|
pitch_mm: float | None = Field(None, gt=0)
|
|
depth_mm: float | None = Field(None, gt=0)
|
|
|
|
|
|
class IsoThreadRead(IsoThreadBase):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: int
|