forked from jmug/stoatchat
New Feature: Add server-side channel unreads.
This commit is contained in:
10
src/routes/sync/get_unreads.rs
Normal file
10
src/routes/sync/get_unreads.rs
Normal file
@@ -0,0 +1,10 @@
|
||||
use crate::database::*;
|
||||
use crate::util::result::Result;
|
||||
|
||||
use rocket_contrib::json::JsonValue;
|
||||
use mongodb::bson::doc;
|
||||
|
||||
#[get("/unreads")]
|
||||
pub async fn req(user: User) -> Result<JsonValue> {
|
||||
Ok(json!(user.fetch_unreads().await?))
|
||||
}
|
||||
@@ -2,7 +2,8 @@ use rocket::Route;
|
||||
|
||||
mod get_settings;
|
||||
mod set_settings;
|
||||
mod get_unreads;
|
||||
|
||||
pub fn routes() -> Vec<Route> {
|
||||
routes![get_settings::req, set_settings::req]
|
||||
routes![get_settings::req, set_settings::req, get_unreads::req]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user