backend-lehrer (10 files): - game/database.py (785 → 5), correction_api.py (683 → 4) - classroom_engine/antizipation.py (676 → 5) - llm_gateway schools/edu_search already done in prior batch klausur-service (12 files): - orientation_crop_api.py (694 → 5), pdf_export.py (677 → 4) - zeugnis_crawler.py (676 → 5), grid_editor_api.py (671 → 5) - eh_templates.py (658 → 5), mail/api.py (651 → 5) - qdrant_service.py (638 → 5), training_api.py (625 → 4) website (6 pages): - middleware (696 → 8), mail (733 → 6), consent (628 → 8) - compliance/risks (622 → 5), export (502 → 5), brandbook (629 → 7) studio-v2 (3 components): - B2BMigrationWizard (848 → 3), CleanupPanel (765 → 2) - dashboard-experimental (739 → 2) admin-lehrer (4 files): - uebersetzungen (769 → 4), manager (670 → 2) - ChunkBrowserQA (675 → 6), dsfa/page (674 → 5) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
68 lines
2.0 KiB
Python
68 lines
2.0 KiB
Python
"""
|
|
Unified Inbox Mail API — barrel re-export.
|
|
|
|
The actual endpoints live in:
|
|
- api_accounts.py (account CRUD, test, sync)
|
|
- api_inbox.py (unified inbox, email detail, send)
|
|
- api_ai.py (AI analysis, response suggestions)
|
|
- api_tasks.py (task CRUD, dashboard, from-email)
|
|
"""
|
|
|
|
import logging
|
|
|
|
from fastapi import APIRouter, HTTPException, Query
|
|
|
|
from .models import MailHealthCheck, MailStats
|
|
from .mail_db import init_mail_tables, get_mail_stats
|
|
|
|
from .api_accounts import router as _accounts_router
|
|
from .api_inbox import router as _inbox_router
|
|
from .api_ai import router as _ai_router
|
|
from .api_tasks import router as _tasks_router
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
router = APIRouter()
|
|
|
|
# Merge sub-routers
|
|
router.include_router(_accounts_router)
|
|
router.include_router(_inbox_router)
|
|
router.include_router(_ai_router)
|
|
router.include_router(_tasks_router)
|
|
|
|
|
|
# =============================================================================
|
|
# Health & Init (kept here as they are small)
|
|
# =============================================================================
|
|
|
|
@router.get("/api/v1/mail/health", response_model=MailHealthCheck)
|
|
async def health_check():
|
|
"""Health check for the mail system."""
|
|
return MailHealthCheck(
|
|
status="healthy",
|
|
database_connected=True,
|
|
vault_connected=True,
|
|
)
|
|
|
|
|
|
@router.post("/api/v1/mail/init")
|
|
async def initialize_mail_system():
|
|
"""Initialize mail database tables."""
|
|
success = await init_mail_tables()
|
|
if not success:
|
|
raise HTTPException(status_code=500, detail="Failed to initialize mail tables")
|
|
return {"status": "initialized"}
|
|
|
|
|
|
# =============================================================================
|
|
# Statistics
|
|
# =============================================================================
|
|
|
|
@router.get("/api/v1/mail/stats", response_model=MailStats)
|
|
async def get_statistics(
|
|
user_id: str = Query(..., description="User ID"),
|
|
):
|
|
"""Get overall mail statistics for a user."""
|
|
stats = await get_mail_stats(user_id)
|
|
return MailStats(**stats)
|