forked from Roflin/gamenight
Implemented deleting games as admin.
This commit is contained in:
25
gamenight-cli/src/domain/location_select_data.rs
Normal file
25
gamenight-cli/src/domain/location_select_data.rs
Normal file
@@ -0,0 +1,25 @@
|
||||
use std::fmt::{Display, Formatter};
|
||||
use gamenight_api_client_rs::models::Location;
|
||||
use uuid::Uuid;
|
||||
use crate::flows::FlowError;
|
||||
|
||||
pub struct LocationSelectData {
|
||||
pub id: Uuid,
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
impl Display for LocationSelectData {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { write!(f, "{}", self.name) }
|
||||
}
|
||||
|
||||
impl TryFrom<&Location> for LocationSelectData {
|
||||
type Error = FlowError;
|
||||
|
||||
fn try_from(value: &Location) -> Result<Self, Self::Error> {
|
||||
let uuid = Uuid::parse_str(&value.id)?;
|
||||
Ok(LocationSelectData {
|
||||
id: uuid,
|
||||
name: value.name.clone(),
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user