2bc5d6ea9a
- reuses send_smtp_test_email; tri-state result success(200)/config-error(400)/failed(502) - session + CSRF protected; never echoes SMTP secrets - SmtpTestResponse schema; regenerate openapi/ - extend tests/test_api_config.py (3 states + 401 + missing-CSRF 403)
41 lines
773 B
Python
41 lines
773 B
Python
from __future__ import annotations
|
|
|
|
from typing import Literal
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class ConfigField(BaseModel):
|
|
env_name: str
|
|
label: str
|
|
value: str
|
|
secret: bool
|
|
input_type: str
|
|
configured: bool
|
|
|
|
|
|
class ConfigSection(BaseModel):
|
|
name: str
|
|
fields: list[ConfigField]
|
|
|
|
|
|
class ConfigResponse(BaseModel):
|
|
sections: list[ConfigSection]
|
|
|
|
|
|
class ConfigUpdateRequest(BaseModel):
|
|
"""Flat mapping of env_name → value, mirroring the existing form semantics."""
|
|
|
|
updates: dict[str, str]
|
|
|
|
|
|
class ConfigUpdateResponse(BaseModel):
|
|
sections: list[ConfigSection]
|
|
|
|
|
|
class SmtpTestResponse(BaseModel):
|
|
"""Response from POST /api/config/smtp/test."""
|
|
|
|
result: Literal["success", "config-error", "failed"]
|
|
message: str
|