trading/shared/schemas/auth.py
Viktor Barzin c8277e301e
feat: pydantic schemas for all service message types
- shared/schemas/trading.py: OrderRequest, OrderResult, PositionInfo,
  AccountInfo, TradeSignal, TradeExecution, MarketSnapshot, SentimentContext
- shared/schemas/news.py: RawArticle, ScoredArticle
- shared/schemas/learning.py: TradeOutcomeSchema, WeightAdjustment
- shared/schemas/auth.py: RegisterRequest, LoginRequest, TokenResponse
- 49 schema tests covering validation constraints, serialization round-trips,
  required fields, and range checks
2026-02-22 15:19:00 +00:00

27 lines
725 B
Python

"""Authentication Pydantic schemas for API request/response payloads."""
from pydantic import BaseModel, Field
class RegisterRequest(BaseModel):
"""Sent by the dashboard to begin passkey registration."""
username: str = Field(min_length=1, max_length=100)
display_name: str | None = None
class LoginRequest(BaseModel):
"""Sent by the dashboard to begin passkey authentication."""
username: str = Field(min_length=1, max_length=100)
class TokenResponse(BaseModel):
"""Returned after successful authentication."""
access_token: str
refresh_token: str
token_type: str = "bearer"
expires_in: int = Field(
description="Access token lifetime in seconds", default=900
)