27 lines
818 B
Rust
27 lines
818 B
Rust
use std::fmt::{Display, Formatter};
|
|
use chrono::{DateTime, Local};
|
|
use uuid::Uuid;
|
|
use crate::domain::owned_games::OwnedGames;
|
|
use crate::domain::participants::Participants;
|
|
use crate::domain::user::User;
|
|
|
|
#[derive(Clone)]
|
|
pub struct Gamenight {
|
|
pub id: Uuid,
|
|
pub name: String,
|
|
pub start_time: DateTime<Local>,
|
|
pub organizer: User,
|
|
pub participants: Participants,
|
|
pub owned_games: OwnedGames,
|
|
}
|
|
|
|
impl Display for Gamenight {
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
writeln!(f, "Name: {}", self.name)?;
|
|
writeln!(f, "Organizer: {}", self.organizer)?;
|
|
writeln!(f, "Start: {}", self.start_time.to_rfc3339())?;
|
|
writeln!(f, "Participants: {}", self.participants)?;
|
|
write!(f, "Owned games:\n{}", self.owned_games)?;
|
|
Ok(())
|
|
}
|
|
} |