Files

43 lines
1004 B
Python

"""Pydantic schemas for StockLocation."""
from pydantic import BaseModel, Field
class StockLocationCreateRequest(BaseModel):
"""Request body for creating a new stock location."""
name: str = Field(..., max_length=255)
address: str | None = Field(None, max_length=500)
is_default: bool = False
class StockLocationUpdateRequest(BaseModel):
"""Request body for updating a stock location."""
name: str | None = Field(None, max_length=255)
address: str | None = Field(None, max_length=500)
is_default: bool | None = None
class StockLocationResponse(BaseModel):
"""Public stock location representation."""
id: str
account_id: str
name: str
address: str | None = None
is_default: bool
created_at: str
updated_at: str
model_config = {"from_attributes": True}
class StockLocationListResponse(BaseModel):
"""Paginated list of stock locations."""
items: list[StockLocationResponse]
total: int
page: int
size: int