refactor(integrations): IngestWatchEventDeps, scoped Arc deps, WatchEventCleanupJob
This commit is contained in:
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user