Remove channel chat participant when connection is lost

This commit is contained in:
Max Brunsfeld 2023-09-11 17:37:05 -07:00
parent f2112b9aad
commit 1c50587cad
4 changed files with 74 additions and 44 deletions

View file

@ -25,6 +25,25 @@ impl Database {
.await
}
pub async fn channel_chat_connection_lost(
&self,
connection_id: ConnectionId,
tx: &DatabaseTransaction,
) -> Result<()> {
channel_chat_participant::Entity::delete_many()
.filter(
Condition::all()
.add(
channel_chat_participant::Column::ConnectionServerId
.eq(connection_id.owner_id),
)
.add(channel_chat_participant::Column::ConnectionId.eq(connection_id.id)),
)
.exec(tx)
.await?;
Ok(())
}
pub async fn leave_channel_chat(
&self,
channel_id: ChannelId,