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,58 @@
|
||||
"""Pydantic schemas for EquipmentGroup (Bundles)."""
|
||||
|
||||
from datetime import datetime
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class EquipmentGroupItem(BaseModel):
|
||||
"""An item inside a bundle with quantity."""
|
||||
equipment_id: str
|
||||
name: str | None = None
|
||||
quantity: float = 1.0
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class EquipmentGroupCreateRequest(BaseModel):
|
||||
"""Request body for creating a new equipment group/bundle."""
|
||||
name: str = Field(..., max_length=255)
|
||||
description: str | None = None
|
||||
daily_rate: float | None = None
|
||||
default_location_id: str | None = None
|
||||
items: list[EquipmentGroupItem] = []
|
||||
|
||||
|
||||
class EquipmentGroupUpdateRequest(BaseModel):
|
||||
"""Request body for updating an equipment group."""
|
||||
name: str | None = Field(None, max_length=255)
|
||||
description: str | None = None
|
||||
daily_rate: float | None = None
|
||||
default_location_id: str | None = None
|
||||
items: list[EquipmentGroupItem] | None = None
|
||||
|
||||
|
||||
class EquipmentGroupResponse(BaseModel):
|
||||
"""Public equipment group representation."""
|
||||
id: str
|
||||
account_id: str
|
||||
name: str
|
||||
description: str | None = None
|
||||
daily_rate: float | None = None
|
||||
default_location: LocationRef | None = None
|
||||
items: list[EquipmentGroupItem] = []
|
||||
created_at: str
|
||||
updated_at: str
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class EquipmentGroupListResponse(BaseModel):
|
||||
"""Paginated list of equipment groups."""
|
||||
items: list[EquipmentGroupResponse]
|
||||
total: int
|
||||
page: int
|
||||
size: int
|
||||
|
||||
|
||||
# Need LocationRef for EquipmentGroupResponse
|
||||
from app.schemas.equipment import LocationRef # noqa: E402, F811
|
||||
Reference in New Issue
Block a user