Fetch messages route.

This commit is contained in:
Paul Makles
2021-01-18 20:26:09 +00:00
parent c6ba72d924
commit bd789b6825
6 changed files with 82 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
use crate::database::*;
use mongodb::bson::{doc, from_bson, Bson};
use mongodb::bson::{Bson, doc, from_bson, from_document};
use rauth::auth::Session;
use rocket::http::Status;
use rocket::request::{self, FromRequest, Outcome, Request};
@@ -22,7 +22,7 @@ impl<'a, 'r> FromRequest<'a, 'r> for User {
.await
{
if let Some(doc) = result {
Outcome::Success(from_bson(Bson::Document(doc)).unwrap())
Outcome::Success(from_document(doc).unwrap())
} else {
Outcome::Failure((Status::Forbidden, rauth::util::Error::InvalidSession))
}