Delete & Post Game Endpoints. Various other changes

This commit is contained in:
Neshura 2023-08-30 04:16:43 +02:00
parent 790a7dd8ee
commit 07e6df6b64
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C
8 changed files with 493 additions and 107 deletions

View file

@ -4,10 +4,43 @@ use serde::{Serialize, Deserialize};
use utoipa::{ToSchema, IntoParams};
#[derive(Serialize, Deserialize, ToSchema, Debug, IntoParams)]
pub struct AuthParams {
pub struct AuthParamsOptional {
#[schema(example = "1357")]
pub token: Option<String>,
}
#[derive(Serialize, Deserialize, ToSchema, Debug, IntoParams)]
pub struct AuthParams {
#[schema(example = "1357")]
pub token: String,
}
#[derive(Serialize, Deserialize, ToSchema, Debug)]
pub struct AuthReturn {
#[schema(example = false)]
pub moderator: bool,
#[schema(example = false)]
pub admin: bool,
}
#[derive(Serialize, Deserialize, ToSchema, Debug, IntoParams)]
pub struct GetGameParam {
pub game_id: Option<usize>,
}
#[derive(Serialize, Deserialize, ToSchema, Debug)]
pub struct PostGameParams {
pub auth: AuthParams,
#[schema(example = "Game XY")]
pub game_name: String,
}
#[derive(Serialize, Deserialize, ToSchema, Debug, IntoParams)]
pub struct DeleteGameParam {
#[schema(example = 0)]
pub game_id: usize,
}
#[derive(Serialize, ToSchema, Debug, Clone)]
pub struct FullViewData {
pub games: HashMap<i32, ChellarisGame>,
@ -23,6 +56,12 @@ pub struct ChellarisGame {
pub empires: HashMap<i32, ChellarisEmpire>,
}
#[derive(Serialize, ToSchema, Debug, Clone)]
pub struct ChellarisGameLite {
pub id: i32,
pub name: String,
}
#[derive(Serialize, ToSchema, Debug, Clone)]
pub struct ChellarisGameGroup {
pub id: i32,
@ -68,4 +107,5 @@ pub struct Portrait {
pub id: i32,
pub hires: String,
pub lores: Option<String>,
}
}