idlefox/src/votes/ballots.rs

23 lines
930 B
Rust

//! The ballot submodule provides functionality for managing user ballots, which include casting votes towards events.
//!
//! # Important Structures
//!
//! * `Ballot`: Represents a single vote cast by a user towards an event. It includes fields for the event ID, user handle,
//! and the value or option voted for.
use serde::{Deserialize, Serialize};
use super::{BallotValueType, EventIdType, UserDataType};
/// A `Ballot` represents a user interaction towards an event. This struct is used to record the details of a vote,
/// including which user casted it, which event it pertains to, and what value or option was voted for.
#[derive(Serialize, Deserialize, Debug)]
#[cfg_attr(test, derive(Clone))]
pub struct Ballot {
/// The event the vote refers to
linked_event: EventIdType,
/// The user casting the vote
user_handle: UserDataType,
/// What the user voted for
vote_value: BallotValueType,
}