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
This commit is contained in:
Viktor Barzin 2026-02-22 15:19:00 +00:00
parent 72cb1b6fe5
commit c8277e301e
No known key found for this signature in database
GPG key ID: 0EB088298288D958
11 changed files with 889 additions and 0 deletions

27
shared/schemas/auth.py Normal file
View file

@ -0,0 +1,27 @@
"""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
)