Implement initial scan tracking for one-time setup

- Add SystemSettings model to track setup completion status
- Create SystemSettingsService for managing setup flags
- Modify fastapi_app startup to check and set initial_scan_completed flag
- Anime folder scanning now only runs on first startup
- Update DATABASE.md with new system_settings table documentation
- Add unit test for SystemSettingsService functionality

This ensures expensive one-time operations like scanning the entire anime
directory only occur during initial setup, not on every application restart.
This commit is contained in:
2026-01-21 19:22:50 +01:00
parent 35c82e68b7
commit bf3cfa00d5
8 changed files with 383 additions and 45 deletions

View File

@@ -39,6 +39,7 @@ from src.server.database.models import (
AnimeSeries,
DownloadQueueItem,
Episode,
SystemSettings,
UserSession,
)
from src.server.database.service import (
@@ -47,6 +48,7 @@ from src.server.database.service import (
EpisodeService,
UserSessionService,
)
from src.server.database.system_settings_service import SystemSettingsService
__all__ = [
# Base and connection
@@ -69,10 +71,12 @@ __all__ = [
"AnimeSeries",
"Episode",
"DownloadQueueItem",
"SystemSettings",
"UserSession",
# Services
"AnimeSeriesService",
"EpisodeService",
"DownloadQueueService",
"SystemSettingsService",
"UserSessionService",
]