Move Store::decline_call to Db::decline_call

This commit is contained in:
Antonio Scandurra 2022-11-11 15:41:56 +01:00
parent c213c98ea4
commit 0d1d267213
3 changed files with 38 additions and 46 deletions

View file

@ -1027,6 +1027,24 @@ where
})
}
pub async fn decline_call(&self, room_id: RoomId, user_id: UserId) -> Result<proto::Room> {
test_support!(self, {
let mut tx = self.pool.begin().await?;
sqlx::query(
"
DELETE FROM room_participants
WHERE room_id = $1 AND user_id = $2 AND connection_id IS NULL
",
)
.bind(room_id)
.bind(user_id)
.execute(&mut tx)
.await?;
self.commit_room_transaction(room_id, tx).await
})
}
pub async fn join_room(
&self,
room_id: RoomId,