2022-09-03 10:35:15 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
2022-09-05 04:02:36 +00:00
|
|
|
use sqlx::types::chrono::NaiveDateTime;
|
2022-09-03 10:35:15 +00:00
|
|
|
use uuid::Uuid;
|
|
|
|
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
|
|
pub struct Message {
|
|
|
|
pub territory: u32,
|
|
|
|
pub x: f32,
|
|
|
|
pub y: f32,
|
|
|
|
pub z: f32,
|
2022-09-04 21:04:44 +00:00
|
|
|
#[serde(default)]
|
|
|
|
pub yaw: f32,
|
2022-09-03 10:35:15 +00:00
|
|
|
|
|
|
|
pub pack_id: Uuid,
|
|
|
|
pub template_1: usize,
|
|
|
|
pub word_1_list: Option<usize>,
|
|
|
|
pub word_1_word: Option<usize>,
|
2022-09-03 13:55:36 +00:00
|
|
|
pub conjunction: Option<usize>,
|
2022-09-03 10:35:15 +00:00
|
|
|
pub template_2: Option<usize>,
|
|
|
|
pub word_2_list: Option<usize>,
|
|
|
|
pub word_2_word: Option<usize>,
|
2022-09-06 04:24:32 +00:00
|
|
|
|
2022-09-06 04:29:31 +00:00
|
|
|
#[serde(default = "glyph_default")]
|
2022-09-06 04:24:32 +00:00
|
|
|
pub glyph: i8,
|
2022-09-03 10:35:15 +00:00
|
|
|
}
|
|
|
|
|
2022-09-06 04:29:31 +00:00
|
|
|
fn glyph_default() -> i8 {
|
|
|
|
3
|
|
|
|
}
|
|
|
|
|
2022-09-03 10:35:15 +00:00
|
|
|
#[derive(Debug, Serialize)]
|
|
|
|
pub struct RetrievedMessage {
|
|
|
|
pub id: String,
|
|
|
|
pub x: f64,
|
|
|
|
pub y: f64,
|
|
|
|
pub z: f64,
|
2022-09-04 21:04:44 +00:00
|
|
|
pub yaw: f64,
|
2022-09-03 10:35:15 +00:00
|
|
|
pub message: String,
|
|
|
|
pub positive_votes: i32,
|
|
|
|
pub negative_votes: i32,
|
2022-09-04 07:12:51 +00:00
|
|
|
pub user_vote: i64,
|
2022-09-06 04:24:32 +00:00
|
|
|
pub glyph: i64,
|
2022-09-05 04:02:36 +00:00
|
|
|
#[serde(skip)]
|
|
|
|
pub created: NaiveDateTime,
|
2022-09-05 09:05:14 +00:00
|
|
|
#[serde(skip)]
|
|
|
|
pub user: String,
|
2022-09-06 12:07:23 +00:00
|
|
|
#[serde(skip)]
|
|
|
|
pub last_seen_minutes: i64,
|
2022-09-05 23:23:55 +00:00
|
|
|
}
|
|
|
|
|
2022-09-04 04:32:56 +00:00
|
|
|
#[derive(Debug, Serialize)]
|
|
|
|
pub struct RetrievedMessageTerritory {
|
|
|
|
pub id: String,
|
2022-09-04 05:03:59 +00:00
|
|
|
pub territory: i64,
|
2022-09-04 04:32:56 +00:00
|
|
|
pub x: f64,
|
|
|
|
pub y: f64,
|
|
|
|
pub z: f64,
|
2022-09-04 21:04:44 +00:00
|
|
|
pub yaw: f64,
|
2022-09-04 04:32:56 +00:00
|
|
|
pub message: String,
|
|
|
|
pub positive_votes: i32,
|
|
|
|
pub negative_votes: i32,
|
2022-09-04 07:12:51 +00:00
|
|
|
pub user_vote: i64,
|
2022-09-06 04:24:32 +00:00
|
|
|
pub glyph: i64,
|
2022-09-05 08:02:34 +00:00
|
|
|
#[serde(skip)]
|
|
|
|
pub created: NaiveDateTime,
|
2022-09-04 04:32:56 +00:00
|
|
|
}
|
2022-09-09 10:10:15 +00:00
|
|
|
|
|
|
|
#[derive(Debug, Serialize)]
|
|
|
|
pub struct OwnMessage {
|
|
|
|
pub id: String,
|
|
|
|
pub territory: i64,
|
|
|
|
pub x: f64,
|
|
|
|
pub y: f64,
|
|
|
|
pub z: f64,
|
|
|
|
pub yaw: f64,
|
|
|
|
pub message: String,
|
|
|
|
pub positive_votes: i32,
|
|
|
|
pub negative_votes: i32,
|
|
|
|
pub user_vote: i64,
|
|
|
|
pub glyph: i64,
|
|
|
|
#[serde(skip)]
|
|
|
|
pub created: NaiveDateTime,
|
|
|
|
pub is_hidden: bool,
|
|
|
|
}
|