Added page visit domain obj

This commit is contained in:
Franklin 2023-04-14 15:58:00 -04:00
parent 6aa4e0095d
commit 6489265fe8
2 changed files with 18 additions and 0 deletions

View File

@ -10,3 +10,4 @@ pub mod project_state;
pub mod project_type;
pub mod unit;
pub mod unit_type;
pub mod visit;

17
src/domain/visit.rs Normal file
View File

@ -0,0 +1,17 @@
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 Visit {
pub id: i32,
pub ip_addr: String,
pub time_created: DateTime<Utc>
}
impl Visit {
pub fn new(ip_addr: String) -> Self {
Self { id: -1, ip_addr, time_created: Utc::now() }
}
}