feat: add backend/models.py

This commit is contained in:
zio 2026-06-01 22:12:54 +09:00
parent bdadbc5b12
commit 40a7e64208

69
backend/models.py Normal file
View File

@ -0,0 +1,69 @@
from pydantic import BaseModel
from typing import Optional, List
class LoginRequest(BaseModel):
username: str
password: str
class TokenResponse(BaseModel):
access_token: str
token_type: str = "bearer"
username: str
display_name: str
class Attachment(BaseModel):
part_id: str
filename: str
content_type: str
size: int
class MailSummary(BaseModel):
uid: str
subject: str
sender: str
sender_addr: str
date: str
is_read: bool
has_attachment: bool
size: int
preview: str = ""
class MailDetail(BaseModel):
uid: str
subject: str
sender: str
sender_addr: str
to: str
cc: str = ""
date: str
body_text: str = ""
body_html: str = ""
attachments: List[Attachment] = []
is_read: bool = True
class FolderInfo(BaseModel):
name: str
display: str
unread: int = 0
total: int = 0
class MailListResponse(BaseModel):
messages: List[MailSummary]
total: int
page: int
per_page: int
class SendRequest(BaseModel):
to: str
cc: Optional[str] = None
bcc: Optional[str] = None
subject: str
body: str
is_html: bool = False
reply_to_uid: Optional[str] = None
class MoveRequest(BaseModel):
target_folder: str
class ErrorResponse(BaseModel):
detail: str