kv-wasm: ItemSummary carries tags and modifiedAt for the web vault's filters and sort
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -796,6 +796,8 @@ fn summary(i: &Item) -> ItemSummary {
|
||||
urls: i.urls.clone(),
|
||||
favorite: i.favorite,
|
||||
has_totp: i.totp.is_some(),
|
||||
tags: i.tags.clone(),
|
||||
modified_at: i.modified_at,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,9 @@ pub struct ItemSummary {
|
||||
pub urls: Vec<String>,
|
||||
pub favorite: bool,
|
||||
pub has_totp: bool,
|
||||
/// Web only (not in kv-ffi's record): for tag filters and "recently modified" without `getItem`.
|
||||
pub tags: Vec<String>,
|
||||
pub modified_at: i64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
||||
@@ -39,6 +39,9 @@ export interface ItemSummary {
|
||||
urls: string[];
|
||||
favorite: boolean;
|
||||
hasTotp: boolean;
|
||||
tags: string[];
|
||||
/** Unix seconds. */
|
||||
modifiedAt: number;
|
||||
}
|
||||
|
||||
/** `id: ""` creates a new item. Omitted optional fields default to null / [] / false / 0. */
|
||||
|
||||
@@ -72,6 +72,7 @@ async fn account_lifecycle_persists_in_indexeddb() {
|
||||
.unwrap();
|
||||
let list: Vec<ItemSummary> = de(ok(core.list_items()).await);
|
||||
assert_eq!(list.iter().map(|i| i.title.as_str()).collect::<Vec<_>>(), ["Bank", "Note"]);
|
||||
assert!(list[0].tags.is_empty() && list[0].modified_at > 1_700_000_000);
|
||||
let mut item: ItemDto = de(ok(core.get_item(id.clone())).await);
|
||||
assert_eq!(item.password.as_deref(), Some("hunter2-secret"));
|
||||
item.password = Some("hunter3-secret".into());
|
||||
|
||||
Reference in New Issue
Block a user