- Add budget editing: updateBudget() API, edit button on budget cards, BudgetFormModal adapted for create/update (category locked on edit) - Remove permanently-broken POST /auth/totp/verify stub and its unused TOTPVerifyRequest schema - Wire getHoldingTransactions() to AssetDetail page — transaction history table now shows above the candlestick chart, sorted newest-first - Fix multi-currency net worth in account_service: account balances are now converted to base_currency via ExchangeRate table before summing - Replace silent bare pass exception handlers with logger.warning() in transactions.py (OCR/AI pipeline) and price_feed_service.py (search) — ValueError in date/number regex parsing left silent (control flow) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
66 lines
1.4 KiB
Python
66 lines
1.4 KiB
Python
import uuid
|
|
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, EmailStr, field_validator
|
|
|
|
|
|
class RegisterRequest(BaseModel):
|
|
email: EmailStr
|
|
password: str
|
|
display_name: str
|
|
|
|
@field_validator("password")
|
|
@classmethod
|
|
def password_strength(cls, v: str) -> str:
|
|
if len(v) < 12:
|
|
raise ValueError("Password must be at least 12 characters")
|
|
if not any(c.isupper() for c in v):
|
|
raise ValueError("Password must contain an uppercase letter")
|
|
if not any(c.isdigit() for c in v):
|
|
raise ValueError("Password must contain a digit")
|
|
return v
|
|
|
|
|
|
class LoginRequest(BaseModel):
|
|
email: EmailStr
|
|
password: str
|
|
|
|
|
|
class TOTPChallengeResponse(BaseModel):
|
|
totp_required: bool = True
|
|
challenge_token: str
|
|
|
|
|
|
class TOTPLoginRequest(BaseModel):
|
|
challenge_token: str
|
|
totp_code: str
|
|
|
|
|
|
class TokenResponse(BaseModel):
|
|
access_token: str
|
|
token_type: str = "bearer"
|
|
expires_in: int # seconds
|
|
|
|
|
|
class TOTPSetupResponse(BaseModel):
|
|
secret: str
|
|
qr_code_png_b64: str
|
|
backup_codes: list[str]
|
|
|
|
|
|
|
|
class TOTPEnableRequest(BaseModel):
|
|
secret: str
|
|
code: str
|
|
|
|
|
|
class SessionInfo(BaseModel):
|
|
id: uuid.UUID
|
|
ip_address: str | None
|
|
user_agent: str | None
|
|
last_active_at: datetime
|
|
expires_at: datetime
|
|
created_at: datetime
|
|
is_current: bool = False
|
|
|
|
model_config = {"from_attributes": True}
|