@@ -2,8 +2,8 @@ mod models;
22
33use crate :: responses:: stat:: devices:: RawDevice ;
44use crate :: types:: {
5- Antenna , ConfigNet , InterfaceUserStats , Port , Radio , SystemStats , Temperature , Uplink ,
6- UserStats , Version , IP ,
5+ Antenna , ConfigNet , IP , InterfaceUserStats , Port , Radio , SystemStats , Temperature , Uplink ,
6+ UserStats , Version ,
77} ;
88use chrono:: prelude:: * ;
99
@@ -81,21 +81,28 @@ impl From<RawDevice> for AccessPoint {
8181 name : raw. name ,
8282 config_network : ConfigNet :: from ( raw. config_network ) ,
8383 ip : IP :: from ( raw. ip ) ,
84- connected_at : DateTime :: from_timestamp ( raw. connected_at , 0 ) . expect ( "Invalid timestamp" ) ,
85- provisioned_at : DateTime :: from_timestamp ( raw. provisioned_at , 0 )
86- . expect ( "Invalid timestamp" ) ,
87- disconnected_at : DateTime :: from_timestamp ( raw. disconnected_at , 0 )
88- . expect ( "Invalid timestamp" ) ,
89- startup_time : DateTime :: from_timestamp (
90- raw. startup_timestamp . unwrap_or_default ( ) ,
84+ connected_at : DateTime :: from_timestamp (
85+ match raw. connected_at {
86+ Some ( ts) => ts,
87+ None => 0 ,
88+ } ,
9189 0 ,
9290 )
9391 . expect ( "Invalid timestamp" ) ,
94- last_seen : DateTime :: from_timestamp (
95- raw. last_seen . unwrap_or_default ( ) ,
92+ provisioned_at : DateTime :: from_timestamp ( raw. provisioned_at , 0 )
93+ . expect ( "Invalid timestamp" ) ,
94+ disconnected_at : DateTime :: from_timestamp (
95+ match raw. disconnected_at {
96+ Some ( ts) => ts,
97+ None => 0 ,
98+ } ,
9699 0 ,
97100 )
98101 . expect ( "Invalid timestamp" ) ,
102+ startup_time : DateTime :: from_timestamp ( raw. startup_timestamp . unwrap_or_default ( ) , 0 )
103+ . expect ( "Invalid timestamp" ) ,
104+ last_seen : DateTime :: from_timestamp ( raw. last_seen . unwrap_or_default ( ) , 0 )
105+ . expect ( "Invalid timestamp" ) ,
99106 serial : match raw. serial {
100107 Some ( s) => s,
101108 None => "" . to_string ( ) ,
0 commit comments