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,52 @@
|
||||
"""Pydantic schemas for authentication endpoints."""
|
||||
|
||||
from pydantic import BaseModel, EmailStr, Field
|
||||
|
||||
|
||||
class RegisterRequest(BaseModel):
|
||||
"""Request body for self-service registration."""
|
||||
account_name: str = Field(..., min_length=2, max_length=255, description="Company/account name")
|
||||
full_name: str = Field(..., min_length=2, max_length=255, description="Admin user's full name")
|
||||
email: EmailStr = Field(..., description="Admin user's email address")
|
||||
password: str = Field(..., min_length=8, max_length=128, description="Password (min 8 characters)")
|
||||
|
||||
|
||||
class LoginRequest(BaseModel):
|
||||
"""Request body for login."""
|
||||
email: EmailStr
|
||||
password: str
|
||||
|
||||
|
||||
class RefreshRequest(BaseModel):
|
||||
"""Request body for token refresh."""
|
||||
refresh_token: str
|
||||
|
||||
|
||||
class UserInfo(BaseModel):
|
||||
"""Basic user info returned with tokens (no password hash)."""
|
||||
id: str
|
||||
email: str
|
||||
full_name: str
|
||||
account_id: str
|
||||
role_id: str | None = None
|
||||
role_name: str | None = None
|
||||
permissions: list[str] = []
|
||||
|
||||
|
||||
class TokenResponse(BaseModel):
|
||||
"""Response with access and refresh tokens, plus user info."""
|
||||
access_token: str
|
||||
refresh_token: str
|
||||
token_type: str = "bearer"
|
||||
user: UserInfo
|
||||
|
||||
|
||||
class UserResponse(BaseModel):
|
||||
"""Public user representation (no password hash)."""
|
||||
id: str
|
||||
email: str
|
||||
full_name: str
|
||||
is_active: bool
|
||||
role_id: str | None = None
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
Reference in New Issue
Block a user