Remove ChannelRef, use the full Channel object.

This commit is contained in:
Paul Makles
2020-08-03 11:01:05 +02:00
parent b0f8abef33
commit fa6ed75ed8
6 changed files with 52 additions and 39 deletions

View File

@@ -1,8 +1,8 @@
use super::get_collection;
use crate::guards::channel::ChannelRef;
use crate::notifications;
use crate::notifications::events::message::Create;
use crate::notifications::events::Notification;
use crate::database::channel::Channel;
use crate::routes::channel::ChannelType;
use bson::{doc, to_bson, UtcDateTime};
@@ -32,7 +32,7 @@ pub struct Message {
// ? pub fn send_message();
// ? handle websockets?
impl Message {
pub fn send(&self, target: &ChannelRef) -> bool {
pub fn send(&self, target: &Channel) -> bool {
if get_collection("messages")
.insert_one(to_bson(&self).unwrap().as_document().unwrap().clone(), None)
.is_ok()