forked from jmug/stoatchat
@@ -14,9 +14,9 @@ pub struct Options {
|
||||
#[post("/settings/fetch", data = "<options>")]
|
||||
pub async fn req(user: User, options: Json<Options>) -> Result<Value> {
|
||||
if user.bot.is_some() {
|
||||
return Err(Error::IsBot)
|
||||
return Err(Error::IsBot);
|
||||
}
|
||||
|
||||
|
||||
let options = options.into_inner();
|
||||
let mut projection = doc! {
|
||||
"_id": 0,
|
||||
|
||||
@@ -7,8 +7,8 @@ use rocket::serde::json::Value;
|
||||
#[get("/unreads")]
|
||||
pub async fn req(user: User) -> Result<Value> {
|
||||
if user.bot.is_some() {
|
||||
return Err(Error::IsBot)
|
||||
return Err(Error::IsBot);
|
||||
}
|
||||
|
||||
|
||||
Ok(json!(User::fetch_unreads(&user.id).await?))
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::database::*;
|
||||
use crate::notifications::events::ClientboundNotification;
|
||||
use crate::util::result::{Error, Result, EmptyResponse};
|
||||
use crate::util::result::{EmptyResponse, Error, Result};
|
||||
|
||||
use chrono::prelude::*;
|
||||
use mongodb::bson::{doc, to_bson};
|
||||
@@ -20,7 +20,7 @@ pub struct Options {
|
||||
#[post("/settings/set?<options..>", data = "<data>")]
|
||||
pub async fn req(user: User, data: Json<Data>, options: Options) -> Result<EmptyResponse> {
|
||||
if user.bot.is_some() {
|
||||
return Err(Error::IsBot)
|
||||
return Err(Error::IsBot);
|
||||
}
|
||||
|
||||
let data = data.into_inner();
|
||||
|
||||
Reference in New Issue
Block a user