refactor(integrations): IngestWatchEventDeps, scoped Arc deps, WatchEventCleanupJob

This commit is contained in:
2026-06-11 22:01:15 +02:00
parent 76edd52bb0
commit b29f3020e6
22 changed files with 216 additions and 216 deletions

View File

@@ -1,14 +1,11 @@
use std::sync::Arc;
use chrono::Duration;
use domain::errors::DomainError;
use domain::{errors::DomainError, ports::WatchEventRepository};
use crate::context::AppContext;
pub async fn execute(ctx: &AppContext) -> Result<u64, DomainError> {
pub async fn execute(watch_event: Arc<dyn WatchEventRepository>) -> Result<u64, DomainError> {
let cutoff = chrono::Utc::now().naive_utc() - Duration::days(30);
ctx.repos
.watch_event
.delete_non_pending_older_than(cutoff)
.await
watch_event.delete_non_pending_older_than(cutoff).await
}
#[cfg(test)]