64 lines
No EOL
1.6 KiB
Rust
64 lines
No EOL
1.6 KiB
Rust
use std::collections::HashMap;
|
|
use serde::{Deserialize, Serialize};
|
|
use utoipa::{ToSchema};
|
|
|
|
// DB Permission Enums
|
|
|
|
pub enum TablePermission {
|
|
Game,
|
|
Empire,
|
|
Data,
|
|
User
|
|
}
|
|
|
|
// User Structs
|
|
|
|
#[derive(Serialize, ToSchema, Debug)]
|
|
pub struct User {
|
|
#[schema(example = "abcdef")]
|
|
pub user_token: String,
|
|
#[schema(example = "discorduser")]
|
|
pub discord_handle: Option<String>,
|
|
#[schema(example = "/assets/avatars/124677612.png")]
|
|
pub profile_picture: Option<String>,
|
|
#[schema(example = "\
|
|
{\
|
|
[\"game_permissions\"]: true,
|
|
[\"empire_permissions\"]: true,
|
|
[\"data_permissions\"]: false,
|
|
[\"user_permissions\"]: false,
|
|
}\
|
|
")]
|
|
pub permissions: HashMap<String, bool>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, ToSchema, Debug)]
|
|
pub struct GetUserParams {
|
|
#[schema(example = "abcdef")]
|
|
pub user_token: String,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, ToSchema, Debug)]
|
|
pub struct UpdateUserParams {
|
|
#[schema(example = "abcdef")]
|
|
pub user_token: String,
|
|
#[schema(example = "discorduser")]
|
|
pub discord_handle: Option<String>,
|
|
#[schema(example = "/assets/avatars/124677612.png")]
|
|
pub profile_picture: Option<String>,
|
|
#[schema(example = "\
|
|
{\
|
|
[\"game_permissions\"]: true,
|
|
[\"empire_permissions\"]: true,
|
|
[\"data_permissions\"]: false,
|
|
[\"user_permissions\"]: false,
|
|
}\
|
|
")]
|
|
pub permissions: HashMap<String, bool>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, ToSchema, Debug)]
|
|
pub struct DeleteUserParams {
|
|
#[schema(example = "abcdef")]
|
|
pub user_token: String,
|
|
} |