applying json-diff fixed, among other things

This commit is contained in:
Sebastian Moser
2023-03-27 23:46:46 +02:00
parent b7552fd5c9
commit 1a541217b9
4 changed files with 40 additions and 13 deletions

View File

@@ -136,6 +136,7 @@ pub struct UpdateRequestMessage {
//pub cat: String,
//cmd: String,
id: MizeId,
#[serde(flatten)]
delta: Delta,
}
@@ -144,13 +145,13 @@ pub struct UpdateMessage {
//pub cat: String,
//cmd: String,
id: MizeId,
deltas: Delta,
#[serde(flatten)]
delta: Delta,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Delta {
#[serde(flatten)]
pub raw: Vec<(Path, JsonValue)>,
pub delta: Vec<(Path, JsonValue)>,
}
type Path = Vec<String>;
@@ -379,7 +380,7 @@ pub async fn handle_update(id: MizeId, delta: Delta, mutexes: Mutexes, origin: O
let itemstore = mutexes.itemstore.lock().await;
if let MizeId::Local(id) = id {
itemstore.update(id, delta);
itemstore.update(id, delta).await?;
} else {
return Err(MizeError::new(11).extra_msg("updates to non local items are not handeld yet"));
}