Added playermetadata struct

This commit is contained in:
Franklin 2023-01-24 18:50:49 -04:00
parent cd828ed1b0
commit 9ac42f82e6
2 changed files with 22 additions and 1 deletions

View File

@ -1,4 +1,5 @@
pub mod player;
pub mod league;
pub mod league_player;
pub mod trust;
pub mod trust;
pub mod player_metadata;

View File

@ -0,0 +1,20 @@
use serde::{Serialize, Deserialize};
use crate::domain::player::Player;
/// Mainly used for the Chat, so that a user can request and store many players info
/// Should be as small as possible to reduce strain on servers and client storage.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, PartialOrd, Ord, Default)]
pub struct PlayerMetadata {
pub id: u32,
pub name: String,
pub profile_picture_url: Option<String>,
}
impl From<Player> for PlayerMetadata {
fn from(value: Player) -> Self {
PlayerMetadata { id: value.id, name: value.name, profile_picture_url: value.profile_picture_url }
}
}