Skip to content

Commit

Permalink
fill in required timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
Nieuwejaar committed Jul 24, 2024
1 parent 954e72f commit fbd959b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions nexus/db-model/src/switch_port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use crate::schema::{
};
use crate::{impl_enum_type, SqlU32};
use crate::{SqlU16, SqlU8};
use chrono::{DateTime, Utc};
use db_macros::Resource;
use diesel::AsChangeset;
use ipnetwork::IpNetwork;
Expand Down Expand Up @@ -440,6 +441,9 @@ pub struct LldpLinkConfig {
pub enabled: bool,
pub link_name: Option<String>,
pub link_description: Option<String>,
pub time_created: DateTime<Utc>,
pub time_modified: DateTime<Utc>,
pub time_deleted: Option<DateTime<Utc>>,
pub chassis_id: Option<String>,
pub system_name: Option<String>,
pub system_description: Option<String>,
Expand All @@ -456,6 +460,7 @@ impl LldpLinkConfig {
system_description: Option<String>,
management_ip: Option<IpNetwork>,
) -> Self {
let now = Utc::now();
Self {
id: Uuid::new_v4(),
enabled,
Expand All @@ -465,6 +470,9 @@ impl LldpLinkConfig {
system_name,
system_description,
management_ip,
time_created: now,
time_modified: now,
time_deleted: None,
}
}
}
Expand Down

0 comments on commit fbd959b

Please sign in to comment.