Cargo fmt

This commit is contained in:
Franklin 2023-05-04 11:26:14 -04:00
parent 7f6e33eeb9
commit bf818bb408
21 changed files with 45 additions and 47 deletions

View File

@ -1,5 +1,5 @@
use chrono::{DateTime, Utc};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use uuid::Uuid;
use super::clickable::Clickable;
@ -14,5 +14,5 @@ pub struct Click {
#[serde(rename = "trackableId")]
pub trackable_id: Uuid,
#[serde(rename = "timeCreated")]
pub time_created: DateTime<Utc>
}
pub time_created: DateTime<Utc>,
}

View File

@ -32,4 +32,4 @@ impl sqlx::Type<Postgres> for Clickable {
fn compatible(ty: &<Postgres as sqlx::Database>::TypeInfo) -> bool {
*ty == Self::type_info()
}
}
}

View File

@ -13,4 +13,4 @@ impl Default for Clickable {
fn default() -> Self {
Self::Contact(String::default())
}
}
}

View File

@ -1,6 +1,5 @@
use std::fmt::Display;
#[derive(Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
pub struct FromStrError;
@ -10,4 +9,4 @@ impl Display for FromStrError {
}
}
impl std::error::Error for FromStrError {}
impl std::error::Error for FromStrError {}

View File

@ -1,16 +1,16 @@
pub mod property;
pub mod realtor;
pub mod view;
pub mod project;
pub mod media;
pub mod thing_pk;
pub mod click;
pub mod clickable;
pub mod trackable;
pub mod media;
pub mod project;
pub mod project_condition;
pub mod project_state;
pub mod property;
pub mod property_sale_type;
pub mod property_type;
pub mod realtor;
pub mod thing_pk;
pub mod trackable;
pub mod view;
pub mod error;
pub mod project_type;

View File

@ -1,8 +1,11 @@
use chrono::{DateTime, Utc, NaiveDate};
use serde::{Serialize, Deserialize};
use chrono::{DateTime, NaiveDate, Utc};
use serde::{Deserialize, Serialize};
use uuid::Uuid;
use super::{media::MediaList, project_condition::ProjectCondition, project_type::ProjectType, 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 {
@ -26,11 +29,11 @@ pub struct Project {
pub floors: i16,
#[serde(rename = "finishDate")]
pub finish_date: NaiveDate,
/// This gives the realtor the option to order the projects/properties. On birth,
/// This gives the realtor the option to order the projects/properties. On birth,
#[serde(rename = "orderIndex")]
pub order_index: i32,
#[serde(rename = "timeCreated")]
pub time_created: DateTime<Utc>,
#[serde(rename = "lastUpdated")]
pub last_updated: DateTime<Utc>
}
pub last_updated: DateTime<Utc>,
}

View File

@ -2,7 +2,7 @@ use std::{fmt::Display, str::FromStr};
use serde::{Deserialize, Serialize};
use super::error::{FromStrError};
use super::error::FromStrError;
#[cfg(feature = "sqlx")]
pub mod impls;

View File

@ -4,7 +4,7 @@ use std::{fmt::Display, str::FromStr};
use serde::{Deserialize, Serialize};
use super::error::{FromStrError};
use super::error::FromStrError;
#[derive(Serialize, Deserialize, Debug, Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord)]
pub enum ProjectType {
@ -19,7 +19,6 @@ pub enum ProjectType {
Housing,
/// Fields (cap cana, pc, quintas)
Project,
}
impl Display for ProjectType {

View File

@ -1,8 +1,8 @@
use chrono::{DateTime, Utc};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use uuid::Uuid;
use super::{media::MediaList, property_type::PropertyType, property_sale_type::PropertySaleType};
use super::{media::MediaList, property_sale_type::PropertySaleType, property_type::PropertyType};
/// A property can belong to a project, or not. It should always belong to a realtor.
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, PartialOrd)]
@ -36,5 +36,5 @@ pub struct Property {
#[serde(rename = "timeCreated")]
pub time_created: DateTime<Utc>,
#[serde(rename = "lastUpdated")]
pub last_updated: DateTime<Utc>
}
pub last_updated: DateTime<Utc>,
}

View File

@ -1,5 +1,5 @@
use chrono::{DateTime, Utc};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use uuid::Uuid;
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord)]
@ -21,4 +21,4 @@ pub struct Realtor {
pub time_created: DateTime<Utc>,
#[serde(rename = "lastUpdated")]
pub last_updated: DateTime<Utc>,
}
}

View File

@ -1,4 +1,4 @@
use std::{str::FromStr, fmt::Display};
use std::{fmt::Display, str::FromStr};
use sqlx::{
encode::IsNull,
@ -11,7 +11,6 @@ use crate::domain::error::FromStrError;
use super::ThingPk;
impl Display for ThingPk {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
@ -30,7 +29,7 @@ impl FromStr for ThingPk {
"Project" => Ok(Self::Project),
"Realtor" => Ok(Self::Realtor),
"Property" => Ok(Self::Property),
_ => Err(FromStrError)
_ => Err(FromStrError),
}
}
}
@ -61,4 +60,4 @@ impl sqlx::Type<Postgres> for ThingPk {
fn compatible(ty: &<Postgres as sqlx::Database>::TypeInfo) -> bool {
*ty == Self::type_info()
}
}
}

View File

@ -8,4 +8,4 @@ pub enum ThingPk {
Realtor,
Property,
Project,
}
}

View File

@ -1,5 +1,5 @@
use chrono::{DateTime, Utc};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use uuid::Uuid;
/// A user that can be tracked. All the info that you can gather from the user based on their browser & IP network.
@ -21,4 +21,4 @@ pub struct Trackable {
#[serde(rename = "userAgent")]
pub user_agent: String,
pub time_created: DateTime<Utc>,
}
}

View File

@ -1,5 +1,5 @@
use chrono::{DateTime, Utc};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use uuid::Uuid;
use super::thing_pk::ThingPk;
@ -14,5 +14,5 @@ pub struct View {
#[serde(rename = "trackableId")]
pub trackable_id: Uuid,
#[serde(rename = "timeCreated")]
pub time_created: DateTime<Utc>
}
pub time_created: DateTime<Utc>,
}

View File

@ -1 +1 @@
pub mod payloads;
pub mod payloads;

View File

@ -0,0 +1 @@

View File

@ -1,3 +1,3 @@
pub mod domain;
pub mod dto;
pub mod traits;
pub mod traits;

View File

@ -1 +1 @@
pub mod readable;
pub mod readable;

View File

@ -1,3 +1 @@
//use crate::traits::readable::Readable;

View File

@ -1,2 +1,2 @@
pub mod impls;
pub mod readable;
pub mod impls;

View File

@ -1,4 +1,3 @@
pub trait Readable {
fn to_human_readable(&self) -> String;
}
}