refactor/tighten-architecture #26
12
Cargo.lock
generated
12
Cargo.lock
generated
@@ -324,7 +324,6 @@ dependencies = [
|
|||||||
"futures",
|
"futures",
|
||||||
"hex",
|
"hex",
|
||||||
"rand 0.9.4",
|
"rand 0.9.4",
|
||||||
"serde_json",
|
|
||||||
"sha2",
|
"sha2",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
@@ -1910,9 +1909,7 @@ name = "export"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-stream",
|
"async-stream",
|
||||||
"async-trait",
|
|
||||||
"bytes",
|
"bytes",
|
||||||
"chrono",
|
|
||||||
"domain",
|
"domain",
|
||||||
"futures",
|
"futures",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@@ -2414,18 +2411,15 @@ dependencies = [
|
|||||||
name = "http-axum"
|
name = "http-axum"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
|
||||||
"api-types",
|
"api-types",
|
||||||
"application",
|
"application",
|
||||||
"askama",
|
"askama",
|
||||||
"async-trait",
|
|
||||||
"axum",
|
"axum",
|
||||||
"axum-governor",
|
"axum-governor",
|
||||||
"bytes",
|
"bytes",
|
||||||
"chrono",
|
"chrono",
|
||||||
"chrono-tz",
|
"chrono-tz",
|
||||||
"domain",
|
"domain",
|
||||||
"dotenvy",
|
|
||||||
"futures",
|
"futures",
|
||||||
"infer",
|
"infer",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
@@ -2435,7 +2429,6 @@ dependencies = [
|
|||||||
"tower",
|
"tower",
|
||||||
"tower-http",
|
"tower-http",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-subscriber",
|
|
||||||
"utoipa",
|
"utoipa",
|
||||||
"utoipa-scalar",
|
"utoipa-scalar",
|
||||||
"utoipa-swagger-ui",
|
"utoipa-swagger-ui",
|
||||||
@@ -3614,7 +3607,6 @@ dependencies = [
|
|||||||
"config",
|
"config",
|
||||||
"domain",
|
"domain",
|
||||||
"futures",
|
"futures",
|
||||||
"infer",
|
|
||||||
"object_store",
|
"object_store",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
@@ -5173,7 +5165,6 @@ dependencies = [
|
|||||||
"anyhow",
|
"anyhow",
|
||||||
"async-stream",
|
"async-stream",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"bytes",
|
|
||||||
"chrono",
|
"chrono",
|
||||||
"config",
|
"config",
|
||||||
"domain",
|
"domain",
|
||||||
@@ -5782,15 +5773,12 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|||||||
name = "tmdb-enrichment"
|
name = "tmdb-enrichment"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"chrono",
|
"chrono",
|
||||||
"config",
|
"config",
|
||||||
"domain",
|
"domain",
|
||||||
"reqwest 0.13.3",
|
"reqwest 0.13.3",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
|
||||||
"tracing",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use application::config::AppConfig;
|
use application::config::AppSettings;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct AppContext {
|
pub struct AppContext {
|
||||||
pub deps: Arc<application::Deps>,
|
pub deps: Arc<application::Deps>,
|
||||||
pub services: application::Services,
|
pub services: application::Services,
|
||||||
pub config: AppConfig,
|
pub config: AppSettings,
|
||||||
pub instance: domain::value_objects::InstanceIdentity,
|
pub instance: domain::value_objects::InstanceIdentity,
|
||||||
#[cfg(feature = "federation")]
|
#[cfg(feature = "federation")]
|
||||||
pub ap_document: Arc<dyn domain::ports::ApDocumentPort>,
|
pub ap_document: Arc<dyn domain::ports::ApDocumentPort>,
|
||||||
|
|||||||
@@ -2,26 +2,26 @@ use std::sync::Arc;
|
|||||||
|
|
||||||
use domain::ports::{AuthService, PasswordHasher, RefreshSessionRepository, UserRepository};
|
use domain::ports::{AuthService, PasswordHasher, RefreshSessionRepository, UserRepository};
|
||||||
|
|
||||||
use crate::config::AppConfig;
|
use crate::config::AppSettings;
|
||||||
|
|
||||||
pub struct LoginDeps {
|
pub struct LoginDeps {
|
||||||
pub user: Arc<dyn UserRepository>,
|
pub user: Arc<dyn UserRepository>,
|
||||||
pub password_hasher: Arc<dyn PasswordHasher>,
|
pub password_hasher: Arc<dyn PasswordHasher>,
|
||||||
pub auth: Arc<dyn AuthService>,
|
pub auth: Arc<dyn AuthService>,
|
||||||
pub refresh_session: Arc<dyn RefreshSessionRepository>,
|
pub refresh_session: Arc<dyn RefreshSessionRepository>,
|
||||||
pub config: AppConfig,
|
pub config: AppSettings,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct RegisterDeps {
|
pub struct RegisterDeps {
|
||||||
pub user: Arc<dyn UserRepository>,
|
pub user: Arc<dyn UserRepository>,
|
||||||
pub password_hasher: Arc<dyn PasswordHasher>,
|
pub password_hasher: Arc<dyn PasswordHasher>,
|
||||||
pub config: AppConfig,
|
pub config: AppSettings,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct RefreshDeps {
|
pub struct RefreshDeps {
|
||||||
pub refresh_session: Arc<dyn RefreshSessionRepository>,
|
pub refresh_session: Arc<dyn RefreshSessionRepository>,
|
||||||
pub auth: Arc<dyn AuthService>,
|
pub auth: Arc<dyn AuthService>,
|
||||||
pub config: AppConfig,
|
pub config: AppSettings,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct RegisterAndLoginDeps {
|
pub struct RegisterAndLoginDeps {
|
||||||
@@ -29,7 +29,7 @@ pub struct RegisterAndLoginDeps {
|
|||||||
pub password_hasher: Arc<dyn PasswordHasher>,
|
pub password_hasher: Arc<dyn PasswordHasher>,
|
||||||
pub auth: Arc<dyn AuthService>,
|
pub auth: Arc<dyn AuthService>,
|
||||||
pub refresh_session: Arc<dyn RefreshSessionRepository>,
|
pub refresh_session: Arc<dyn RefreshSessionRepository>,
|
||||||
pub config: AppConfig,
|
pub config: AppSettings,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct LogoutDeps {
|
pub struct LogoutDeps {
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct AppConfig {
|
pub struct AppSettings {
|
||||||
pub allow_registration: bool,
|
pub allow_registration: bool,
|
||||||
pub base_url: String,
|
pub base_url: String,
|
||||||
pub rate_limit: u64,
|
pub rate_limit: u64,
|
||||||
pub refresh_ttl_seconds: u64,
|
pub refresh_ttl_seconds: u64,
|
||||||
pub secure_cookies: bool,
|
pub secure_cookies: bool,
|
||||||
pub cors_origins: String,
|
pub cors_origins: String,
|
||||||
pub wrapup: WrapUpConfig,
|
pub wrapup: WrapUpSettings,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct WrapUpConfig {
|
pub struct WrapUpSettings {
|
||||||
pub font_path: Option<String>,
|
pub font_path: Option<String>,
|
||||||
pub logo_path: Option<String>,
|
pub logo_path: Option<String>,
|
||||||
pub bg_dir: Option<String>,
|
pub bg_dir: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<&::config::AppConfig> for AppConfig {
|
impl From<&::config::AppConfig> for AppSettings {
|
||||||
fn from(config: &::config::AppConfig) -> Self {
|
fn from(config: &::config::AppConfig) -> Self {
|
||||||
Self {
|
Self {
|
||||||
allow_registration: config.server.allow_registration,
|
allow_registration: config.server.allow_registration,
|
||||||
@@ -25,12 +25,12 @@ impl From<&::config::AppConfig> for AppConfig {
|
|||||||
refresh_ttl_seconds: config.auth.refresh_ttl_seconds,
|
refresh_ttl_seconds: config.auth.refresh_ttl_seconds,
|
||||||
secure_cookies: config.server.secure_cookies,
|
secure_cookies: config.server.secure_cookies,
|
||||||
cors_origins: config.server.cors_origins.clone(),
|
cors_origins: config.server.cors_origins.clone(),
|
||||||
wrapup: WrapUpConfig::from(&config.wrapup),
|
wrapup: WrapUpSettings::from(&config.wrapup),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<&::config::WrapUpConfig> for WrapUpConfig {
|
impl From<&::config::WrapUpConfig> for WrapUpSettings {
|
||||||
fn from(config: &::config::WrapUpConfig) -> Self {
|
fn from(config: &::config::WrapUpConfig) -> Self {
|
||||||
Self {
|
Self {
|
||||||
font_path: config.font_path.clone(),
|
font_path: config.font_path.clone(),
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use domain::ports::{
|
|||||||
MovieProfileRepository, MovieQuery, ReviewRepository, UserRepository,
|
MovieProfileRepository, MovieQuery, ReviewRepository, UserRepository,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::config::AppConfig;
|
use crate::config::AppSettings;
|
||||||
|
|
||||||
pub struct DeleteReviewDeps {
|
pub struct DeleteReviewDeps {
|
||||||
pub review: Arc<dyn ReviewRepository>,
|
pub review: Arc<dyn ReviewRepository>,
|
||||||
@@ -28,7 +28,7 @@ pub struct GetMovieSocialPageDeps {
|
|||||||
pub struct GetActivityFeedDeps {
|
pub struct GetActivityFeedDeps {
|
||||||
pub diary: Arc<dyn DiaryQuery>,
|
pub diary: Arc<dyn DiaryQuery>,
|
||||||
pub social_query: Arc<dyn FollowGraphQuery>,
|
pub social_query: Arc<dyn FollowGraphQuery>,
|
||||||
pub config: AppConfig,
|
pub config: AppSettings,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct GetUserFeedDeps {
|
pub struct GetUserFeedDeps {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use domain::testing::InMemoryStore;
|
|||||||
use domain::value_objects::{FollowRelation, SocialActor, SocialIdentity, UserId};
|
use domain::value_objects::{FollowRelation, SocialActor, SocialIdentity, UserId};
|
||||||
|
|
||||||
use application::{
|
use application::{
|
||||||
config::AppConfig, diary::deps::GetActivityFeedDeps, diary::get_activity_feed,
|
config::AppSettings, diary::deps::GetActivityFeedDeps, diary::get_activity_feed,
|
||||||
diary::queries::GetActivityFeedQuery,
|
diary::queries::GetActivityFeedQuery,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -125,14 +125,14 @@ async fn following_filter_separates_local_and_remote() {
|
|||||||
let deps = GetActivityFeedDeps {
|
let deps = GetActivityFeedDeps {
|
||||||
diary: domain::testing::FakeDiaryQuery::new() as _,
|
diary: domain::testing::FakeDiaryQuery::new() as _,
|
||||||
social_query: social as _,
|
social_query: social as _,
|
||||||
config: AppConfig {
|
config: AppSettings {
|
||||||
allow_registration: true,
|
allow_registration: true,
|
||||||
base_url: "http://localhost:3000".into(),
|
base_url: "http://localhost:3000".into(),
|
||||||
rate_limit: 20,
|
rate_limit: 20,
|
||||||
refresh_ttl_seconds: 2_592_000,
|
refresh_ttl_seconds: 2_592_000,
|
||||||
secure_cookies: false,
|
secure_cookies: false,
|
||||||
cors_origins: String::new(),
|
cors_origins: String::new(),
|
||||||
wrapup: application::config::WrapUpConfig {
|
wrapup: application::config::WrapUpSettings {
|
||||||
font_path: None,
|
font_path: None,
|
||||||
logo_path: None,
|
logo_path: None,
|
||||||
bg_dir: None,
|
bg_dir: None,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ use domain::{
|
|||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use domain::errors::DomainError;
|
use domain::errors::DomainError;
|
||||||
|
|
||||||
use application::{config::AppConfig, diary::commands::LogReviewCommand, ports::ReviewLogger};
|
use application::{config::AppSettings, diary::commands::LogReviewCommand, ports::ReviewLogger};
|
||||||
|
|
||||||
pub struct NoopReviewLogger;
|
pub struct NoopReviewLogger;
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ pub struct TestContextBuilder {
|
|||||||
pub block_query: Arc<dyn domain::ports::BlockQuery>,
|
pub block_query: Arc<dyn domain::ports::BlockQuery>,
|
||||||
pub federation_admin: Arc<dyn domain::ports::FederationAdminQuery>,
|
pub federation_admin: Arc<dyn domain::ports::FederationAdminQuery>,
|
||||||
pub refresh_session_repo: Arc<dyn RefreshSessionRepository>,
|
pub refresh_session_repo: Arc<dyn RefreshSessionRepository>,
|
||||||
pub config: AppConfig,
|
pub config: AppSettings,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for TestContextBuilder {
|
impl Default for TestContextBuilder {
|
||||||
@@ -123,14 +123,14 @@ impl TestContextBuilder {
|
|||||||
block_query: Arc::clone(&store) as _,
|
block_query: Arc::clone(&store) as _,
|
||||||
federation_admin: Arc::new(NoopFederationAdminQuery),
|
federation_admin: Arc::new(NoopFederationAdminQuery),
|
||||||
refresh_session_repo: Arc::clone(&store) as _,
|
refresh_session_repo: Arc::clone(&store) as _,
|
||||||
config: AppConfig {
|
config: AppSettings {
|
||||||
allow_registration: true,
|
allow_registration: true,
|
||||||
base_url: "http://localhost:3000".into(),
|
base_url: "http://localhost:3000".into(),
|
||||||
rate_limit: 20,
|
rate_limit: 20,
|
||||||
refresh_ttl_seconds: 2_592_000,
|
refresh_ttl_seconds: 2_592_000,
|
||||||
secure_cookies: false,
|
secure_cookies: false,
|
||||||
cors_origins: String::new(),
|
cors_origins: String::new(),
|
||||||
wrapup: application::config::WrapUpConfig {
|
wrapup: application::config::WrapUpSettings {
|
||||||
font_path: None,
|
font_path: None,
|
||||||
logo_path: None,
|
logo_path: None,
|
||||||
bg_dir: None,
|
bg_dir: None,
|
||||||
@@ -274,7 +274,7 @@ impl TestContextBuilder {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_config(mut self, config: AppConfig) -> Self {
|
pub fn with_config(mut self, config: AppSettings) -> Self {
|
||||||
self.config = config;
|
self.config = config;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ use crate::{DatabaseOutput, Repositories};
|
|||||||
pub fn build_deps(
|
pub fn build_deps(
|
||||||
repos: &Repositories,
|
repos: &Repositories,
|
||||||
services: &application::Services,
|
services: &application::Services,
|
||||||
config: &application::config::AppConfig,
|
config: &application::config::AppSettings,
|
||||||
instance: &InstanceIdentity,
|
instance: &InstanceIdentity,
|
||||||
) -> Deps {
|
) -> Deps {
|
||||||
Deps {
|
Deps {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use std::net::SocketAddr;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use application::config::AppConfig as AppSettings;
|
use application::config::AppSettings;
|
||||||
use domain::ports::{DiaryExporter, DocumentParser, EventPublisher};
|
use domain::ports::{DiaryExporter, DocumentParser, EventPublisher};
|
||||||
use domain::value_objects::InstanceIdentity;
|
use domain::value_objects::InstanceIdentity;
|
||||||
use export::ExportAdapter;
|
use export::ExportAdapter;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
//! `bootstrap::build_deps`, with per-port overrides injected BEFORE the deps are built.
|
//! `bootstrap::build_deps`, with per-port overrides injected BEFORE the deps are built.
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
use application::config::AppConfig;
|
use application::config::AppSettings;
|
||||||
use bootstrap::Repositories;
|
use bootstrap::Repositories;
|
||||||
use domain::{
|
use domain::{
|
||||||
errors::DomainError,
|
errors::DomainError,
|
||||||
@@ -100,14 +100,14 @@ pub fn build_test_state_from(
|
|||||||
person_enrichment: None,
|
person_enrichment: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let config = AppConfig {
|
let config = AppSettings {
|
||||||
allow_registration: false,
|
allow_registration: false,
|
||||||
base_url: "http://localhost:3000".to_string(),
|
base_url: "http://localhost:3000".to_string(),
|
||||||
rate_limit: 20,
|
rate_limit: 20,
|
||||||
refresh_ttl_seconds: 2_592_000,
|
refresh_ttl_seconds: 2_592_000,
|
||||||
secure_cookies: false,
|
secure_cookies: false,
|
||||||
cors_origins: String::new(),
|
cors_origins: String::new(),
|
||||||
wrapup: application::config::WrapUpConfig {
|
wrapup: application::config::WrapUpSettings {
|
||||||
font_path: None,
|
font_path: None,
|
||||||
logo_path: None,
|
logo_path: None,
|
||||||
bg_dir: None,
|
bg_dir: None,
|
||||||
|
|||||||
Reference in New Issue
Block a user