fixed ownership tranfer

This commit is contained in:
2026-01-17 08:34:21 +01:00
parent 4a833b592c
commit 889dac99d2
2 changed files with 5 additions and 2 deletions

View File

@@ -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