Backend - Sent copies: persist locally on send + periodic multi-folder CONDSTORE poll (Sent/Archive/Trash/Junk) so they thread and show without an IDLE-only INBOX. - Bcc: transmitted copy omits Bcc, Sent copy keeps it; store/display bcc_addr. - Drafts: mirror local drafts to the IMAP Drafts folder (append/replace/expunge); inbound sync of foreign drafts (un-threaded) with adopt-to-edit + dedup by UID. - Per-user storage quota (5 GiB default) and manual "sync all folders" action. - Account editing (display/color/server/password) and per-account HTML signature. - Account view scoped to that account's inbox; new migrations 0006–0009. Frontend - Mail-list pagination, folder filters (All/Unread/Pinned), sort toggle, refresh. - Aligned + widened mail-list margins; reading-pane bars fixed height. - Rich-text composer: color palette, highlight, image; attachments; expand/pop-out. - Signatures: auto-insert for new mail, replace on From change, reply insert. - Restore/Delete actions per folder; drafts view merges local + remote, date-sorted. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
94 lines
1.7 KiB
Python
94 lines
1.7 KiB
Python
"""Shared API response models (SPEC §9.1)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import datetime as dt
|
|
import uuid
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class Address(BaseModel):
|
|
name: str = ""
|
|
email: str = ""
|
|
|
|
|
|
class ThreadSummary(BaseModel):
|
|
id: uuid.UUID
|
|
subject: str
|
|
snippet: str
|
|
participants: list[Address]
|
|
account_ids: list[uuid.UUID]
|
|
message_count: int
|
|
unread_count: int
|
|
has_attachments: bool
|
|
pinned: bool
|
|
last_message_at: dt.datetime
|
|
|
|
|
|
class ThreadListOut(BaseModel):
|
|
threads: list[ThreadSummary]
|
|
cursor: str | None = None
|
|
|
|
|
|
class AttachmentOut(BaseModel):
|
|
id: uuid.UUID
|
|
filename: str
|
|
mime_type: str
|
|
size_bytes: int
|
|
|
|
|
|
class MessageEnvelope(BaseModel):
|
|
id: uuid.UUID
|
|
account_id: uuid.UUID
|
|
mailbox_id: uuid.UUID
|
|
thread_id: uuid.UUID | None
|
|
subject: str
|
|
from_addr: list[Address]
|
|
to_addr: list[Address]
|
|
cc_addr: list[Address]
|
|
bcc_addr: list[Address]
|
|
date: dt.datetime
|
|
flags: list[str]
|
|
is_unread: bool
|
|
is_starred: bool
|
|
has_attachments: bool
|
|
has_remote_images: bool
|
|
snippet: str
|
|
|
|
|
|
class ThreadDetail(BaseModel):
|
|
id: uuid.UUID
|
|
subject: str
|
|
order: str # "asc" | "desc"
|
|
pinned: bool
|
|
messages: list[MessageEnvelope] # always ASC (SPEC §9.4)
|
|
|
|
|
|
class FlagChangeRequest(BaseModel):
|
|
add: list[str] = []
|
|
remove: list[str] = []
|
|
|
|
|
|
class MoveRequest(BaseModel):
|
|
mailbox_id: uuid.UUID
|
|
|
|
|
|
class AccountOut(BaseModel):
|
|
id: uuid.UUID
|
|
email: str
|
|
display_name: str
|
|
color: str
|
|
state: str
|
|
signature: str = ""
|
|
|
|
|
|
class SearchThreadHit(BaseModel):
|
|
thread: ThreadSummary
|
|
highlights: dict[str, str]
|
|
|
|
|
|
class SearchOut(BaseModel):
|
|
threads: list[SearchThreadHit]
|
|
cursor: str | None = None
|