Three-pane webmail client. - Backend: FastAPI + async SQLAlchemy + arq worker (Postgres/Redis), IMAP/SMTP sync, threading, search, drafts/outbox with undo, attachments, 2FA. - Frontend: React 18 + Vite + TypeScript + TanStack Query + Tailwind; three-pane UI with rich-text composer, light/dark themes, resizable panels. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
75 lines
1.5 KiB
Python
75 lines
1.5 KiB
Python
"""Request/response models for the accounts API (SPEC §9.1)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import uuid
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class ServerConfigIn(BaseModel):
|
|
host: str
|
|
port: int = Field(ge=1, le=65535)
|
|
tls: str = "ssl" # ssl | starttls
|
|
auth: str = "password" # password | oauth2
|
|
|
|
|
|
class DiscoverRequest(BaseModel):
|
|
email: str
|
|
|
|
|
|
class CandidateOut(BaseModel):
|
|
imap: ServerConfigIn
|
|
smtp: ServerConfigIn
|
|
source: str
|
|
oauth_provider: str | None = None
|
|
|
|
|
|
class DiscoveryStepOut(BaseModel):
|
|
method: str
|
|
status: str
|
|
detail: str = ""
|
|
|
|
|
|
class DiscoverResponse(BaseModel):
|
|
candidates: list[CandidateOut]
|
|
steps: list[DiscoveryStepOut]
|
|
|
|
|
|
class TestRequest(BaseModel):
|
|
imap: ServerConfigIn
|
|
smtp: ServerConfigIn
|
|
email: str
|
|
username: str | None = None # defaults to the email address
|
|
password: str = Field(min_length=1)
|
|
|
|
|
|
class TestResponse(BaseModel):
|
|
ok: bool = True
|
|
|
|
|
|
class CreateAccountRequest(BaseModel):
|
|
email: str
|
|
display_name: str = ""
|
|
color: str = "#888888"
|
|
imap: ServerConfigIn
|
|
smtp: ServerConfigIn
|
|
username: str | None = None
|
|
password: str = Field(min_length=1)
|
|
|
|
|
|
class UpdateAccountRequest(BaseModel):
|
|
display_name: str | None = None
|
|
color: str | None = None
|
|
|
|
|
|
class AccountDetailOut(BaseModel):
|
|
id: uuid.UUID
|
|
email: str
|
|
display_name: str
|
|
color: str
|
|
state: str
|
|
state_detail: str
|
|
imap_config: dict[str, object]
|
|
smtp_config: dict[str, object]
|