43 lines
997 B
Python
43 lines
997 B
Python
"""Pydantic schemas for equipment endpoints."""
|
|
from pydantic import BaseModel
|
|
from decimal import Decimal
|
|
from typing import Any
|
|
|
|
|
|
class EquipmentItem(BaseModel):
|
|
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
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class EquipmentDetail(BaseModel):
|
|
id: int
|
|
rentman_id: str
|
|
name: str
|
|
number: str | None = None
|
|
category: str | None = None
|
|
description: str | None = None
|
|
specifications: dict[str, Any] | None = None
|
|
images: list[str] | None = None
|
|
rental_price: Decimal | None = None
|
|
brand: str | None = None
|
|
available: bool = True
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class PaginatedResponse(BaseModel):
|
|
items: list[EquipmentItem]
|
|
total: int
|
|
page: int
|
|
page_size: int
|
|
total_pages: int
|