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,101 @@
|
||||
"""Pydantic schemas for contacts and tags."""
|
||||
|
||||
from pydantic import BaseModel, Field, EmailStr
|
||||
|
||||
|
||||
class TagResponse(BaseModel):
|
||||
"""Public tag representation."""
|
||||
id: str
|
||||
name: str
|
||||
color: str | None = None
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class ContactCreateRequest(BaseModel):
|
||||
"""Request body for creating a new contact."""
|
||||
type: str = Field(..., pattern="^(company|person)$")
|
||||
company_name: str | None = Field(None, max_length=255)
|
||||
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)
|
||||
mobile: str | None = Field(None, max_length=50)
|
||||
website: str | None = Field(None, max_length=500)
|
||||
billing_street: str | None = Field(None, max_length=255)
|
||||
billing_number: str | None = Field(None, max_length=20)
|
||||
billing_postalcode: str | None = Field(None, max_length=20)
|
||||
billing_city: str | None = Field(None, max_length=100)
|
||||
billing_country: str | None = Field(None, max_length=100)
|
||||
shipping_street: str | None = Field(None, max_length=255)
|
||||
shipping_number: str | None = Field(None, max_length=20)
|
||||
shipping_postalcode: str | None = Field(None, max_length=20)
|
||||
shipping_city: str | None = Field(None, max_length=100)
|
||||
shipping_country: str | None = Field(None, max_length=100)
|
||||
tax_number: str | None = Field(None, max_length=50)
|
||||
note: str | None = None
|
||||
tag_ids: list[str] = []
|
||||
|
||||
|
||||
class ContactUpdateRequest(BaseModel):
|
||||
"""Request body for updating an existing contact."""
|
||||
type: str | None = Field(None, pattern="^(company|person)$")
|
||||
company_name: str | None = Field(None, max_length=255)
|
||||
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)
|
||||
mobile: str | None = Field(None, max_length=50)
|
||||
website: str | None = Field(None, max_length=500)
|
||||
billing_street: str | None = Field(None, max_length=255)
|
||||
billing_number: str | None = Field(None, max_length=20)
|
||||
billing_postalcode: str | None = Field(None, max_length=20)
|
||||
billing_city: str | None = Field(None, max_length=100)
|
||||
billing_country: str | None = Field(None, max_length=100)
|
||||
shipping_street: str | None = Field(None, max_length=255)
|
||||
shipping_number: str | None = Field(None, max_length=20)
|
||||
shipping_postalcode: str | None = Field(None, max_length=20)
|
||||
shipping_city: str | None = Field(None, max_length=100)
|
||||
shipping_country: str | None = Field(None, max_length=100)
|
||||
tax_number: str | None = Field(None, max_length=50)
|
||||
note: str | None = None
|
||||
tag_ids: list[str] | None = None
|
||||
|
||||
|
||||
class ContactResponse(BaseModel):
|
||||
"""Public contact representation with tags."""
|
||||
id: str
|
||||
account_id: str
|
||||
type: str
|
||||
company_name: str | None = None
|
||||
first_name: str | None = None
|
||||
last_name: str | None = None
|
||||
email: str | None = None
|
||||
phone: str | None = None
|
||||
mobile: str | None = None
|
||||
website: str | None = None
|
||||
billing_street: str | None = None
|
||||
billing_number: str | None = None
|
||||
billing_postalcode: str | None = None
|
||||
billing_city: str | None = None
|
||||
billing_country: str | None = None
|
||||
shipping_street: str | None = None
|
||||
shipping_number: str | None = None
|
||||
shipping_postalcode: str | None = None
|
||||
shipping_city: str | None = None
|
||||
shipping_country: str | None = None
|
||||
tax_number: str | None = None
|
||||
note: str | None = None
|
||||
created_at: str
|
||||
updated_at: str
|
||||
tags: list[TagResponse] = []
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class ContactListResponse(BaseModel):
|
||||
"""Paginated list of contacts."""
|
||||
items: list[ContactResponse]
|
||||
total: int
|
||||
page: int
|
||||
size: int
|
||||
Reference in New Issue
Block a user