Added Location and location ownership/rights to gamenight.

This commit is contained in:
2025-12-24 14:48:54 +01:00
parent 8a48119c80
commit ff88029a4b
57 changed files with 3034 additions and 995 deletions

View File

@@ -2,16 +2,30 @@ use actix_web::{get, http::header::ContentType, web, HttpResponse, Responder};
use gamenight_database::{DbPool, GetConnection};
use uuid::Uuid;
use crate::{models::{gamenight_id::GamenightId, participants::Participants}, request::{authorization::AuthUser, error::ApiError}};
use crate::{
models::{gamenight_id::GamenightId, participants::Participants},
request::{authorization::AuthUser, error::ApiError},
};
#[get("/participants")]
pub async fn get_get_participants(pool: web::Data<DbPool>, _user: AuthUser, gamenight_info: web::Json<GamenightId>) -> Result<impl Responder, ApiError> {
pub async fn get_get_participants(
pool: web::Data<DbPool>,
_user: AuthUser,
gamenight_info: web::Json<GamenightId>,
) -> Result<impl Responder, ApiError> {
let mut conn = pool.get_conn();
let users = gamenight_database::get_participants(&mut conn, &Uuid::parse_str(&gamenight_info.into_inner().gamenight_id)?)?
.iter().map(|x| x.to_string()).collect();
let users = gamenight_database::get_participants(
&mut conn,
&Uuid::parse_str(&gamenight_info.into_inner().gamenight_id)?,
)?
.iter()
.map(|x| x.to_string())
.collect();
Ok(HttpResponse::Ok()
.content_type(ContentType::json())
.body(serde_json::to_string(&Participants{participants: users})?))
}
.body(serde_json::to_string(&Participants {
participants: users,
})?))
}