Added page visit domain obj
This commit is contained in:
parent
6aa4e0095d
commit
6489265fe8
|
@ -10,3 +10,4 @@ pub mod project_state;
|
|||
pub mod project_type;
|
||||
pub mod unit;
|
||||
pub mod unit_type;
|
||||
pub mod visit;
|
|
@ -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() }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue