- strip all comments except WHY workaround notes (3 remain) - remove all #[allow(dead_code)]; fix via _prefix rename - extract named constants: JWT time units, token types, default config values, jellyfin fallback bitrate - DRY: move serialize_enum_as_string, content_type_str, parse_content_type, parse_genres_blob to adapter-common - sqlite+postgres library.rs use shared helpers instead of local copies - sqlite+postgres channel.rs use shared serialize_enum_as_string - remove dead `let _ = ext` in scanner.rs
71 lines
2.6 KiB
Rust
71 lines
2.6 KiB
Rust
use std::sync::Arc;
|
|
|
|
use sqlx::SqlitePool;
|
|
|
|
use domain::ports::{
|
|
activity::{ActivityLogCommand, ActivityLogQuery},
|
|
channel::{ChannelCommand, ChannelQuery},
|
|
library::{LibraryCommand, LibraryQuery},
|
|
provider_config::{ProviderConfigCommand, ProviderConfigQuery},
|
|
schedule::{ScheduleCommand, ScheduleQuery},
|
|
settings::AppSettingsRepository,
|
|
transcode::TranscodeSettingsRepository,
|
|
user::{UserCommand, UserQuery},
|
|
};
|
|
|
|
use crate::{
|
|
activity::SqliteActivityLog,
|
|
channel::SqliteChannelRepository,
|
|
library::SqliteLibraryRepository,
|
|
provider_config::SqliteProviderConfig,
|
|
schedule::SqliteScheduleRepository,
|
|
settings::SqliteAppSettings,
|
|
transcode::SqliteTranscodeSettings,
|
|
user::SqliteUserRepository,
|
|
};
|
|
|
|
pub struct SqliteWireOutput {
|
|
pub user_command: Arc<dyn UserCommand>,
|
|
pub user_query: Arc<dyn UserQuery>,
|
|
pub channel_command: Arc<dyn ChannelCommand>,
|
|
pub channel_query: Arc<dyn ChannelQuery>,
|
|
pub schedule_command: Arc<dyn ScheduleCommand>,
|
|
pub schedule_query: Arc<dyn ScheduleQuery>,
|
|
pub library_command: Arc<dyn LibraryCommand>,
|
|
pub library_query: Arc<dyn LibraryQuery>,
|
|
pub activity_command: Arc<dyn ActivityLogCommand>,
|
|
pub activity_query: Arc<dyn ActivityLogQuery>,
|
|
pub settings: Arc<dyn AppSettingsRepository>,
|
|
pub provider_config_command: Arc<dyn ProviderConfigCommand>,
|
|
pub provider_config_query: Arc<dyn ProviderConfigQuery>,
|
|
pub transcode_settings: Arc<dyn TranscodeSettingsRepository>,
|
|
}
|
|
|
|
pub fn wire(pool: SqlitePool) -> SqliteWireOutput {
|
|
let user = Arc::new(SqliteUserRepository::new(pool.clone()));
|
|
let channel = Arc::new(SqliteChannelRepository::new(pool.clone()));
|
|
let schedule = Arc::new(SqliteScheduleRepository::new(pool.clone()));
|
|
let library = Arc::new(SqliteLibraryRepository::new(pool.clone()));
|
|
let activity = Arc::new(SqliteActivityLog::new(pool.clone()));
|
|
let settings = Arc::new(SqliteAppSettings::new(pool.clone()));
|
|
let provider_config = Arc::new(SqliteProviderConfig::new(pool.clone()));
|
|
let transcode_settings = Arc::new(SqliteTranscodeSettings::new(pool));
|
|
|
|
SqliteWireOutput {
|
|
user_command: user.clone(),
|
|
user_query: user,
|
|
channel_command: channel.clone(),
|
|
channel_query: channel,
|
|
schedule_command: schedule.clone(),
|
|
schedule_query: schedule,
|
|
library_command: library.clone(),
|
|
library_query: library,
|
|
activity_command: activity.clone(),
|
|
activity_query: activity,
|
|
settings,
|
|
provider_config_command: provider_config.clone(),
|
|
provider_config_query: provider_config,
|
|
transcode_settings,
|
|
}
|
|
}
|