feat: implement channel invites, perms, group create, members fetch

chore: when you accidentally run fmt
This commit is contained in:
Paul Makles
2022-02-04 21:50:30 +00:00
parent b58755dbeb
commit 88f811761b
59 changed files with 536 additions and 195 deletions

View File

@@ -1,7 +1,7 @@
use revolt_quark::{Error, EmptyResponse, Result, models::User, Database};
use crate::util::regex::RE_USERNAME;
use mongodb::bson::doc;
use rauth::entities::Account;
use revolt_quark::{models::User, Database, EmptyResponse, Error, Result};
use rocket::{serde::json::Json, State};
use serde::{Deserialize, Serialize};
use validator::Validate;
@@ -22,6 +22,10 @@ pub async fn req(
data: Json<Data>,
) -> Result<EmptyResponse> {
let data = data.into_inner();
account.verify_password(&data.password).map_err(|_| Error::InvalidCredentials)?;
user.update_username(db, data.username).await.map(|_| EmptyResponse)
account
.verify_password(&data.password)
.map_err(|_| Error::InvalidCredentials)?;
user.update_username(db, data.username)
.await
.map(|_| EmptyResponse)
}