Add last_message for DMs.

This commit is contained in:
Paul Makles
2020-04-10 13:45:19 +01:00
parent 7fb2a1a8c1
commit d0c8358bc8
3 changed files with 47 additions and 14 deletions

View File

@@ -7,6 +7,7 @@ use serde::{Deserialize, Serialize};
use crate::database;
use database::message::Message;
use database::channel::LastMessage;
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ChannelRef {
@@ -15,6 +16,8 @@ pub struct ChannelRef {
#[serde(rename = "type")]
pub channel_type: u8,
pub last_message: Option<LastMessage>,
// information required for permission calculations
pub recipients: Option<Vec<String>>,
pub guild: Option<String>,
@@ -44,6 +47,7 @@ impl<'r> FromParam<'r> for ChannelRef {
.projection(doc! {
"_id": 1,
"type": 1,
"last_message": 1,
"recipients": 1,
"guild": 1,
"owner": 1,