Added Location and location ownership/rights to gamenight.
This commit is contained in:
@@ -42,6 +42,9 @@ pub struct Config {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[serde(default)]
|
||||
pub last_instance: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[serde(default)]
|
||||
pub editor: Option<String>,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
@@ -57,7 +60,8 @@ impl Config {
|
||||
pub fn new() -> Config {
|
||||
Config {
|
||||
instances: vec![],
|
||||
last_instance: None
|
||||
last_instance: None,
|
||||
editor: None
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
31
gamenight-cli/src/domain/location.rs
Normal file
31
gamenight-cli/src/domain/location.rs
Normal file
@@ -0,0 +1,31 @@
|
||||
use std::fmt::Display;
|
||||
|
||||
use gamenight_api_client_rs::models;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Location {
|
||||
pub id: Uuid,
|
||||
pub name: String,
|
||||
pub address: Option<String>,
|
||||
pub note: Option<String>,
|
||||
}
|
||||
|
||||
impl From<models::Location> for Location {
|
||||
fn from(location: models::Location) -> Self {
|
||||
Self {
|
||||
id: Uuid::parse_str(&location.id).unwrap(),
|
||||
name: location.name,
|
||||
address: location.address,
|
||||
note: location.note
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Location {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, r#"name: {}
|
||||
address: {}
|
||||
note: {}"#, &self.name, &<std::option::Option<std::string::String> as Clone>::clone(&self.address).unwrap_or_default(), &<std::option::Option<std::string::String> as Clone>::clone(&self.note).unwrap_or_default())
|
||||
}
|
||||
}
|
||||
@@ -3,4 +3,5 @@ pub mod user;
|
||||
pub mod config;
|
||||
pub mod participants;
|
||||
pub mod game;
|
||||
pub mod owned_games;
|
||||
pub mod owned_games;
|
||||
pub mod location;
|
||||
Reference in New Issue
Block a user