Initial commit: Rentman Clone - Phase 0-6 (T001-T023)
Completed: - Phase 0: Project Setup (T001-T003) - Docker Compose, FastAPI skeleton, React SPA - Phase 1: Auth System (T004-T008) - DB models, JWT auth, RBAC middleware, user management - Phase 2: Contacts & Tags (T009-T011) - CRUD API + UI - Phase 3: Equipment Catalog (T012-T014) - Models, API, UI with barcode/QR - Phase 4: Crew Management (T015-T017) - Models, availability, UI - Phase 5: Vehicle Fleet (T018-T020) - Models, assignments, UI - Phase 6: Projects (T021-T023) - Project hierarchy models, CRUD API, list/detail UI
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
"""Pydantic schemas for Equipment (inventory catalog)."""
|
||||
|
||||
from datetime import datetime
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class EquipmentCreateRequest(BaseModel):
|
||||
"""Request body for creating new equipment."""
|
||||
name: str = Field(..., max_length=255)
|
||||
category: str | None = Field(None, max_length=100)
|
||||
brand: str | None = Field(None, max_length=255)
|
||||
serial_number: str | None = Field(None, max_length=100)
|
||||
barcode: str | None = Field(None, max_length=100)
|
||||
qr_code: str | None = Field(None, max_length=500)
|
||||
status: str = Field("available", max_length=20)
|
||||
purchase_price: float | None = None
|
||||
current_value: float | None = None
|
||||
weight_kg: float | None = None
|
||||
dimensions: str | None = Field(None, max_length=255)
|
||||
power_watt: float | None = None
|
||||
notes: str | None = None
|
||||
custom_fields: str | None = None
|
||||
location_id: str | None = None
|
||||
supplier_id: str | None = None
|
||||
|
||||
|
||||
class EquipmentUpdateRequest(BaseModel):
|
||||
"""Request body for updating existing equipment."""
|
||||
name: str | None = Field(None, max_length=255)
|
||||
category: str | None = Field(None, max_length=100)
|
||||
brand: str | None = Field(None, max_length=255)
|
||||
serial_number: str | None = Field(None, max_length=100)
|
||||
barcode: str | None = Field(None, max_length=100)
|
||||
qr_code: str | None = Field(None, max_length=500)
|
||||
status: str | None = Field(None, max_length=20)
|
||||
purchase_price: float | None = None
|
||||
current_value: float | None = None
|
||||
weight_kg: float | None = None
|
||||
dimensions: str | None = Field(None, max_length=255)
|
||||
power_watt: float | None = None
|
||||
notes: str | None = None
|
||||
custom_fields: str | None = None
|
||||
location_id: str | None = None
|
||||
supplier_id: str | None = None
|
||||
|
||||
|
||||
class LocationRef(BaseModel):
|
||||
"""Minimal stock location reference."""
|
||||
id: str
|
||||
name: str
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class SupplierRef(BaseModel):
|
||||
"""Minimal supplier (contact) reference."""
|
||||
id: str
|
||||
name: str | None = None
|
||||
company_name: str | None = None
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class EquipmentResponse(BaseModel):
|
||||
"""Public equipment representation."""
|
||||
id: str
|
||||
account_id: str
|
||||
name: str
|
||||
category: str | None = None
|
||||
brand: str | None = None
|
||||
serial_number: str | None = None
|
||||
barcode: str | None = None
|
||||
qr_code: str | None = None
|
||||
status: str
|
||||
purchase_price: float | None = None
|
||||
current_value: float | None = None
|
||||
weight_kg: float | None = None
|
||||
dimensions: str | None = None
|
||||
power_watt: float | None = None
|
||||
notes: str | None = None
|
||||
custom_fields: str | None = None
|
||||
location: LocationRef | None = None
|
||||
supplier: SupplierRef | None = None
|
||||
created_at: str
|
||||
updated_at: str
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class EquipmentListResponse(BaseModel):
|
||||
"""Paginated list of equipment."""
|
||||
items: list[EquipmentResponse]
|
||||
total: int
|
||||
page: int
|
||||
size: int
|
||||
Reference in New Issue
Block a user