refactor: merge sqlite adapter family into one crate

This commit is contained in:
2026-10-25 20:48:30 +01:00
parent 1ece8032ff
commit 67597ec9a6
62 changed files with 292 additions and 442 deletions

View File

@@ -1,6 +1,7 @@
use sqlx::SqlitePool;
mod diary;
mod event_queue;
mod goals;
mod image_ref;
mod import_profile;
@@ -15,6 +16,9 @@ mod profile;
mod profile_fields;
mod refresh_sessions;
mod review;
mod search;
mod shared;
mod social;
mod stats;
mod user_settings;
mod users;
@@ -23,6 +27,7 @@ mod watchlist;
mod wrapup;
pub use diary::SqliteDiaryRepository;
pub use event_queue::{DbEventQueueConfig, SqliteEventQueue};
pub use image_ref::{SqliteImageRefAdapter, create_image_ref};
pub use import_profile::SqliteImportProfileRepository;
pub use import_session::SqliteImportSessionRepository;
@@ -34,13 +39,23 @@ pub use profile::SqliteMovieProfileRepository;
pub use profile_fields::SqliteProfileFieldsRepository;
pub use refresh_sessions::SqliteRefreshSessionAdapter;
pub use review::SqliteReviewRepository;
pub use sqlite_social::SqliteApContentQuery;
pub use search::create_search_adapter;
pub use social::{
SqliteApContentQuery, SqliteRemoteGoalRepository, SqliteSocialRepository,
create_federated_profile_query,
};
pub use stats::SqliteStatsRepository;
pub use users::SqliteUserRepository;
pub use watch_event::{SqliteWatchEventRepository, SqliteWebhookTokenRepository};
pub use watchlist::SqliteWatchlistRepository;
pub use wrapup::{SqliteWrapUpRepository, SqliteWrapUpStatsQuery};
/// Row helpers shared with the `sqlite-federation` crate (which cannot live
/// here because it depends on `activitypub`/`k-ap`).
pub mod persistence {
pub use crate::shared::datetime_to_str;
}
pub fn create_profile_fields_repo(
pool: sqlx::SqlitePool,
) -> std::sync::Arc<dyn domain::ports::UserProfileFieldsRepository> {
@@ -122,9 +137,7 @@ pub async fn wire(database_url: &str) -> anyhow::Result<SqliteWireOutput> {
goal_query: std::sync::Arc::new(goals::SqliteGoalRepository::new(pool.clone())) as _,
user_settings: std::sync::Arc::clone(&user_settings_repo) as _,
federation_settings: user_settings_repo as _,
remote_goal: std::sync::Arc::new(sqlite_social::SqliteRemoteGoalRepository::new(
pool.clone(),
)) as _,
remote_goal: std::sync::Arc::new(SqliteRemoteGoalRepository::new(pool.clone())) as _,
deduplicator: std::sync::Arc::new(SqliteMovieDeduplicator::new(pool)) as _,
})
}