feat(explorer): list one folder level with recursive counts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7683967650
commit
b274f0b7ef
3 files changed
+228
No files matched your search
@@ -359,6 +359,13 @@ impl Engine {
|
||||
Ok(json!({ "total": total, "items": page }))
|
||||
}
|
||||
|
||||
/// One level of the folder tree (see [`crate::explorer::browse`]).
|
||||
pub fn browse(&self, id: &str, path: &str, q: &Query) -> Result<Value> {
|
||||
let j = self.job(id)?;
|
||||
let s = j.st.lock().unwrap();
|
||||
Ok(crate::explorer::browse(&s.found, path, q))
|
||||
}
|
||||
|
||||
/// Sidebar navigation facet counts (categories, dates, folders, cameras).
|
||||
pub fn facets(&self, id: &str) -> Result<Value> {
|
||||
let j = self.job(id)?;
|
||||
@@ -1232,6 +1239,17 @@ impl Engine {
|
||||
.and_then(|v| v.as_u64())
|
||||
.ok_or_else(|| Error::msg("id ausente"))?
|
||||
)?),
|
||||
"browse" => {
|
||||
let q: Query = p
|
||||
.get("query")
|
||||
.cloned()
|
||||
.filter(|v| !v.is_null())
|
||||
.map(serde_json::from_value)
|
||||
.transpose()?
|
||||
.unwrap_or_default();
|
||||
let path = p.get("path").and_then(|v| v.as_str()).unwrap_or("");
|
||||
self.browse(&s("job")?, path, &q)?
|
||||
}
|
||||
"results" => {
|
||||
let q: Query = p
|
||||
.get("query")
|
||||
|
||||
Reference in new issue
Block a user