Compare commits

..

2 Commits

View File

@@ -1,4 +1,4 @@
use crate::Backend; use crate::{random_names::get_name_by_uuid, Backend};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use sqlx::FromRow; use sqlx::FromRow;
use uuid::Uuid; use uuid::Uuid;
@@ -9,6 +9,15 @@ pub struct Client {
pub name: Option<String>, pub name: Option<String>,
} }
impl Client {
pub(crate) fn get_display_name(&self) -> String {
match &self.name {
Some(name) => name.to_string(),
None => get_name_by_uuid(&self.uuid).to_string(),
}
}
}
impl Backend { impl Backend {
pub(crate) async fn get_client(&self, uuid: &Uuid) -> Client { pub(crate) async fn get_client(&self, uuid: &Uuid) -> Client {
let uuid = uuid.to_string(); let uuid = uuid.to_string();