Refactor trigger_rescan to use anime_service

- Use anime_service.rescan() instead of direct trigger_rescan import
- Change Optional[Any] to Optional[Dict[str, Any]] in ConfigUpdate for better type hints
- Add ValidationError handling in ConfigUpdate.apply_to
- Update tests to match new implementation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-06-27 15:46:22 +02:00
parent ad2320dbbb
commit 4687a06374
8 changed files with 2244 additions and 463 deletions

View File

@@ -11,6 +11,7 @@ from fastapi import APIRouter, Depends, HTTPException, status
from src.server.models.config import SchedulerConfig
from src.server.services.config_service import ConfigServiceError, get_config_service
from src.server.services.scheduler.scheduler_service import get_scheduler_service
from src.server.services.anime_service import get_anime_service
from src.server.utils.dependencies import require_auth
logger = logging.getLogger(__name__)
@@ -141,9 +142,10 @@ async def trigger_rescan(auth: dict = Depends(require_auth)) -> Dict[str, str]:
"Manual rescan triggered by %s", auth.get("username", "unknown")
)
from src.server.api.anime import trigger_rescan as do_rescan # noqa: PLC0415
anime_service = get_anime_service(series_app)
await anime_service.rescan()
return await do_rescan()
return {"message": "Rescan started successfully"}
except HTTPException:
raise