Compare commits

..

2 Commits

Author SHA1 Message Date
Franklin 3cdcfa32ec Added even more fields to proj and prop 2023-05-03 13:27:34 -04:00
Franklin d305f96879 Added extra fields to both project and property 2023-05-03 13:24:55 -04:00
2 changed files with 37 additions and 10 deletions

View File

@ -1,23 +1,34 @@
use chrono::{DateTime, Utc};
use chrono::{DateTime, Utc, NaiveDateTime};
use serde::{Serialize, Deserialize};
use uuid::Uuid;
use super::media::MediaList;
use super::{media::MediaList, project_condition::ProjectCondition, project_type::ProjectType, project_state::ProjectState};
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct Project {
pub id: Uuid,
pub title: Option<String>,
pub description: String,
#[serde(rename = "realtorId")]
pub realtor_id: Uuid,
pub media: MediaList,
#[serde(rename = "projectCondition")]
pub project_condition: ProjectCondition,
#[serde(rename = "projectType")]
pub project_type: ProjectType,
#[serde(rename = "projectState")]
pub project_state: ProjectState,
pub country: String,
pub city: String,
pub district: String,
#[serde(rename = "adminTag", skip_serializing_if = "Option::is_none")]
pub admin_tag: Option<String>,
pub floors: i16,
#[serde(rename = "finishDate")]
pub finish_date: NaiveDateTime,
/// This gives the realtor the option to order the projects/properties. On birth,
#[serde(rename = "orderIndex")]
pub order_index: i32,
pub order_index: u16,
#[serde(rename = "timeCreated")]
pub time_created: DateTime<Utc>,
#[serde(rename = "lastUpdated")]

View File

@ -2,19 +2,35 @@ use chrono::{DateTime, Utc};
use serde::{Serialize, Deserialize};
use uuid::Uuid;
use super::media::MediaList;
use super::{media::MediaList, property_type::PropertyType, property_sale_type::PropertySaleType};
/// A property can belong to a project, or not. It should always belong to a realtor.
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, PartialOrd)]
pub struct Property {
pub id: Uuid,
#[serde(rename = "projectId")]
pub project_id: Option<Uuid>,
#[serde(rename = "realtorId")]
pub realtor_id: Uuid,
pub media: MediaList,
#[serde(rename = "propertyType")]
pub property_type: PropertyType,
#[serde(rename = "propertySaleType")]
pub property_sale_type: PropertySaleType,
#[serde(skip_serializing_if = "Option::is_none")]
pub country: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub city: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub district: Option<String>,
#[serde(rename = "priceUsd")]
pub price_usd: f64,
/// Amount of rooms in unit
pub rooms: i16,
/// Amount of bathrooms in unit
pub bathrooms: f32,
/// In meters squared
pub area: f32,
#[serde(rename = "timeCreated")]
pub time_created: DateTime<Utc>,
#[serde(rename = "lastUpdated")]