store the enqueued at to eases the batch deletion

This commit is contained in:
Tamo 2025-01-28 11:04:35 +01:00
parent 508db9020d
commit 58f90b70c7
No known key found for this signature in database
GPG key ID: 20CD8020AFA88D69
9 changed files with 107 additions and 69 deletions

View file

@ -24,6 +24,18 @@ pub struct Batch {
pub started_at: OffsetDateTime,
#[serde(with = "time::serde::rfc3339::option")]
pub finished_at: Option<OffsetDateTime>,
// Enqueued at is never displayed and is only required when removing a batch.
// It's always some except when upgrading from a database pre v1.12
pub enqueued_at: Option<BatchEnqueuedAt>,
}
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
pub struct BatchEnqueuedAt {
#[serde(with = "time::serde::rfc3339")]
pub earliest: OffsetDateTime,
#[serde(with = "time::serde::rfc3339")]
pub oldest: OffsetDateTime,
}
#[derive(Default, Debug, Clone, Serialize, Deserialize, ToSchema)]