trotFunky
67ce54e992
- Create a new migration adding a Weeks table, allowing for new weekly introductions and paving the way for multiple week handling. - Add route to update the weekly introduction - Move the week rendering to a specific week file - Update the templates to use the week number from the week data - Update templates to render and edit weekly introductions
69 lines
1.5 KiB
Rust
69 lines
1.5 KiB
Rust
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,
|
|
}
|
|
|
|
#[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,
|
|
}
|