fixed ownership tranfer
This commit is contained in:
@@ -52,7 +52,7 @@ pub struct AcceptRoomInvitePayload {
|
||||
#[derive(serde::Deserialize)]
|
||||
pub struct TransferOwnershipPayload {
|
||||
pub room_uuid: Uuid,
|
||||
pub new_owner_uuid: Option<Uuid>,
|
||||
pub new_owner_uuid: Uuid,
|
||||
}
|
||||
|
||||
pub fn routes() -> Router {
|
||||
@@ -670,8 +670,10 @@ async fn transfer_ownership(
|
||||
));
|
||||
}
|
||||
|
||||
let new_owner_id = user_id_from_uuid(&db, payload.new_owner_uuid).await?;
|
||||
|
||||
sqlx::query("UPDATE room_ SET owner = $1 WHERE id = $2")
|
||||
.bind(payload.new_owner_uuid)
|
||||
.bind(new_owner_id)
|
||||
.bind(room_id)
|
||||
.execute(&db)
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user