Phase 18 (Verwaltung): fetch_strategy in CRUD + Edit-Modal

- migrations/2026-05-09e_fetch_strategy.py NEU: ALTER TABLE sources ADD COLUMN
  fetch_strategy. Pre-flagging fuer FT/WSJ/NZZ etc. (paywall) und Rheinische
  Post/Verfassungsschutz (googlebot).
- shared/services/source_health.py: gesynct vom Monitor (Phase-18-Code mit
  Retry-Logik + Strategien default/googlebot/paywall/skip).
- routers/sources.py: GlobalSourceCreate/Update um fetch_strategy
  (Pattern-Validation), SOURCE_UPDATE_COLUMNS + INSERT erweitert.
- dashboard.html: Edit-Modal hat jetzt Dropdown sourceFetchStrategy.
- sources.js: laedt + sendet fetch_strategy mit.

Cache-Buster 20260509c -> 20260509d.
Dieser Commit ist enthalten in:
claude-dev
2026-05-09 04:57:01 +00:00
Ursprung bff934d673
Commit 7f729443cb
6 geänderte Dateien mit 153 neuen und 14 gelöschten Zeilen

Datei anzeigen

@@ -24,7 +24,7 @@ logger = logging.getLogger("verwaltung.sources")
router = APIRouter(prefix="/api/sources", tags=["sources"])
SOURCE_UPDATE_COLUMNS = {"name", "url", "domain", "source_type", "category", "status", "notes", "language", "bias"}
SOURCE_UPDATE_COLUMNS = {"name", "url", "domain", "source_type", "category", "status", "notes", "language", "bias", "fetch_strategy"}
@router.get("/meta")
@@ -48,6 +48,7 @@ class GlobalSourceCreate(BaseModel):
notes: Optional[str] = None
language: Optional[str] = Field(default=None, max_length=100)
bias: Optional[str] = Field(default=None, max_length=500)
fetch_strategy: Optional[str] = Field(default="default", pattern="^(default|googlebot|paywall|skip)$")
class GlobalSourceUpdate(BaseModel):
@@ -143,10 +144,10 @@ async def create_global_source(
)
cursor = await db.execute(
"""INSERT INTO sources (name, url, domain, source_type, category, status, notes, language, bias, added_by, tenant_id)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, 'system', NULL)""",
"""INSERT INTO sources (name, url, domain, source_type, category, status, notes, language, bias, fetch_strategy, added_by, tenant_id)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'system', NULL)""",
(data.name, data.url, data.domain, data.source_type, data.category, data.status, data.notes,
data.language, data.bias),
data.language, data.bias, data.fetch_strategy or "default"),
)
src_id = cursor.lastrowid
await db.commit()