From 9a37e9c278326db4b74d54e72271644abe4b31b0 Mon Sep 17 00:00:00 2001 From: Franklin Date: Sun, 19 Mar 2023 11:29:47 -0400 Subject: [PATCH] Cargo fmt --- src/domain/agent.rs | 7 +++---- src/domain/credential/impls.rs | 7 ++++++- src/domain/credential/mod.rs | 4 ++-- src/domain/error.rs | 9 +++------ src/domain/location.rs | 4 ++-- src/domain/media/impls.rs | 9 ++++++--- src/domain/media/mod.rs | 2 +- src/domain/mod.rs | 16 ++++++++-------- src/domain/option_wrapper.rs | 16 ++++++++++------ src/domain/project.rs | 11 +++++++---- src/domain/project_condition/impls.rs | 8 ++++++-- src/domain/project_condition/mod.rs | 4 ++-- src/domain/project_state/impls.rs | 7 ++++++- src/domain/project_state/mod.rs | 4 ++-- src/domain/project_type/impls.rs | 10 +++++++--- src/domain/project_type/mod.rs | 4 ++-- src/domain/unit.rs | 9 +++------ src/domain/unit_type/impls.rs | 7 ++++++- src/domain/unit_type/mod.rs | 4 ++-- src/dto/filters.rs | 5 ++--- src/dto/mod.rs | 2 +- src/lib.rs | 2 +- 22 files changed, 88 insertions(+), 63 deletions(-) diff --git a/src/domain/agent.rs b/src/domain/agent.rs index 20b5a17..b5a8b65 100644 --- a/src/domain/agent.rs +++ b/src/domain/agent.rs @@ -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, #[serde(rename = "lastUpdated")] pub last_updated: DateTime, -} \ No newline at end of file +} diff --git a/src/domain/credential/impls.rs b/src/domain/credential/impls.rs index f1e9b83..45e93ec 100644 --- a/src/domain/credential/impls.rs +++ b/src/domain/credential/impls.rs @@ -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; diff --git a/src/domain/credential/mod.rs b/src/domain/credential/mod.rs index e77c102..64e076a 100644 --- a/src/domain/credential/mod.rs +++ b/src/domain/credential/mod.rs @@ -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), } } -} \ No newline at end of file +} diff --git a/src/domain/error.rs b/src/domain/error.rs index 59556e6..d758c2e 100644 --- a/src/domain/error.rs +++ b/src/domain/error.rs @@ -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 { - -} \ No newline at end of file +impl std::error::Error for Error {} diff --git a/src/domain/location.rs b/src/domain/location.rs index c705f5d..11b2fe4 100644 --- a/src/domain/location.rs +++ b/src/domain/location.rs @@ -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, -} \ No newline at end of file +} diff --git a/src/domain/media/impls.rs b/src/domain/media/impls.rs index 68a5588..acce128 100644 --- a/src/domain/media/impls.rs +++ b/src/domain/media/impls.rs @@ -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 for MediaList { *ty == Self::type_info() } } - - diff --git a/src/domain/media/mod.rs b/src/domain/media/mod.rs index dc04ba8..eb7a3da 100644 --- a/src/domain/media/mod.rs +++ b/src/domain/media/mod.rs @@ -13,4 +13,4 @@ pub enum Media { pub struct MediaList { #[serde(rename = "mediaList")] pub media_list: Vec, -} \ No newline at end of file +} diff --git a/src/domain/mod.rs b/src/domain/mod.rs index b65d246..54d1bbf 100644 --- a/src/domain/mod.rs +++ b/src/domain/mod.rs @@ -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; \ No newline at end of file diff --git a/src/domain/option_wrapper.rs b/src/domain/option_wrapper.rs index 20900ec..14e15ad 100644 --- a/src/domain/option_wrapper.rs +++ b/src/domain/option_wrapper.rs @@ -2,15 +2,19 @@ use std::fmt::Display; #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)] pub struct OptionWrapper { - pub option: Option + pub option: Option, } impl Display for OptionWrapper { 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 OptionWrapper { pub fn new(option: Option) -> Self { Self { option } } -} \ No newline at end of file +} diff --git a/src/domain/project.rs b/src/domain/project.rs index 6ad330f..d68d452 100644 --- a/src/domain/project.rs +++ b/src/domain/project.rs @@ -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, #[serde(rename = "lastUpdated")] pub last_updated: DateTime, -} \ No newline at end of file +} diff --git a/src/domain/project_condition/impls.rs b/src/domain/project_condition/impls.rs index 3e4679a..b041223 100644 --- a/src/domain/project_condition/impls.rs +++ b/src/domain/project_condition/impls.rs @@ -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; diff --git a/src/domain/project_condition/mod.rs b/src/domain/project_condition/mod.rs index 5e74116..4d10527 100644 --- a/src/domain/project_condition/mod.rs +++ b/src/domain/project_condition/mod.rs @@ -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), } } -} \ No newline at end of file +} diff --git a/src/domain/project_state/impls.rs b/src/domain/project_state/impls.rs index f6aeb36..2fe917e 100644 --- a/src/domain/project_state/impls.rs +++ b/src/domain/project_state/impls.rs @@ -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; diff --git a/src/domain/project_state/mod.rs b/src/domain/project_state/mod.rs index e77167d..d60fddb 100644 --- a/src/domain/project_state/mod.rs +++ b/src/domain/project_state/mod.rs @@ -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), } } -} \ No newline at end of file +} diff --git a/src/domain/project_type/impls.rs b/src/domain/project_type/impls.rs index 4671f9b..16696d7 100644 --- a/src/domain/project_type/impls.rs +++ b/src/domain/project_type/impls.rs @@ -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 { diff --git a/src/domain/project_type/mod.rs b/src/domain/project_type/mod.rs index a25a8c2..5bf0cd4 100644 --- a/src/domain/project_type/mod.rs +++ b/src/domain/project_type/mod.rs @@ -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), } } -} \ No newline at end of file +} diff --git a/src/domain/unit.rs b/src/domain/unit.rs index 6bfe7c1..7427afb 100644 --- a/src/domain/unit.rs +++ b/src/domain/unit.rs @@ -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, #[serde(rename = "lastUpdated")] pub last_updated: DateTime, -} \ No newline at end of file +} diff --git a/src/domain/unit_type/impls.rs b/src/domain/unit_type/impls.rs index c10b488..1602b44 100644 --- a/src/domain/unit_type/impls.rs +++ b/src/domain/unit_type/impls.rs @@ -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; diff --git a/src/domain/unit_type/mod.rs b/src/domain/unit_type/mod.rs index f0b4914..9d035c2 100644 --- a/src/domain/unit_type/mod.rs +++ b/src/domain/unit_type/mod.rs @@ -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), } } -} \ No newline at end of file +} diff --git a/src/dto/filters.rs b/src/dto/filters.rs index 79e596f..1f2461a 100644 --- a/src/dto/filters.rs +++ b/src/dto/filters.rs @@ -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), -} \ No newline at end of file +} diff --git a/src/dto/mod.rs b/src/dto/mod.rs index 994d55f..2589ce3 100644 --- a/src/dto/mod.rs +++ b/src/dto/mod.rs @@ -1 +1 @@ -pub mod filters; \ No newline at end of file +pub mod filters; diff --git a/src/lib.rs b/src/lib.rs index 39113e4..432e48e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,2 +1,2 @@ pub mod domain; -pub mod dto; \ No newline at end of file +pub mod dto;