diff --git a/src/dto/mod.rs b/src/dto/mod.rs index 547c32b..964b4a1 100644 --- a/src/dto/mod.rs +++ b/src/dto/mod.rs @@ -1,4 +1,5 @@ pub mod player; pub mod league; pub mod league_player; -pub mod trust; \ No newline at end of file +pub mod trust; +pub mod player_metadata; \ No newline at end of file diff --git a/src/dto/player_metadata.rs b/src/dto/player_metadata.rs new file mode 100644 index 0000000..e9b6fa7 --- /dev/null +++ b/src/dto/player_metadata.rs @@ -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, +} + +impl From for PlayerMetadata { + fn from(value: Player) -> Self { + PlayerMetadata { id: value.id, name: value.name, profile_picture_url: value.profile_picture_url } + } +} +