feat(sync): implement settings and unreads fetch

This commit is contained in:
Paul Makles
2022-02-10 16:55:59 +00:00
parent a8d5fcec9e
commit f676071641
7 changed files with 146 additions and 37 deletions

View File

@@ -1,9 +1,9 @@
use revolt_quark::{Error, Result};
use revolt_quark::{Result, models::{ChannelUnread, User}, Db};
use mongodb::bson::doc;
use rocket::serde::json::Value;
use rocket::serde::json::Json;
#[get("/unreads")]
pub async fn req(/*user: UserRef*/) -> Result<Value> {
todo!()
pub async fn req(db: &Db, user: User) -> Result<Json<Vec<ChannelUnread>>> {
db.fetch_unreads(&user.id).await.map(Json)
}