importer feature
This commit is contained in:
@@ -12,6 +12,8 @@ use domain::{
|
||||
};
|
||||
use sqlx::PgPool;
|
||||
|
||||
mod import_profile;
|
||||
mod import_session;
|
||||
mod models;
|
||||
mod users;
|
||||
|
||||
@@ -20,6 +22,8 @@ use models::{
|
||||
datetime_to_str,
|
||||
};
|
||||
|
||||
pub use import_profile::PostgresImportProfileRepository;
|
||||
pub use import_session::PostgresImportSessionRepository;
|
||||
pub use users::PostgresUserRepository;
|
||||
|
||||
fn format_year_month(ym: &str) -> String {
|
||||
@@ -775,6 +779,8 @@ pub async fn wire(database_url: &str) -> anyhow::Result<(
|
||||
std::sync::Arc<dyn domain::ports::DiaryRepository>,
|
||||
std::sync::Arc<dyn domain::ports::StatsRepository>,
|
||||
std::sync::Arc<dyn domain::ports::UserRepository>,
|
||||
std::sync::Arc<dyn domain::ports::ImportSessionRepository>,
|
||||
std::sync::Arc<dyn domain::ports::ImportProfileRepository>,
|
||||
)> {
|
||||
use anyhow::Context;
|
||||
|
||||
@@ -788,6 +794,9 @@ pub async fn wire(database_url: &str) -> anyhow::Result<(
|
||||
.map_err(|e| anyhow::anyhow!("{e}"))
|
||||
.context("Database migration failed")?;
|
||||
|
||||
let import_session_repo = std::sync::Arc::new(PostgresImportSessionRepository::new(pool.clone()));
|
||||
let import_profile_repo = std::sync::Arc::new(PostgresImportProfileRepository::new(pool.clone()));
|
||||
|
||||
Ok((
|
||||
pool.clone(),
|
||||
std::sync::Arc::clone(&repo) as _,
|
||||
@@ -795,5 +804,7 @@ pub async fn wire(database_url: &str) -> anyhow::Result<(
|
||||
std::sync::Arc::clone(&repo) as _,
|
||||
std::sync::Arc::clone(&repo) as _,
|
||||
std::sync::Arc::new(PostgresUserRepository::new(pool)) as _,
|
||||
import_session_repo as _,
|
||||
import_profile_repo as _,
|
||||
))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user