From 9ca2b8ab85d44bf07e3265dcc5e048c2fd11fa0b Mon Sep 17 00:00:00 2001 From: Franklin Date: Fri, 14 Apr 2023 16:53:29 -0400 Subject: [PATCH] Added contactPayload --- src/dto/payloads/contact.rs | 18 ++++++++++++++++++ src/dto/payloads/mod.rs | 1 + 2 files changed, 19 insertions(+) create mode 100644 src/dto/payloads/contact.rs diff --git a/src/dto/payloads/contact.rs b/src/dto/payloads/contact.rs new file mode 100644 index 0000000..7155b7b --- /dev/null +++ b/src/dto/payloads/contact.rs @@ -0,0 +1,18 @@ +use serde::{Serialize, Deserialize}; + +use crate::domain::contact::Contact; + + +#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord)] +pub struct ContactPayload { + pub first_name: String, + pub last_name: String, + pub credential: String, + pub message: String, +} + +impl From for Contact { + fn from(value: ContactPayload) -> Self { + Self::new(value.first_name, value.last_name, value.credential, value.message) + } +} \ No newline at end of file diff --git a/src/dto/payloads/mod.rs b/src/dto/payloads/mod.rs index 404583c..f7cd36a 100644 --- a/src/dto/payloads/mod.rs +++ b/src/dto/payloads/mod.rs @@ -2,3 +2,4 @@ pub mod agent; pub mod location; pub mod project; pub mod unit; +pub mod contact; \ No newline at end of file