From d080ece9c19af849bd18c1c0d774b459a61857e0 Mon Sep 17 00:00:00 2001 From: Franklin Date: Fri, 14 Apr 2023 16:36:40 -0400 Subject: [PATCH] Added contact struct --- src/domain/contact.rs | 19 +++++++++++++++++++ src/domain/mod.rs | 3 ++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/domain/contact.rs diff --git a/src/domain/contact.rs b/src/domain/contact.rs new file mode 100644 index 0000000..27fb1d4 --- /dev/null +++ b/src/domain/contact.rs @@ -0,0 +1,19 @@ +use chrono::{DateTime, Utc}; +use serde::{Serialize, Deserialize}; + + +/// A unit of measurement to define a page load +#[derive(Serialize, Deserialize, Default, Clone, PartialEq, Eq, PartialOrd, Ord)] +pub struct Contact { + pub id: i32, + pub first_name: String, + pub last_name: String, + pub credential: String, + pub message: String, + pub time_created: DateTime, +} +impl Contact { + pub fn new(first_name: String, last_name: String, credential: String, message: String,) -> Self { + Self { id: -1, first_name, last_name, credential, message, time_created: Utc::now() } + } +} \ No newline at end of file diff --git a/src/domain/mod.rs b/src/domain/mod.rs index 0f09b53..25db7dd 100644 --- a/src/domain/mod.rs +++ b/src/domain/mod.rs @@ -10,4 +10,5 @@ pub mod project_state; pub mod project_type; pub mod unit; pub mod unit_type; -pub mod visit; \ No newline at end of file +pub mod visit; +pub mod contact; \ No newline at end of file