Send create, update and delete notifications for Sends in the correct format.

Add endpoints to get all sends or a specific send by its uuid.
This commit is contained in:
Fabian Thies
2021-08-03 17:33:59 +02:00
parent c666497130
commit dd98fe860b
3 changed files with 58 additions and 10 deletions

View File

@ -65,7 +65,7 @@ use chashmap::CHashMap;
use chrono::NaiveDateTime;
use serde_json::from_str;
use crate::db::models::{Cipher, Folder, User};
use crate::db::models::{Cipher, Folder, User, Send};
use rmpv::Value;
@ -335,6 +335,23 @@ impl WebSocketUsers {
self.send_update(uuid, &data).ok();
}
}
pub fn send_send_update(&self, ut: UpdateType, send: &Send, user_uuids: &[String]) {
let user_uuid = convert_option(send.user_uuid.clone());
let data = create_update(
vec![
("Id".into(), send.uuid.clone().into()),
("UserId".into(), user_uuid),
("RevisionDate".into(), serialize_date(send.revision_date)),
],
ut,
);
for uuid in user_uuids {
self.send_update(uuid, &data).ok();
}
}
}
/* Message Structure