Add bookmark thumbnail metadata

This commit is contained in:
2026-05-08 11:47:38 -04:00
parent 2410e71006
commit b4355d0f82
5 changed files with 78 additions and 0 deletions
+19
View File
@@ -12,6 +12,7 @@ pub struct BookmarkEntry {
url: UrlText,
tags: Vec<String>,
note: Option<String>,
thumbnail_key: Option<String>,
added_at: SystemTime,
}
@@ -36,6 +37,7 @@ impl BookmarkEntry {
url,
tags: Vec::new(),
note: None,
thumbnail_key: None,
added_at,
})
}
@@ -85,6 +87,11 @@ impl BookmarkEntry {
self.note.as_deref()
}
#[must_use]
pub fn thumbnail_key(&self) -> Option<&str> {
self.thumbnail_key.as_deref()
}
#[must_use]
pub fn added_at(&self) -> SystemTime {
self.added_at
@@ -111,6 +118,18 @@ impl BookmarkEntry {
pub fn clear_note(&mut self) {
self.note = None;
}
pub fn set_thumbnail_key(
&mut self,
thumbnail_key: impl Into<String>,
) -> Result<(), DomainError> {
self.thumbnail_key = Some(non_empty_text("bookmark thumbnail key", thumbnail_key.into())?);
Ok(())
}
pub fn clear_thumbnail_key(&mut self) {
self.thumbnail_key = None;
}
}
fn non_empty_text(field: &'static str, value: String) -> Result<String, DomainError> {