Skip to content

Commit

Permalink
Remove refreshed_at
Browse files Browse the repository at this point in the history
  • Loading branch information
kurotych committed Dec 10, 2024
1 parent 4f4cc9b commit c2343a8
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 0 additions & 18 deletions mobile_config/src/gateway_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ pub struct GatewayInfo {
pub metadata: Option<GatewayMetadata>,
pub device_type: DeviceType,
// None for V1
pub refreshed_at: Option<DateTime<Utc>>,
pub created_at: Option<DateTime<Utc>>,
}

Expand Down Expand Up @@ -135,7 +134,6 @@ impl TryFrom<GatewayInfoProtoV2> for GatewayInfo {
metadata,
device_type: _,
created_at,
refreshed_at,
} = info;

let metadata = if let Some(metadata) = metadata {
Expand All @@ -154,16 +152,11 @@ impl TryFrom<GatewayInfoProtoV2> for GatewayInfo {
.single()
.ok_or(GatewayInfoProtoParseError::InvalidCreatedAt(created_at))?;

let refreshed_at = Utc.timestamp_opt(refreshed_at as i64, 0).single().ok_or(
GatewayInfoProtoParseError::InvalidRefreshedAt(info.refreshed_at),
)?;

Ok(Self {
address: address.into(),
metadata,
device_type: device_type_,
created_at: Some(created_at),
refreshed_at: Some(refreshed_at),
})
}
}
Expand Down Expand Up @@ -196,7 +189,6 @@ impl TryFrom<GatewayInfoProto> for GatewayInfo {
metadata,
device_type: device_type_,
created_at: None,
refreshed_at: None,
})
}
}
Expand Down Expand Up @@ -297,10 +289,6 @@ impl TryFrom<GatewayInfo> for GatewayInfoProtoV2 {
.created_at
.ok_or(GatewayInfoToProtoError::CreatedAtIsNone)?
.timestamp() as u64,
refreshed_at: info
.refreshed_at
.ok_or(GatewayInfoToProtoError::RefreshedAtIsNone)?
.timestamp() as u64,
})
}
}
Expand Down Expand Up @@ -480,11 +468,6 @@ pub(crate) mod db {
)
.map_err(|err| sqlx::Error::Decode(Box::new(err)))?;
let created_at = row.get::<DateTime<Utc>, &str>("created_at");
// `refreshed_at` can be NULL in the database schema.
// If so, fallback to using `created_at` as the default value of `refreshed_at`.
let refreshed_at = row
.get::<Option<DateTime<Utc>>, &str>("refreshed_at")
.unwrap_or(created_at);

Ok(Self {
address: PublicKeyBinary::from_str(
Expand All @@ -493,7 +476,6 @@ pub(crate) mod db {
.map_err(|err| sqlx::Error::Decode(Box::new(err)))?,
metadata,
device_type,
refreshed_at: Some(refreshed_at),
created_at: Some(created_at),
})
}
Expand Down
1 change: 0 additions & 1 deletion mobile_verifier/tests/integrations/speedtests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ impl GatewayInfoResolver for MockGatewayInfoResolver {
metadata: None,
device_type: DeviceType::Cbrs,
created_at: None,
refreshed_at: None,
}))
}

Expand Down

0 comments on commit c2343a8

Please sign in to comment.