forked from lavina/lavina
20 lines
454 B
Rust
20 lines
454 B
Rust
use anyhow::Result;
|
|
|
|
use crate::repo::Storage;
|
|
|
|
impl Storage {
|
|
pub async fn add_room_member(&mut self, room_id: &u32, player_id: &u32) -> Result<()> {
|
|
let mut executor = self.conn.lock().await;
|
|
sqlx::query(
|
|
"insert into memberships(user_id, room_id, status)
|
|
values (?, ?, 1);",
|
|
)
|
|
.bind(player_id)
|
|
.bind(room_id)
|
|
.execute(&mut *executor)
|
|
.await?;
|
|
|
|
Ok(())
|
|
}
|
|
}
|