Skip to content

Commit

Permalink
fix: don't ignore given tags for events
Browse files Browse the repository at this point in the history
  • Loading branch information
enmand committed Jun 21, 2024
1 parent 434d8ba commit 956cd78
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions crates/dwn-rs-stores/src/stores.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ pub trait EventLog {
tenant: &str,
cid: String,
indexes: MapValue,
tags: MapValue,
) -> Result<(), EventLogError>;

async fn get_events(
Expand Down
2 changes: 2 additions & 0 deletions crates/dwn-rs-stores/src/surrealdb/event_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ impl EventLog for SurrealDB {
tenant: &str,
cid: String,
indexes: MapValue,
tags: MapValue,
) -> Result<(), EventLogError> {
// get a mutable reference to self.gen
let watermark = self.gen.lock().await.generate()?;
Expand All @@ -37,6 +38,7 @@ impl EventLog for SurrealDB {
watermark,
cid,
indexes,
tags,
})
.await
.map_err(SurrealDBError::from)
Expand Down
1 change: 1 addition & 0 deletions crates/dwn-rs-stores/src/surrealdb/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ pub(crate) struct CreateEvent {
pub(super) watermark: Ulid,
#[serde(flatten)]
pub(super) indexes: MapValue,
pub(super) tags: MapValue,
}

#[derive(Serialize, Deserialize, Debug)]
Expand Down
4 changes: 2 additions & 2 deletions crates/dwn-rs-wasm/src/surrealdb/event_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ impl SurrealEventLog {

#[wasm_bindgen]
pub async fn append(&self, tenant: &str, cid: &str, indexes: IndexMap) -> Result<(), JsError> {
let (indexes, _) = indexes.into();
let (indexes, tags) = indexes.into();
self.store
.append(tenant, cid.to_string(), indexes)
.append(tenant, cid.to_string(), indexes, tags)
.await
.map_err(EventLogError::from)
.map_err(Into::<JsError>::into)?;
Expand Down

0 comments on commit 956cd78

Please sign in to comment.