+ New route for /members/me/nickname

! No testing yet that comes in next patch, with any required fixes
+ db now has specific method for Member::update_nickk
This commit is contained in:
shockrah
2021-02-21 17:21:17 -08:00
parent 7263df8928
commit 5db976b9de
4 changed files with 42 additions and 1 deletions

View File

@@ -199,7 +199,7 @@ impl Member {
pub async fn update_perms(p: &Pool, uid: UBigInt, permissions: UBigInt) -> Result<UBigInt, SqlError> {
//! @return on_sucess Ok(NewPermisionsMask)
//!
//! @throws Err(SqlError)
let conn = p.get_conn().await?;
conn.drop_exec(
"UPDATE members SET permissions = :perms WHERE id = :id",
@@ -210,4 +210,17 @@ impl Member {
Ok(permissions)
}
pub async fn update_nick(p: &Pool, uid: UBigInt, new_nick: &str) -> Result<(), SqlError> {
let conn = p.get_conn().await?;
conn.drop_exec(
"UPDATE members SET name = :nick WHERE id = id",
params!{
"id" => uid,
"nick" => new_nick
}).await?;
Ok(())
}
}