Moved Devices to a models module

This commit is contained in:
Ricardo Zuasti
2026-02-14 12:30:12 -05:00
parent 3185af3fdb
commit 7c96939b2d
10 changed files with 34 additions and 29 deletions
+22
View File
@@ -0,0 +1,22 @@
use chrono::{DateTime, Utc, serde::ts_seconds};
use serde::{Deserialize, Serialize};
use std::fmt;
#[derive(Clone, Serialize, Deserialize)]
pub struct Device {
pub mac_address: String,
pub ipv4_address: String,
pub vendor: String,
#[serde(with = "ts_seconds")]
pub last_seen: DateTime<Utc>,
}
impl fmt::Display for Device {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(
f,
"mac={}, ip={}, vendor={}, last_seen={}",
self.mac_address, self.ipv4_address, self.vendor, self.last_seen
)
}
}