Implemented leaving a gamenight on the server/database side

This commit is contained in:
2025-06-15 19:11:26 +02:00
parent db6f55bc47
commit d11e31149b
5 changed files with 49 additions and 3 deletions

View File

@@ -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)?)
}