Adjusted filters
This commit is contained in:
parent
edc5267cbd
commit
025db35b9a
|
@ -1,34 +1,32 @@
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc, NaiveDateTime};
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Serialize, Deserialize};
|
||||||
use uuid::Uuid;
|
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)]
|
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
pub struct Project {
|
pub struct Project {
|
||||||
pub id: Uuid,
|
pub id: Uuid,
|
||||||
|
#[serde(rename = "projectState")]
|
||||||
|
pub project_state: ProjectState,
|
||||||
#[serde(rename = "projectType")]
|
#[serde(rename = "projectType")]
|
||||||
pub project_type: ProjectType,
|
pub project_type: ProjectType,
|
||||||
#[serde(rename = "projectCondition")]
|
#[serde(rename = "projectCondition")]
|
||||||
pub project_condition: ProjectCondition,
|
pub project_condition: ProjectCondition,
|
||||||
|
|
||||||
#[serde(rename = "agentId")]
|
#[serde(rename = "agentId")]
|
||||||
pub agent_id: Uuid,
|
pub agent_id: Uuid,
|
||||||
#[serde(rename = "locationId")]
|
#[serde(rename = "locationId")]
|
||||||
pub location_id: Uuid,
|
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)
|
/// 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<String>,
|
pub title: Option<String>,
|
||||||
pub description: String,
|
pub description: String,
|
||||||
|
|
||||||
#[serde(rename = "adminTag", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "adminTag", skip_serializing_if = "Option::is_none")]
|
||||||
pub admin_tag: Option<String>,
|
pub admin_tag: Option<String>,
|
||||||
|
#[serde(rename = "finishDate")]
|
||||||
|
pub finish_date: NaiveDateTime,
|
||||||
/// Amount of floors the building/house has
|
/// Amount of floors the building/house has
|
||||||
pub floors: i16,
|
pub floors: i16,
|
||||||
pub media: MediaList,
|
pub media: MediaList,
|
||||||
|
|
||||||
#[serde(rename = "timeCreated")]
|
#[serde(rename = "timeCreated")]
|
||||||
pub time_created: DateTime<Utc>,
|
pub time_created: DateTime<Utc>,
|
||||||
#[serde(rename = "lastUpdated")]
|
#[serde(rename = "lastUpdated")]
|
||||||
|
|
|
@ -6,8 +6,9 @@ use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use super::error::Error;
|
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 {
|
pub enum ProjectState {
|
||||||
|
#[default]
|
||||||
Finished,
|
Finished,
|
||||||
InConstruction,
|
InConstruction,
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ pub enum ProjectType {
|
||||||
Solar,
|
Solar,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused)]
|
|
||||||
impl Display for ProjectType {
|
impl Display for ProjectType {
|
||||||
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 {
|
||||||
|
|
|
@ -5,9 +5,6 @@ use crate::domain::{project_type::ProjectType, project_condition::ProjectConditi
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, PartialOrd)]
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, PartialOrd)]
|
||||||
pub enum Filter {
|
pub enum Filter {
|
||||||
CheaperThan(f64),
|
|
||||||
MoreExpensiveThan(f64),
|
|
||||||
|
|
||||||
InCity(String),
|
InCity(String),
|
||||||
InDistrict(String),
|
InDistrict(String),
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue