mirror of
https://github.com/Dasemu/Synapse.git
synced 2026-11-26 23:36:20 +00:00
feat(ffi): type icon API and page types in list DTOs
create_type, set_type_icon, rename_type and remove_type; TagDto carries the icon and tag sources; PageBrief, TitleHit, BacklinkGroup and GraphNode carry the page type. Bindings regenerated; MemoryBackend mirrors the core. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4fb3b39c03
commit
381e9044c4
13 files changed
+1038
-153
No files matched your search
@@ -154,6 +154,23 @@ impl Graph {
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
/// The type of every typed page.
|
||||
pub fn all_page_types(&self) -> Result<HashMap<PageId, String>> {
|
||||
let mut st = self
|
||||
.conn()
|
||||
.prepare_cached("SELECT id, types FROM pages WHERE types != '[]'")?;
|
||||
let rows = st.query_map([], |r| Ok((r.get::<_, String>(0)?, r.get::<_, String>(1)?)))?;
|
||||
let mut out = HashMap::new();
|
||||
for row in rows {
|
||||
let (id, types) = row?;
|
||||
let types: Vec<String> = serde_json::from_str(&types).unwrap_or_default();
|
||||
if let Some(t) = types.into_iter().next() {
|
||||
out.insert(crate::store::parse_id(&id)?, t);
|
||||
}
|
||||
}
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
/// Every stored type definition (removed ones included), by name key.
|
||||
pub fn type_defs(&self) -> Result<HashMap<String, TypeDef>> {
|
||||
let mut st = self
|
||||
|
||||
Reference in new issue
Block a user