2024-07-23 21:51:42 +01:00
|
|
|
use rocket::serde::{Deserialize, Serialize};
|
|
|
|
|
|
|
|
#[derive(sqlx::FromRow, Deserialize, Serialize)]
|
|
|
|
#[serde(crate = "rocket::serde")]
|
|
|
|
pub struct Player {
|
|
|
|
id: u16,
|
|
|
|
name: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(sqlx::FromRow, Deserialize, Serialize)]
|
|
|
|
#[serde(crate = "rocket::serde")]
|
|
|
|
pub struct PlayerLoginInfo {
|
|
|
|
pub id: u16,
|
|
|
|
pub is_admin: bool,
|
|
|
|
pub name: String,
|
|
|
|
pub pwd_hash: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(sqlx::FromRow, Deserialize, Serialize)]
|
|
|
|
#[serde(crate = "rocket::serde")]
|
|
|
|
pub struct Truth {
|
|
|
|
id: u32,
|
|
|
|
week: u8,
|
|
|
|
number: u8,
|
|
|
|
author_id: u16,
|
|
|
|
rendered_text: String,
|
|
|
|
raw_text: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(sqlx::FromRow, Deserialize, Serialize)]
|
|
|
|
#[serde(crate = "rocket::serde")]
|
|
|
|
pub struct DisplayTruth {
|
|
|
|
id: u32,
|
|
|
|
number: u8,
|
|
|
|
author_id: u16,
|
|
|
|
rendered_text: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(sqlx::FromRow, Deserialize, Serialize)]
|
|
|
|
#[serde(crate = "rocket::serde")]
|
|
|
|
pub struct Vote {
|
|
|
|
pub id: u32,
|
|
|
|
pub truth_id: u32,
|
|
|
|
pub voter_id: u16,
|
|
|
|
pub voted_id: u16
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(sqlx::FromRow, Deserialize, Serialize)]
|
|
|
|
#[serde(crate = "rocket::serde")]
|
|
|
|
pub struct VotingData {
|
|
|
|
pub votes_for: String,
|
|
|
|
pub truth_number: u8,
|
|
|
|
pub votes: u8
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(sqlx::FromRow, Deserialize, Serialize)]
|
|
|
|
#[serde(crate = "rocket::serde")]
|
|
|
|
pub struct AuthTokens {
|
|
|
|
pub token: String,
|
|
|
|
}
|
2024-07-23 21:51:51 +01:00
|
|
|
|
|
|
|
#[derive(sqlx::FromRow, Deserialize, Serialize)]
|
|
|
|
#[serde(crate = "rocket::serde")]
|
|
|
|
pub struct Week {
|
|
|
|
pub number: u8,
|
|
|
|
pub is_last_week: bool,
|
|
|
|
pub rendered_text: String,
|
|
|
|
pub raw_text: String,
|
|
|
|
}
|