Added derive impls to most objs

This commit is contained in:
Franklin 2023-01-21 16:32:33 -04:00
parent 3b3ffde695
commit 6d2814e8ee
3 changed files with 5 additions and 6 deletions

View File

@ -9,7 +9,6 @@ readme = "README.md"
repository = "https://github.com/franklinblanco/user-dtos.git" repository = "https://github.com/franklinblanco/user-dtos.git"
[lib] [lib]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }

View File

@ -1,7 +1,7 @@
use std::fmt::Display; use std::fmt::Display;
use serde::{Serialize, Deserialize}; use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub enum CredentialType { pub enum CredentialType {
PhoneNumber, PhoneNumber,
Email Email

View File

@ -2,7 +2,7 @@ use serde::{Serialize, Deserialize};
use crate::domain::user::credential_type::CredentialType; use crate::domain::user::credential_type::CredentialType;
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct UserForCreationDto{ pub struct UserForCreationDto{
#[serde(default = "get_default_app")] #[serde(default = "get_default_app")]
pub app: String, pub app: String,
@ -12,7 +12,7 @@ pub struct UserForCreationDto{
pub password: String, pub password: String,
pub name: String pub name: String
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct UserForLoginDto { pub struct UserForLoginDto {
#[serde(default = "get_default_app")] #[serde(default = "get_default_app")]
pub app: String, pub app: String,
@ -21,7 +21,7 @@ pub struct UserForLoginDto{
pub credential_type: CredentialType, pub credential_type: CredentialType,
pub password: String pub password: String
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct UserForAuthenticationDto{ pub struct UserForAuthenticationDto{
#[serde(default = "get_default_app")] #[serde(default = "get_default_app")]
pub app: String, pub app: String,