From 025db35b9a3caf5c5a1a646553cac7e2a1b6fce9 Mon Sep 17 00:00:00 2001 From: Franklin Date: Sun, 19 Mar 2023 11:29:24 -0400 Subject: [PATCH] Adjusted filters --- src/domain/project.rs | 14 ++++++-------- src/domain/project_state/mod.rs | 3 ++- src/domain/project_type/mod.rs | 1 - src/dto/filters.rs | 3 --- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/domain/project.rs b/src/domain/project.rs index 571fa6d..6ad330f 100644 --- a/src/domain/project.rs +++ b/src/domain/project.rs @@ -1,34 +1,32 @@ -use chrono::{DateTime, Utc}; +use chrono::{DateTime, Utc, NaiveDateTime}; use serde::{Serialize, Deserialize}; use uuid::Uuid; -use super::{media::MediaList, project_type::ProjectType, project_condition::ProjectCondition}; +use super::{media::MediaList, project_type::ProjectType, project_condition::ProjectCondition, project_state::ProjectState}; #[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct Project { pub id: Uuid, - + #[serde(rename = "projectState")] + pub project_state: ProjectState, #[serde(rename = "projectType")] pub project_type: ProjectType, #[serde(rename = "projectCondition")] pub project_condition: ProjectCondition, - #[serde(rename = "agentId")] pub agent_id: Uuid, #[serde(rename = "locationId")] pub location_id: Uuid, - /// Title is optional as the agent can choose not to put the title there (in that case the title will be generated in the frontend) pub title: Option, pub description: String, - #[serde(rename = "adminTag", skip_serializing_if = "Option::is_none")] pub admin_tag: Option, - + #[serde(rename = "finishDate")] + pub finish_date: NaiveDateTime, /// Amount of floors the building/house has pub floors: i16, pub media: MediaList, - #[serde(rename = "timeCreated")] pub time_created: DateTime, #[serde(rename = "lastUpdated")] diff --git a/src/domain/project_state/mod.rs b/src/domain/project_state/mod.rs index 200467d..e77167d 100644 --- a/src/domain/project_state/mod.rs +++ b/src/domain/project_state/mod.rs @@ -6,8 +6,9 @@ use serde::{Deserialize, Serialize}; use super::error::Error; -#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default)] pub enum ProjectState { + #[default] Finished, InConstruction, } diff --git a/src/domain/project_type/mod.rs b/src/domain/project_type/mod.rs index d649f4b..a25a8c2 100644 --- a/src/domain/project_type/mod.rs +++ b/src/domain/project_type/mod.rs @@ -16,7 +16,6 @@ pub enum ProjectType { Solar, } -#[allow(unused)] impl Display for ProjectType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { diff --git a/src/dto/filters.rs b/src/dto/filters.rs index fa71922..79e596f 100644 --- a/src/dto/filters.rs +++ b/src/dto/filters.rs @@ -5,9 +5,6 @@ use crate::domain::{project_type::ProjectType, project_condition::ProjectConditi #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, PartialOrd)] pub enum Filter { - CheaperThan(f64), - MoreExpensiveThan(f64), - InCity(String), InDistrict(String),