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};
#[cfg_attr(feature = "yew", derive(yew::Properties))]
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct Project {
pub id: Uuid,

View File

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

View File

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