From d305f968794165bad3a343627c641ea355662207 Mon Sep 17 00:00:00 2001 From: Franklin Date: Wed, 3 May 2023 13:24:55 -0400 Subject: [PATCH] Added extra fields to both project and property --- src/domain/project.rs | 16 +++++++++++----- src/domain/property.rs | 14 +++++++++++--- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/domain/project.rs b/src/domain/project.rs index f4113be..b3a0cf9 100644 --- a/src/domain/project.rs +++ b/src/domain/project.rs @@ -2,22 +2,28 @@ use chrono::{DateTime, Utc}; 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, 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, /// 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, #[serde(rename = "lastUpdated")] diff --git a/src/domain/property.rs b/src/domain/property.rs index 10644c3..e517525 100644 --- a/src/domain/property.rs +++ b/src/domain/property.rs @@ -2,19 +2,27 @@ 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)] pub struct Property { pub id: Uuid, - #[serde(rename = "projectId")] pub project_id: Option, #[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, + #[serde(skip_serializing_if = "Option::is_none")] + pub city: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub district: Option, #[serde(rename = "timeCreated")] pub time_created: DateTime, #[serde(rename = "lastUpdated")]