51 lines
1.1 KiB
Python
51 lines
1.1 KiB
Python
|
|
"""Pydantic schemas for equipment endpoints."""
|
||
|
|
|
||
|
|
from decimal import Decimal
|
||
|
|
|
||
|
|
from pydantic import BaseModel, ConfigDict
|
||
|
|
|
||
|
|
|
||
|
|
class EquipmentItem(BaseModel):
|
||
|
|
"""Equipment item for list responses."""
|
||
|
|
|
||
|
|
model_config = ConfigDict(from_attributes=True)
|
||
|
|
|
||
|
|
id: int
|
||
|
|
rentman_id: str
|
||
|
|
name: str
|
||
|
|
number: str | None = None
|
||
|
|
category: str | None = None
|
||
|
|
description: str | None = None
|
||
|
|
image_url: str | None = None
|
||
|
|
rental_price: Decimal | None = None
|
||
|
|
available: bool = True
|
||
|
|
|
||
|
|
|
||
|
|
class EquipmentDetail(BaseModel):
|
||
|
|
"""Equipment detail with full specifications."""
|
||
|
|
|
||
|
|
model_config = ConfigDict(from_attributes=True)
|
||
|
|
|
||
|
|
id: int
|
||
|
|
rentman_id: str
|
||
|
|
name: str
|
||
|
|
number: str | None = None
|
||
|
|
category: str | None = None
|
||
|
|
subcategory: str | None = None
|
||
|
|
description: str | None = None
|
||
|
|
specifications: dict | None = None
|
||
|
|
images: list | None = None
|
||
|
|
rental_price: Decimal | None = None
|
||
|
|
brand: str | None = None
|
||
|
|
available: bool = True
|
||
|
|
|
||
|
|
|
||
|
|
class PaginatedEquipment(BaseModel):
|
||
|
|
"""Paginated response for equipment list."""
|
||
|
|
|
||
|
|
items: list[EquipmentItem]
|
||
|
|
total: int
|
||
|
|
page: int
|
||
|
|
page_size: int
|
||
|
|
total_pages: int
|