forked from jmug/stoatchat
feat(sync): implement settings and unreads fetch
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
use revolt_quark::{Error, Result};
|
||||
use revolt_quark::{Result, models::{UserSettings, User}, Db};
|
||||
|
||||
use mongodb::bson::doc;
|
||||
use mongodb::options::FindOneOptions;
|
||||
use rocket::serde::json::{Json, Value};
|
||||
use rocket::serde::json::Json;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
@@ -11,6 +10,6 @@ pub struct Options {
|
||||
}
|
||||
|
||||
#[post("/settings/fetch", data = "<options>")]
|
||||
pub async fn req(/*user: UserRef,*/ options: Json<Options>) -> Result<Value> {
|
||||
todo!()
|
||||
pub async fn req(db: &Db, user: User, options: Json<Options>) -> Result<Json<UserSettings>> {
|
||||
db.fetch_user_settings(&user.id, &options.into_inner().keys).await.map(Json)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user