+ 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:
@@ -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(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user