general: add /api/last route

This commit is contained in:
k
2024-09-20 16:56:36 +02:00
parent 7d211f74d1
commit c8ded4ddb3
10 changed files with 95 additions and 34 deletions

View File

@@ -286,6 +286,13 @@ where
&self.path_last
}
fn last_value(&self) -> Option<serde_json::Value> {
self.imported
.last_key_value()
.and_then(|(_, serialized)| serialized.last())
.and_then(|v| serde_json::to_value(v).ok())
}
fn t_name(&self) -> &str {
std::any::type_name::<Value>()
}