feat: wrapup date validation, delete endpoint, failed record cleanup
Some checks failed
CI / Check / Test (push) Failing after 41s

This commit is contained in:
2026-06-03 00:54:08 +02:00
parent 3f483f8f81
commit 241063c914
13 changed files with 194 additions and 7 deletions

View File

@@ -161,3 +161,34 @@ impl PeriodicJob for WrapUpAutoGenerateJob {
Ok(())
}
}
pub struct WrapUpCleanupJob {
ctx: AppContext,
}
impl WrapUpCleanupJob {
pub fn new(ctx: AppContext) -> Self {
Self { ctx }
}
}
#[async_trait]
impl PeriodicJob for WrapUpCleanupJob {
fn interval(&self) -> Duration {
Duration::from_secs(86400)
}
async fn run(&self) -> Result<(), DomainError> {
let cutoff = chrono::Utc::now().naive_utc() - chrono::Duration::days(7);
let n = self
.ctx
.repos
.wrapup_repo
.delete_failed_older_than(cutoff)
.await?;
if n > 0 {
tracing::info!("wrapup cleanup: removed {n} failed records");
}
Ok(())
}
}