1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
use serde::{Deserialize, Serialize}; use uuid::Uuid; #[derive(Clone, Debug, Deserialize, Serialize)] pub enum PollStatus { Pending, Active, Complete } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Poll { id: Uuid, session_id: Uuid, idx: u32, author_id: Uuid, title: String, status: PollStatus, final_vote: Option<String> } #[derive(Clone, Debug, Deserialize, Serialize)] pub enum PollActionType { UpdateTitle, StatusChange, CastVote } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct PollAction { id: Uuid, poll_id: Uuid, user_id: Uuid, t: PollActionType, ctx: std::collections::HashMap<String, String>, message: String } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Vote { session_id: Uuid, poll_id: Uuid, user_id: Uuid, choice: String }