Cargo fmt
This commit is contained in:
parent
025db35b9a
commit
9a37e9c278
|
@ -1,10 +1,9 @@
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use super::credential::CredentialType;
|
use super::credential::CredentialType;
|
||||||
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
pub struct Agent {
|
pub struct Agent {
|
||||||
pub id: Uuid,
|
pub id: Uuid,
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
use sqlx::{Postgres, postgres::{PgValueRef, PgTypeInfo, PgArgumentBuffer}, error::BoxDynError, encode::IsNull};
|
use sqlx::{
|
||||||
|
encode::IsNull,
|
||||||
|
error::BoxDynError,
|
||||||
|
postgres::{PgArgumentBuffer, PgTypeInfo, PgValueRef},
|
||||||
|
Postgres,
|
||||||
|
};
|
||||||
|
|
||||||
use super::CredentialType;
|
use super::CredentialType;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#[cfg(feature = "sqlx")]
|
#[cfg(feature = "sqlx")]
|
||||||
pub mod impls;
|
pub mod impls;
|
||||||
|
|
||||||
use std::{fmt::Display, str::FromStr};
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::{fmt::Display, str::FromStr};
|
||||||
|
|
||||||
use super::error::Error;
|
use super::error::Error;
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
|
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
Parsing
|
Parsing,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for Error {
|
impl Display for Error {
|
||||||
|
@ -16,6 +15,4 @@ impl Display for Error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::error::Error for Error {
|
impl std::error::Error for Error {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
use sqlx::{Postgres, postgres::{PgValueRef, PgTypeInfo, PgArgumentBuffer}, error::BoxDynError, encode::IsNull};
|
use sqlx::{
|
||||||
|
encode::IsNull,
|
||||||
|
error::BoxDynError,
|
||||||
|
postgres::{PgArgumentBuffer, PgTypeInfo, PgValueRef},
|
||||||
|
Postgres,
|
||||||
|
};
|
||||||
|
|
||||||
use super::{Media, MediaList};
|
use super::{Media, MediaList};
|
||||||
|
|
||||||
|
@ -55,5 +60,3 @@ impl sqlx::Type<Postgres> for MediaList {
|
||||||
*ty == Self::type_info()
|
*ty == Self::type_info()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
pub mod project;
|
|
||||||
pub mod location;
|
|
||||||
pub mod agent;
|
pub mod agent;
|
||||||
|
pub mod credential;
|
||||||
|
pub mod error;
|
||||||
|
pub mod location;
|
||||||
|
pub mod media;
|
||||||
|
pub mod option_wrapper;
|
||||||
|
pub mod project;
|
||||||
|
pub mod project_condition;
|
||||||
|
pub mod project_state;
|
||||||
pub mod project_type;
|
pub mod project_type;
|
||||||
pub mod unit;
|
pub mod unit;
|
||||||
pub mod project_state;
|
|
||||||
pub mod error;
|
|
||||||
pub mod credential;
|
|
||||||
pub mod unit_type;
|
pub mod unit_type;
|
||||||
pub mod media;
|
|
||||||
pub mod project_condition;
|
|
||||||
pub mod option_wrapper;
|
|
|
@ -2,15 +2,19 @@ use std::fmt::Display;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)]
|
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)]
|
||||||
pub struct OptionWrapper<T: Display> {
|
pub struct OptionWrapper<T: Display> {
|
||||||
pub option: Option<T>
|
pub option: Option<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Display> Display for OptionWrapper<T> {
|
impl<T: Display> Display for OptionWrapper<T> {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
write!(f, "{}", match &self.option {
|
write!(
|
||||||
|
f,
|
||||||
|
"{}",
|
||||||
|
match &self.option {
|
||||||
Some(option_type) => option_type.to_string(),
|
Some(option_type) => option_type.to_string(),
|
||||||
None => String::from("Todos"),
|
None => String::from("Todos"),
|
||||||
})
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
use chrono::{DateTime, Utc, NaiveDateTime};
|
use chrono::{DateTime, NaiveDateTime, Utc};
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use super::{media::MediaList, project_type::ProjectType, project_condition::ProjectCondition, project_state::ProjectState};
|
use super::{
|
||||||
|
media::MediaList, project_condition::ProjectCondition, project_state::ProjectState,
|
||||||
|
project_type::ProjectType,
|
||||||
|
};
|
||||||
|
|
||||||
#[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 {
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
|
use sqlx::{
|
||||||
use sqlx::{Postgres, postgres::{PgValueRef, PgTypeInfo, PgArgumentBuffer}, error::BoxDynError, encode::IsNull};
|
encode::IsNull,
|
||||||
|
error::BoxDynError,
|
||||||
|
postgres::{PgArgumentBuffer, PgTypeInfo, PgValueRef},
|
||||||
|
Postgres,
|
||||||
|
};
|
||||||
|
|
||||||
use super::ProjectCondition;
|
use super::ProjectCondition;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::{fmt::Display, str::FromStr};
|
use std::{fmt::Display, str::FromStr};
|
||||||
|
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use super::error::Error;
|
use super::error::Error;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
use sqlx::{Postgres, postgres::{PgValueRef, PgTypeInfo, PgArgumentBuffer}, error::BoxDynError, encode::IsNull};
|
use sqlx::{
|
||||||
|
encode::IsNull,
|
||||||
|
error::BoxDynError,
|
||||||
|
postgres::{PgArgumentBuffer, PgTypeInfo, PgValueRef},
|
||||||
|
Postgres,
|
||||||
|
};
|
||||||
|
|
||||||
use super::ProjectState;
|
use super::ProjectState;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#[cfg(feature = "sqlx")]
|
#[cfg(feature = "sqlx")]
|
||||||
pub mod impls;
|
pub mod impls;
|
||||||
|
|
||||||
use std::{fmt::Display, str::FromStr};
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::{fmt::Display, str::FromStr};
|
||||||
|
|
||||||
use super::error::Error;
|
use super::error::Error;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
|
use sqlx::{
|
||||||
|
encode::IsNull,
|
||||||
|
error::BoxDynError,
|
||||||
|
postgres::{PgArgumentBuffer, PgTypeInfo, PgValueRef},
|
||||||
|
Postgres,
|
||||||
|
};
|
||||||
|
|
||||||
use sqlx::{Postgres, postgres::{PgValueRef, PgTypeInfo, PgArgumentBuffer}, error::BoxDynError, encode::IsNull};
|
use super::ProjectType;
|
||||||
|
|
||||||
use super::{ProjectType};
|
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
impl sqlx::Encode<'_, Postgres> for ProjectType {
|
impl sqlx::Encode<'_, Postgres> for ProjectType {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
pub mod impls;
|
pub mod impls;
|
||||||
use std::{fmt::Display, str::FromStr};
|
use std::{fmt::Display, str::FromStr};
|
||||||
|
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use super::error::Error;
|
use super::error::Error;
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
|
|
||||||
|
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use super::{unit_type::UnitType, media::MediaList};
|
use super::{media::MediaList, unit_type::UnitType};
|
||||||
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, PartialOrd)]
|
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, PartialOrd)]
|
||||||
pub struct Unit {
|
pub struct Unit {
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
use sqlx::{Postgres, postgres::{PgValueRef, PgTypeInfo, PgArgumentBuffer}, error::BoxDynError, encode::IsNull};
|
use sqlx::{
|
||||||
|
encode::IsNull,
|
||||||
|
error::BoxDynError,
|
||||||
|
postgres::{PgArgumentBuffer, PgTypeInfo, PgValueRef},
|
||||||
|
Postgres,
|
||||||
|
};
|
||||||
|
|
||||||
use super::UnitType;
|
use super::UnitType;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
|
@ -30,7 +30,7 @@ impl FromStr for UnitType {
|
||||||
match s {
|
match s {
|
||||||
"Para Venta" => Ok(Self::ForSale),
|
"Para Venta" => Ok(Self::ForSale),
|
||||||
"Área Común" => Ok(Self::NotForSale),
|
"Área Común" => Ok(Self::NotForSale),
|
||||||
_ => Err(Error::Parsing)
|
_ => Err(Error::Parsing),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::domain::{project_type::ProjectType, project_condition::ProjectCondition};
|
use crate::domain::{project_condition::ProjectCondition, project_type::ProjectType};
|
||||||
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, PartialOrd)]
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, PartialOrd)]
|
||||||
pub enum Filter {
|
pub enum Filter {
|
||||||
|
|
Loading…
Reference in New Issue