chore(thanos): strip down codebase to just API routes

This commit is contained in:
Paul Makles
2022-01-27 14:16:30 +00:00
parent ab4c3f913e
commit 0fdb749199
116 changed files with 893 additions and 10025 deletions

View File

@@ -1,40 +1,9 @@
use crate::database::*;
use crate::util::result::{Error, Result};
use revolt_quark::{Error, Result};
use futures::StreamExt;
use mongodb::bson::doc;
use rocket::serde::json::Value;
#[get("/dms")]
pub async fn req(user: User) -> Result<Value> {
let mut cursor = get_collection("channels")
.find(
doc! {
"$or": [
{
"channel_type": "DirectMessage",
"active": true
},
{
"channel_type": "Group"
}
],
"recipients": user.id
},
None,
)
.await
.map_err(|_| Error::DatabaseError {
operation: "find",
with: "channels",
})?;
let mut channels = vec![];
while let Some(result) = cursor.next().await {
if let Ok(doc) = result {
channels.push(doc);
}
}
Ok(json!(channels))
pub async fn req(/*user: UserRef*/) -> Result<Value> {
todo!()
}