use actix_web::{delete, web, HttpResponse, Responder}; use gamenight_database::{DbPool, GetConnection}; use gamenight_database::gamenight_participants::GamenightParticipant; use uuid::Uuid; use crate::request::authorization::AuthUser; use crate::request::error::ApiError; #[delete("/gamenight/{gamenightId}/participant/{userId}")] pub async fn delete_gamenight_participant( pool: web::Data, _user: AuthUser, gamenight_id: web::Path, user_id: web::Path ) -> Result { web::block(move || -> Result { let mut conn = pool.get_conn(); let participant = GamenightParticipant { gamenight_id: gamenight_id.into_inner(), user_id: user_id.into_inner(), }; let x = gamenight_database::gamenight_participants::delete_gamenight_participant(&mut conn, participant)?; Ok(x) }) .await??; Ok(HttpResponse::Ok()) }