Ziel: Reduziere api/main.py von 3.800 auf <500 Zeilen Status: V1 Routes etabliert, Migration läuft
| Bereich | Endpoints | Status |
|---|---|---|
| Auth | 7 (/auth/*) | |
| Scans | 6 (/scans/*) | |
| Findings | 2 (/findings/*) | |
| Tools | 2 (/tools/*) | |
| Reports | 3 (/reports/*) | |
| WebSocket | 5 (/ws/*) | |
| Health | 2 (/health, /info) | |
| Sonstige | 21 |
api/routes/v1/
├── auth.py (6 endpoints) ✅
├── scans.py (7 endpoints) ✅
├── findings.py (4 endpoints) ✅
├── tools.py (2 endpoints) ✅
├── reports.py (3 endpoints) ✅
├── schedules.py (6 endpoints) ✅
├── settings.py (6 endpoints) ✅
├── stats.py (4 endpoints) ✅
├── notifications.py (3 endpoints) ✅
├── health.py (2 endpoints) ✅
├── metrics.py (1 endpoints) ✅
└── websocket.py (4 endpoints) ✅
Endpoints: 7 Aufwand: 2h
# Zu migrieren:
POST /auth/login → api/routes/v1/auth.py (existiert)
GET /auth/me → api/routes/v1/auth.py (existiert)
POST /auth/refresh → api/routes/v1/auth.py (existiert)
GET /csrf-token → api/routes/v1/auth.py (existiert)
POST /auth/logout → api/routes/v1/auth.py (existiert)
POST /auth/logout-all → api/routes/v1/auth.py (existiert)Aktion:
- Prüfe ob V1 Endpoints funktional identisch sind
- Füge Deprecation-Warnungen zu Legacy Endpoints hinzu
- Aktualisiere Tests
Endpoints: 6 Aufwand: 3h
# Zu migrieren:
POST /scans → api/routes/v1/scans.py (existiert)
GET /scans → api/routes/v1/scans.py (existiert)
GET /scans/{id} → api/routes/v1/scans.py (existiert)
PATCH /scans/{id} → api/routes/v1/scans.py (existiert)
DELETE /scans/{id} → api/routes/v1/scans.py (existiert)
GET /scans/{id}/findings → api/routes/v1/scans.py (existiert)Endpoints: 2 Aufwand: 1h
# Zu migrieren:
POST /scans/{id}/findings → api/routes/v1/findings.py (existiert)
PATCH /findings/{id} → api/routes/v1/findings.py (existiert)Endpoints: 2 Aufwand: 1h
# Zu migrieren:
POST /tools/execute → api/routes/v1/tools.py (existiert)
GET /tools → api/routes/v1/tools.py (existiert)Endpoints: 3 Aufwand: 1h
# Zu migrieren:
POST /reports → api/routes/v1/reports.py (existiert)
GET /reports → api/routes/v1/reports.py (existiert)
GET /reports/{id}/download → api/routes/v1/reports.py (existiert)Endpoints: 5 Aufwand: 2h
# Zu migrieren:
/ws/scans/{id}
/ws/notifications
/ws/{client_id}
/agents/ws# Auth
# - Prüfe: Login, Logout, Refresh, Me, CSRF
# - Füge fehlende hinzu: logout-all
# Scans
# - Prüfe: CRUD + Findings
# Tools
# - Prüfe: List + Execute
# Reports
# - Prüfe: CRUD + Download# In api/main.py für jeden Legacy Endpoint:
@app.post("/auth/login", deprecated=True)
async def login(...):
"""
⚠️ DEPRECATED: Use POST /api/v1/auth/login instead
Dieser Endpoint wird in v2.0 entfernt.
Migration Guide: docs/MIGRATION_v1.md
"""
# Redirect to v1 implementation
from api.routes.v1.auth import login as v1_login
return await v1_login(...)# Tests für Legacy Endpoints
mv tests/test_legacy_auth.py tests/api/v1/test_auth.py
# Neue Tests für V1 Endpoints
pytest tests/api/v1/ -v- Auth Endpoints: Vergleiche Legacy vs V1
- Auth Endpoints: Füge logout-all zu V1 hinzu
- Auth Endpoints: Markiere Legacy als deprecated
- Scans Endpoints: Vergleiche Implementierungen
- Scans Endpoints: Markiere Legacy als deprecated
- Tools Endpoints migrieren
- Findings Endpoints migrieren
- Reports Endpoints migrieren
- Health Endpoints migrieren
- Tests für alle V1 Endpoints
- WebSocket Endpoints migrieren
- Legacy Endpoints entfernen
- api/main.py bereinigen (<500 Zeilen)
- Dokumentation aktualisieren
- api/main.py < 500 Zeilen ✅
- Alle Endpoints unter /api/v1/ ✅
- Legacy Endpoints mit Deprecation-Warnungen ✅
- 100% Test-Abdeckung für V1 ✅
- Keine Breaking Changes ✅
Auth: [████░░░░░░] 40%
Scans: [████░░░░░░] 40%
Findings: [░░░░░░░░░░] 0%
Tools: [░░░░░░░░░░] 0%
Reports: [░░░░░░░░░░] 0%
WebSocket:[░░░░░░░░░░] 0%
--------------------------------
Gesamt: [██░░░░░░░░] 15%
Nächster Schritt: Auth Endpoints vergleichen und Deprecation hinzufügen