forked from Roflin/gamenight
Implemented leaving a gamenight on the server/database side
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use diesel::{ExpressionMethods, Insertable, QueryDsl, Queryable, RunQueryDsl};
|
||||
use diesel::{BoolExpressionMethods, ExpressionMethods, Insertable, QueryDsl, Queryable, RunQueryDsl};
|
||||
use serde::{Serialize, Deserialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
@@ -25,4 +25,10 @@ pub fn get_participants(conn: &mut DbConnection, id: &Uuid) -> Result<Vec<Uuid>,
|
||||
|
||||
pub fn insert_gamenight_participant(conn: &mut DbConnection, gp: GamenightParticipant) -> Result<usize, DatabaseError> {
|
||||
Ok(gp.insert_into(gamenight_participant::table).execute(conn)?)
|
||||
}
|
||||
|
||||
pub fn delete_gamenight_participant(conn: &mut DbConnection, gp: GamenightParticipant) -> Result<usize, DatabaseError> {
|
||||
Ok(gamenight_participant::table
|
||||
.filter(gamenight_participant::gamenight_id.eq(&gp.gamenight_id).and(gamenight_participant::user_id.eq(gp.user_id)))
|
||||
.execute(conn)?)
|
||||
}
|
||||
Reference in New Issue
Block a user