use serde::{Deserialize, Serialize}; use uuid::Uuid; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct UserInfo { pub id: Uuid, pub username: String, pub display_name: String, pub avatar_url: String, } impl UserInfo { pub fn unknown(id: Uuid) -> Self { Self { id, username: String::new(), display_name: String::new(), avatar_url: String::new(), } } pub fn from_model(m: &model::users::UserModel) -> Self { Self { id: m.id, username: m.username.clone(), display_name: m.display_name.clone(), avatar_url: m.avatar_url.clone(), } } } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct RoomInfo { pub id: Uuid, pub name: String, } impl RoomInfo { pub fn unknown(id: Uuid) -> Self { Self { id, name: String::new(), } } pub fn from_model(m: &model::channel::ChannelModel) -> Self { Self { id: m.id, name: m.name.clone(), } } } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct WorkspaceInfo { pub id: Uuid, pub name: String, pub avatar_url: String, } impl WorkspaceInfo { pub fn unknown(id: Uuid) -> Self { Self { id, name: String::new(), avatar_url: String::new(), } } pub fn from_model(m: &model::workspace::WorkspaceModel) -> Self { Self { id: m.id, name: m.name.clone(), avatar_url: m.avatar_url.clone(), } } }