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,94 @@
|
||||
"""Pydantic schemas for Crew and CrewAvailability."""
|
||||
|
||||
from datetime import datetime
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class CrewAvailabilityResponse(BaseModel):
|
||||
"""Public crew availability representation."""
|
||||
id: str
|
||||
crew_id: str
|
||||
start_date: str
|
||||
end_date: str
|
||||
status: str
|
||||
notes: str | None = None
|
||||
created_at: str
|
||||
updated_at: str
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class CrewCreateRequest(BaseModel):
|
||||
"""Request body for creating a new crew member."""
|
||||
first_name: str = Field(..., max_length=100)
|
||||
last_name: str = Field(..., max_length=100)
|
||||
email: str | None = Field(None, max_length=255)
|
||||
phone: str | None = Field(None, max_length=50)
|
||||
role_title: str | None = Field(None, max_length=100)
|
||||
hourly_rate: float | None = None
|
||||
is_active: bool = True
|
||||
notes: str | None = None
|
||||
|
||||
|
||||
class CrewUpdateRequest(BaseModel):
|
||||
"""Request body for updating a crew member."""
|
||||
first_name: str | None = Field(None, max_length=100)
|
||||
last_name: str | None = Field(None, max_length=100)
|
||||
email: str | None = Field(None, max_length=255)
|
||||
phone: str | None = Field(None, max_length=50)
|
||||
role_title: str | None = Field(None, max_length=100)
|
||||
hourly_rate: float | None = None
|
||||
is_active: bool | None = None
|
||||
notes: str | None = None
|
||||
|
||||
|
||||
class CrewResponse(BaseModel):
|
||||
"""Public crew member representation."""
|
||||
id: str
|
||||
account_id: str
|
||||
first_name: str
|
||||
last_name: str
|
||||
email: str | None = None
|
||||
phone: str | None = None
|
||||
role_title: str | None = None
|
||||
hourly_rate: float | None = None
|
||||
is_active: bool
|
||||
notes: str | None = None
|
||||
created_at: str
|
||||
updated_at: str
|
||||
availabilities: list[CrewAvailabilityResponse] = []
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class CrewListResponse(BaseModel):
|
||||
"""Paginated list of crew members."""
|
||||
items: list[CrewResponse]
|
||||
total: int
|
||||
page: int
|
||||
size: int
|
||||
|
||||
|
||||
class CrewAvailabilityCreateRequest(BaseModel):
|
||||
"""Request body for creating crew availability."""
|
||||
crew_id: str
|
||||
start_date: str = Field(..., description="ISO datetime with timezone")
|
||||
end_date: str = Field(..., description="ISO datetime with timezone")
|
||||
status: str = Field("available", max_length=20)
|
||||
notes: str | None = None
|
||||
|
||||
|
||||
class CrewAvailabilityUpdateRequest(BaseModel):
|
||||
"""Request body for updating crew availability."""
|
||||
start_date: str | None = None
|
||||
end_date: str | None = None
|
||||
status: str | None = Field(None, max_length=20)
|
||||
notes: str | None = None
|
||||
|
||||
|
||||
class CrewAvailabilityListResponse(BaseModel):
|
||||
"""Paginated list of crew availabilities."""
|
||||
items: list[CrewAvailabilityResponse]
|
||||
total: int
|
||||
page: int
|
||||
size: int
|
||||
Reference in New Issue
Block a user