Adds renaming games functionality
This commit is contained in:
26
gamenight-cli/src/domain/game.rs
Normal file
26
gamenight-cli/src/domain/game.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
use std::fmt::Display;
|
||||
|
||||
use gamenight_api_client_rs::models;
|
||||
use uuid::Uuid;
|
||||
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Game {
|
||||
pub id: Uuid,
|
||||
pub name: String
|
||||
}
|
||||
|
||||
impl From<models::Game> for Game {
|
||||
fn from(game: models::Game) -> Self {
|
||||
Self {
|
||||
id: Uuid::parse_str(&game.id).unwrap(),
|
||||
name: game.name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Game {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "Name: {}", self.name)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user