Changed filters and added item for s3 image upload requests on backend

This commit is contained in:
Franklin 2023-04-23 11:07:15 -04:00
parent 15200df989
commit 82589a4d4d
5 changed files with 25 additions and 5 deletions

View File

@ -16,8 +16,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, "Finished"),
ProjectState::InConstruction => write!(f, "InConstruction"),
ProjectState::Finished => write!(f, "Terminado"),
ProjectState::InConstruction => write!(f, "En Construcción"),
}
}
}
@ -27,8 +27,8 @@ impl FromStr for ProjectState {
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"Finished" => Ok(Self::Finished),
"InConstruction" => Ok(Self::InConstruction),
"Terminado" => Ok(Self::Finished),
"En Construcción" => Ok(Self::InConstruction),
_ => Err(Error::Parsing),
}
}

View File

@ -8,6 +8,7 @@ pub enum Filter {
InDistrict(String),
Finished,
InConstruction,
ByProjectType(ProjectType),
ByProjectCondition(ProjectCondition),
ByRoomCount(i32),
@ -19,6 +20,7 @@ impl Filter {
Filter::InCity(city) => (String::from("incity"), city),
Filter::InDistrict(district) => (String::from("indistrict"), district),
Filter::Finished => (String::from("finished"), String::from("true")),
Filter::InConstruction => (String::from("inconstruction"), String::from("true")),
Filter::ByProjectType(project_type) => (String::from("byprojecttype"), project_type.to_string()),
Filter::ByProjectCondition(project_condition) => (String::from("byprojectcondition"), project_condition.to_string()),
Filter::ByRoomCount(room_count) => (String::from("byroomcount"), room_count.to_string()),

9
src/dto/item.rs Normal file
View File

@ -0,0 +1,9 @@
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, PartialOrd, Ord, Default)]
pub enum Item {
#[default]
Project,
Unit,
Agent,
}

View File

@ -1,4 +1,5 @@
pub mod filters;
pub mod payloads;
pub mod listing;
pub mod project_card;
pub mod project_card;
pub mod item;

View File

@ -1,3 +1,5 @@
use std::fmt::Display;
use chrono::Utc;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
@ -63,3 +65,9 @@ impl UpdateAgentPayload {
persisted_agent.last_updated = Utc::now();
}
}
impl Display for Agent {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.full_name)
}
}