Compare commits

..

No commits in common. "ac93f4ba37501fb4e94a74d912db70f2fa02a518" and "af03fe896fc431dde2240a96ec5ac983e29be4ca" have entirely different histories.

5 changed files with 4 additions and 59 deletions

2
Cargo.lock generated
View File

@ -60,7 +60,7 @@ checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
[[package]]
name = "dev-dtos"
version = "0.1.0"
source = "git+https://github.com/franklinblanco/user-svc-dtos-rust.git#80abf74269baf13b9fc1d186516564b0d4521270"
source = "git+https://github.com/franklinblanco/user-dtos.git#3b3ffde695753edb4e7ffdf722299b372f2c0bd0"
dependencies = [
"chrono",
"serde",

View File

@ -16,4 +16,4 @@ chrono = { version = "0.4", features = [ "serde" ] }
rust_decimal = "1.26"
err = { git = "https://github.com/franklinblanco/err.git" }
dev-dtos = { git = "https://github.com/franklinblanco/user-svc-dtos-rust.git" }
dev-dtos = { git = "https://github.com/franklinblanco/user-dtos.git" }

View File

@ -8,10 +8,8 @@ pub enum LeaguePlayerStatus {
/// The player requested to join but got denied by the league owner
Denied,
/// The player joined either by getting accepted or by joining an open league
/// Active group (Can only have one at a time)
Joined,
/// The player is requesting to join a league
/// Active group (Can only have one at a time)
#[default]
Requested,
/// The player was already in a league and was kicked out.
@ -49,35 +47,7 @@ impl FromStr for LeaguePlayerStatus {
"Left" => Ok(Self::Requested),
"Invited" => Ok(Self::Invited),
"Canceled" => Ok(Self::Canceled),
_ => Err(Error::Unspecified),
_ => Err(Error::Unspecified) //TODO: Create ParseStr error in actix_web_utils
}
}
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub enum StatusType {
/// Inside a league
Active,
/// Either outside of a league, or attempting to join
Inactive,
}
impl LeaguePlayerStatus {
pub fn get_status_type(&self) -> StatusType {
match self {
LeaguePlayerStatus::Denied => StatusType::Inactive,
LeaguePlayerStatus::Joined => StatusType::Active,
LeaguePlayerStatus::Requested => StatusType::Active,
LeaguePlayerStatus::Kicked => StatusType::Inactive,
LeaguePlayerStatus::Left => StatusType::Inactive,
LeaguePlayerStatus::Invited => StatusType::Inactive,
LeaguePlayerStatus::Canceled => StatusType::Inactive,
}
}
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub enum ApprovalStatus {
Approved,
Denied,
}

View File

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

View File

@ -1,24 +0,0 @@
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 }
}
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, PartialOrd, Ord, Default)]
pub struct PlayerIds {
pub ids: Vec<u32>
}