51 lines
1.6 KiB
Rust
51 lines
1.6 KiB
Rust
//! Module that handles all the logic related to votes within an application.
|
|
//!
|
|
//! This module provides the necessary structures and traits to manage events
|
|
//! and their corresponding votes. It includes:
|
|
//!
|
|
//! - Structs: `Event`, `Vote`, `PendingEvents`, and `OngoingEvents`.
|
|
//! - Traits: None at this time.
|
|
//! - Enums: `EventStatus` that represents different states an event can be in.
|
|
//!
|
|
//! Note:
|
|
//! - The types `UserDataType`, `VoteValueType`, and some fields are marked
|
|
//! as deprecated and should not be used.
|
|
//! They are placeholders for the actual data structures which need to be
|
|
//! defined correctly.
|
|
#![allow(deprecated)]
|
|
#![warn(clippy::missing_docs_in_private_items)]
|
|
|
|
mod ballots;
|
|
mod events;
|
|
mod helper_functions;
|
|
mod holders;
|
|
mod traits;
|
|
|
|
// Republish
|
|
pub use ballots::Ballot;
|
|
pub use events::{EventClosed, EventOngoing, EventPending};
|
|
pub use helper_functions::EventHolder;
|
|
pub use helper_functions::*;
|
|
pub use holders::{ListOngoingEvents, ListPendingEvents};
|
|
|
|
use std::collections::HashMap;
|
|
|
|
use crate::ids::EventIdType;
|
|
|
|
/// The hashmap of pending votes
|
|
type PendingHashmap = HashMap<EventIdType, EventPending>;
|
|
/// The hashmap of ongoing, opened votes
|
|
type OngoingHashmap = HashMap<EventIdType, EventOngoing>;
|
|
/// The hashmap of closed votes, still available for reading to check the results
|
|
type ClosedHashmap = HashMap<EventIdType, EventClosed>;
|
|
|
|
/// Placeholder user data type
|
|
///
|
|
/// Links back to an user
|
|
#[deprecated(note = "This is an incorrect type to define an user")]
|
|
pub type UserDataType = String;
|
|
|
|
/// What an user voted for
|
|
#[deprecated(note = "This is an incorrect type to define a voting ballot")]
|
|
pub type BallotValueType = String;
|