Removed Yew from types and added description to units

This commit is contained in:
Franklin 2023-03-19 10:21:53 -04:00
parent 8f8e349df6
commit 9d3adca4d3
3 changed files with 5 additions and 9 deletions

View File

@ -4,7 +4,6 @@ use uuid::Uuid;
use super::{media::MediaList, project_type::ProjectType, project_condition::ProjectCondition}; use super::{media::MediaList, project_type::ProjectType, project_condition::ProjectCondition};
#[cfg_attr(feature = "yew", derive(yew::Properties))]
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord)] #[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct Project { pub struct Project {
pub id: Uuid, pub id: Uuid,

View File

@ -15,8 +15,8 @@ pub enum ProjectState {
impl Display for ProjectState { impl Display for ProjectState {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self { match self {
ProjectState::Finished => write!(f, "Terminado"), ProjectState::Finished => write!(f, "Finished"),
ProjectState::InConstruction => write!(f, "En construcción"), ProjectState::InConstruction => write!(f, "InConstruction"),
} }
} }
} }
@ -26,8 +26,8 @@ impl FromStr for ProjectState {
fn from_str(s: &str) -> Result<Self, Self::Err> { fn from_str(s: &str) -> Result<Self, Self::Err> {
match s { match s {
"Terminado" => Ok(Self::Finished), "Finished" => Ok(Self::Finished),
"En construcción" => Ok(Self::InConstruction), "InConstruction" => Ok(Self::InConstruction),
_ => Err(Error::Parsing), _ => Err(Error::Parsing),
} }
} }

View File

@ -7,19 +7,16 @@ use uuid::Uuid;
use super::{unit_type::UnitType, media::MediaList}; use super::{unit_type::UnitType, media::MediaList};
#[cfg_attr(feature = "yew", derive(yew::Properties))]
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, PartialOrd)] #[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, PartialOrd)]
pub struct Unit { pub struct Unit {
pub id: Uuid, pub id: Uuid,
#[serde(rename = "projectId")] #[serde(rename = "projectId")]
pub project_id: Uuid, pub project_id: Uuid,
/// Let the client convert from usd to whatever currency /// Let the client convert from usd to whatever currency
#[serde(rename = "priceUsd")] #[serde(rename = "priceUsd")]
pub price_usd: f64, pub price_usd: f64,
#[serde(rename = "unitType")] #[serde(rename = "unitType")]
pub unit_type: UnitType, pub unit_type: UnitType,
/// Amount of rooms in unit /// Amount of rooms in unit
pub rooms: i16, pub rooms: i16,
/// Amount of bathrooms in unit /// Amount of bathrooms in unit
@ -28,7 +25,7 @@ pub struct Unit {
pub area: f32, pub area: f32,
pub description: String, pub description: String,
pub media: MediaList, pub media: MediaList,
pub admin_tag: Option<String>,
#[serde(rename = "timeCreated")] #[serde(rename = "timeCreated")]
pub time_created: DateTime<Utc>, pub time_created: DateTime<Utc>,
#[serde(rename = "lastUpdated")] #[serde(rename = "lastUpdated")]