feat(api): wire library_repo, app_settings_repo, library_sync_adapter into AppState; start scheduler
This commit is contained in:
@@ -17,7 +17,7 @@ use tokio::sync::broadcast;
|
||||
use crate::config::Config;
|
||||
use crate::events::EventBus;
|
||||
use crate::log_layer::LogLine;
|
||||
use domain::{ActivityLogRepository, ChannelService, ProviderConfigRepository, ScheduleEngineService, UserService};
|
||||
use domain::{ActivityLogRepository, ChannelService, IAppSettingsRepository, ILibraryRepository, LibrarySyncAdapter, ProviderConfigRepository, ScheduleEngineService, UserService};
|
||||
#[cfg(feature = "local-files")]
|
||||
use domain::TranscodeSettingsRepository;
|
||||
use k_core::db::DatabasePool;
|
||||
@@ -53,6 +53,9 @@ pub struct AppState {
|
||||
pub transcode_settings_repo: Option<Arc<dyn TranscodeSettingsRepository>>,
|
||||
/// Database pool — used by infra factory functions for hot-reload.
|
||||
pub db_pool: Arc<DatabasePool>,
|
||||
pub library_repo: Arc<dyn ILibraryRepository>,
|
||||
pub library_sync_adapter: Arc<dyn LibrarySyncAdapter>,
|
||||
pub app_settings_repo: Arc<dyn IAppSettingsRepository>,
|
||||
}
|
||||
|
||||
impl AppState {
|
||||
@@ -69,6 +72,9 @@ impl AppState {
|
||||
log_history: Arc<Mutex<VecDeque<LogLine>>>,
|
||||
activity_log_repo: Arc<dyn ActivityLogRepository>,
|
||||
db_pool: Arc<DatabasePool>,
|
||||
library_repo: Arc<dyn ILibraryRepository>,
|
||||
library_sync_adapter: Arc<dyn LibrarySyncAdapter>,
|
||||
app_settings_repo: Arc<dyn IAppSettingsRepository>,
|
||||
#[cfg(feature = "local-files")]
|
||||
transcode_settings_repo: Option<Arc<dyn TranscodeSettingsRepository>>,
|
||||
) -> anyhow::Result<Self> {
|
||||
@@ -155,6 +161,9 @@ impl AppState {
|
||||
#[cfg(feature = "local-files")]
|
||||
transcode_settings_repo,
|
||||
db_pool,
|
||||
library_repo,
|
||||
library_sync_adapter,
|
||||
app_settings_repo,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user