tetratto-core 17.0.0

The core behind Tetratto
Documentation
use serde::{Serialize, Deserialize};
use tetratto_shared::{snow::Snowflake, unix_epoch_timestamp};

#[derive(Serialize, Deserialize)]
pub struct GuestLog {
    pub id: usize,
    pub created: usize,
    pub owner: usize,
    pub name: String,
    pub content: String,
    pub waiting_for_review: bool,
    pub ip: String,
}

impl GuestLog {
    /// Create a new [`GuestLog`].
    pub fn new(
        owner: usize,
        name: String,
        content: String,
        waiting_for_review: bool,
        ip: String,
    ) -> Self {
        Self {
            id: Snowflake::new().to_string().parse::<usize>().unwrap(),
            created: unix_epoch_timestamp(),
            owner,
            name,
            content,
            waiting_for_review,
            ip,
        }
    }
}