Cargo fmt
This commit is contained in:
parent
025db35b9a
commit
9a37e9c278
@ -1,16 +1,15 @@
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Serialize, Deserialize};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
use super::credential::CredentialType;
|
||||
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct Agent {
|
||||
pub id: Uuid,
|
||||
#[serde(rename = "fullName")]
|
||||
pub full_name: String,
|
||||
|
||||
|
||||
pub credential: String,
|
||||
#[serde(rename = "credentialType")]
|
||||
pub credential_type: CredentialType,
|
||||
@ -19,4 +18,4 @@ pub struct Agent {
|
||||
pub time_created: DateTime<Utc>,
|
||||
#[serde(rename = "lastUpdated")]
|
||||
pub last_updated: DateTime<Utc>,
|
||||
}
|
||||
}
|
||||
|
@ -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 std::str::FromStr;
|
||||
|
@ -1,8 +1,8 @@
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub mod impls;
|
||||
|
||||
use std::{fmt::Display, str::FromStr};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{fmt::Display, str::FromStr};
|
||||
|
||||
use super::error::Error;
|
||||
|
||||
@ -32,4 +32,4 @@ impl FromStr for CredentialType {
|
||||
_ => Err(Error::Parsing),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
use std::fmt::Display;
|
||||
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub enum Error {
|
||||
Parsing
|
||||
Parsing,
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||
@ -6,4 +6,4 @@ pub struct Location {
|
||||
pub id: Uuid,
|
||||
pub city: String,
|
||||
pub district: String,
|
||||
}
|
||||
}
|
||||
|
@ -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};
|
||||
|
||||
@ -55,5 +60,3 @@ impl sqlx::Type<Postgres> for MediaList {
|
||||
*ty == Self::type_info()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,4 +13,4 @@ pub enum Media {
|
||||
pub struct MediaList {
|
||||
#[serde(rename = "mediaList")]
|
||||
pub media_list: Vec<Media>,
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
pub mod project;
|
||||
pub mod location;
|
||||
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 unit;
|
||||
pub mod project_state;
|
||||
pub mod error;
|
||||
pub mod credential;
|
||||
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)]
|
||||
pub struct OptionWrapper<T: Display> {
|
||||
pub option: Option<T>
|
||||
pub option: Option<T>,
|
||||
}
|
||||
|
||||
impl<T: Display> Display for OptionWrapper<T> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}", match &self.option {
|
||||
Some(option_type) => option_type.to_string(),
|
||||
None => String::from("Todos"),
|
||||
})
|
||||
write!(
|
||||
f,
|
||||
"{}",
|
||||
match &self.option {
|
||||
Some(option_type) => option_type.to_string(),
|
||||
None => String::from("Todos"),
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,4 +22,4 @@ impl<T: Display> OptionWrapper<T> {
|
||||
pub fn new(option: Option<T>) -> Self {
|
||||
Self { option }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,11 @@
|
||||
use chrono::{DateTime, Utc, NaiveDateTime};
|
||||
use serde::{Serialize, Deserialize};
|
||||
use chrono::{DateTime, NaiveDateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
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)]
|
||||
pub struct Project {
|
||||
@ -31,4 +34,4 @@ pub struct Project {
|
||||
pub time_created: DateTime<Utc>,
|
||||
#[serde(rename = "lastUpdated")]
|
||||
pub last_updated: DateTime<Utc>,
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +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::ProjectCondition;
|
||||
use std::str::FromStr;
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::{fmt::Display, str::FromStr};
|
||||
|
||||
use serde::{Serialize, Deserialize};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::error::Error;
|
||||
|
||||
@ -31,4 +31,4 @@ impl FromStr for ProjectCondition {
|
||||
_ => Err(Error::Parsing),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 std::str::FromStr;
|
||||
|
@ -1,8 +1,8 @@
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub mod impls;
|
||||
|
||||
use std::{fmt::Display, str::FromStr};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{fmt::Display, str::FromStr};
|
||||
|
||||
use super::error::Error;
|
||||
|
||||
@ -32,4 +32,4 @@ impl FromStr for ProjectState {
|
||||
_ => Err(Error::Parsing),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
impl sqlx::Encode<'_, Postgres> for ProjectType {
|
||||
|
@ -2,7 +2,7 @@
|
||||
pub mod impls;
|
||||
use std::{fmt::Display, str::FromStr};
|
||||
|
||||
use serde::{Serialize, Deserialize};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::error::Error;
|
||||
|
||||
@ -41,4 +41,4 @@ impl FromStr for ProjectType {
|
||||
_ => Err(Error::Parsing),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,8 @@
|
||||
|
||||
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Serialize, Deserialize};
|
||||
use serde::{Deserialize, Serialize};
|
||||
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)]
|
||||
pub struct Unit {
|
||||
@ -30,4 +27,4 @@ pub struct Unit {
|
||||
pub time_created: DateTime<Utc>,
|
||||
#[serde(rename = "lastUpdated")]
|
||||
pub last_updated: DateTime<Utc>,
|
||||
}
|
||||
}
|
||||
|
@ -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 std::str::FromStr;
|
||||
|
@ -30,7 +30,7 @@ impl FromStr for UnitType {
|
||||
match s {
|
||||
"Para Venta" => Ok(Self::ForSale),
|
||||
"Área Común" => Ok(Self::NotForSale),
|
||||
_ => Err(Error::Parsing)
|
||||
_ => Err(Error::Parsing),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
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)]
|
||||
pub enum Filter {
|
||||
@ -11,4 +10,4 @@ pub enum Filter {
|
||||
Finished,
|
||||
ByProjectType(ProjectType),
|
||||
ByProjectCondition(ProjectCondition),
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
pub mod filters;
|
||||
pub mod filters;
|
||||
|
@ -1,2 +1,2 @@
|
||||
pub mod domain;
|
||||
pub mod dto;
|
||||
pub mod dto;
|
||||
|
Loading…
Reference in New Issue
Block a user