mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-30 09:04:59 +08:00
Add reader.v5.tasks.Task.created_at.
There was no way to "quickly" get the creation date.
This commit is contained in:
parent
cf50f85986
commit
1be4619b91
@ -147,6 +147,38 @@ impl Task {
|
|||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn created_at(&self) -> Option<OffsetDateTime> {
|
||||||
|
match &self.content {
|
||||||
|
TaskContent::IndexCreation { index_uid: _, primary_key: _ } => {
|
||||||
|
match self.events.first() {
|
||||||
|
Some(TaskEvent::Created(ts)) => Some(*ts),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TaskContent::DocumentAddition {
|
||||||
|
index_uid: _,
|
||||||
|
content_uuid: _,
|
||||||
|
merge_strategy: _,
|
||||||
|
primary_key: _,
|
||||||
|
documents_count: _,
|
||||||
|
allow_index_creation: _,
|
||||||
|
} => match self.events.first() {
|
||||||
|
Some(TaskEvent::Created(ts)) => Some(*ts),
|
||||||
|
_ => None,
|
||||||
|
},
|
||||||
|
TaskContent::SettingsUpdate {
|
||||||
|
index_uid: _,
|
||||||
|
settings: _,
|
||||||
|
is_deletion: _,
|
||||||
|
allow_index_creation: _,
|
||||||
|
} => match self.events.first() {
|
||||||
|
Some(TaskEvent::Created(ts)) => Some(*ts),
|
||||||
|
_ => None,
|
||||||
|
},
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IndexUid {
|
impl IndexUid {
|
||||||
|
Loading…
Reference in New Issue
Block a user