use serde::{Deserialize, Serialize}; use utoipa::ToSchema; use uuid::Uuid; #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, ToSchema)] pub struct UserBasicInfo { #[schema(value_type = String)] pub uid: Uuid, pub username: String, pub display_name: String, pub avatar_url: String, } impl From for UserBasicInfo { fn from(m: db::user::users::Model) -> Self { Self { uid: m.uid, username: m.username, display_name: m.display_name, avatar_url: m.avatar, } } } impl From<&db::user::users::Model> for UserBasicInfo { fn from(m: &db::user::users::Model) -> Self { Self { uid: m.uid, username: m.username.clone(), display_name: m.display_name.clone(), avatar_url: m.avatar.clone(), } } }