refactor: group use cases into DDD bounded contexts

Flat use_cases/ (44 files) + monolithic commands.rs/queries.rs
split into diary/, movies/, watchlist/, import/, auth/, users/,
integrations/, search/, person/, federation/ — each with own
commands.rs, queries.rs, and use case modules.

Inline tests extracted to sibling tests/ dirs.
This commit is contained in:
2026-06-02 19:49:09 +02:00
parent aadad3cfb0
commit dcc9244d4e
92 changed files with 1617 additions and 1500 deletions

View File

@@ -22,7 +22,7 @@ impl PeriodicJob for ImportSessionCleanupJob {
}
async fn run(&self) -> Result<(), DomainError> {
let n = crate::use_cases::cleanup_expired_import_sessions::execute(&self.ctx).await?;
let n = crate::import::cleanup::execute(&self.ctx).await?;
tracing::info!("import session cleanup: removed {} expired sessions", n);
Ok(())
}
@@ -45,7 +45,7 @@ impl PeriodicJob for WatchEventCleanupJob {
}
async fn run(&self) -> Result<(), DomainError> {
let n = crate::use_cases::cleanup_watch_events::execute(&self.ctx).await?;
let n = crate::integrations::cleanup::execute(&self.ctx).await?;
if n > 0 {
tracing::info!("watch event cleanup: removed {n} old entries");
}
@@ -70,7 +70,7 @@ impl PeriodicJob for EnrichmentStalenessJob {
}
async fn run(&self) -> Result<(), DomainError> {
let stale = self.ctx.movie_profile_repository.list_stale().await?;
let stale = self.ctx.repos.movie_profile.list_stale().await?;
if stale.is_empty() {
return Ok(());
}
@@ -80,7 +80,7 @@ impl PeriodicJob for EnrichmentStalenessJob {
movie_id,
external_metadata_id,
};
self.ctx.event_publisher.publish(&event).await?;
self.ctx.services.event_publisher.publish(&event).await?;
}
Ok(())
}