Get notifications working properly.

This commit is contained in:
Paul Makles
2020-12-30 15:24:44 +00:00
parent f39bc07bb9
commit 1aaa6f3c41
8 changed files with 205 additions and 60 deletions

View File

@@ -0,0 +1,17 @@
use crate::database::entities::User;
use super::hive::get_hive;
use hive_pubsub::PubSub;
pub async fn generate_subscriptions(user: &User) -> Result<(), String> {
let hive = get_hive();
hive.subscribe(user.id.clone(), user.id.clone())?;
if let Some(relations) = &user.relations {
for relation in relations {
hive.subscribe(user.id.clone(), relation.id.clone())?;
}
}
Ok(())
}