Skip to content

Commit

Permalink
cr fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
“Giems” committed Feb 19, 2024
1 parent e21a4dd commit 30aed50
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion database/migrations/000000000003_sessions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CREATE TABLE sessions(
session_id TEXT NOT NULL UNIQUE,
app_id TEXT NOT NULL,
app_metadata TEXT NOT NULL,
app_connection_address TEXT NOT NULL,
app_ip_address TEXT NOT NULL,
persistent BOOLEAN NOT NULL,
network TEXT NOT NULL,
client_id TEXT,
Expand Down
2 changes: 0 additions & 2 deletions database/src/structs/request_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ use sqlx::Type;
pub enum RequestStatus {
Pending,
Completed,
Failed,
Rejected,
TimedOut,
Unknown,
}
5 changes: 3 additions & 2 deletions database/src/structs/subscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use sqlx::Type;
#[derive(Clone, Debug, Eq, PartialEq, Type)]
#[sqlx(type_name = "subscription")]
pub struct Subscription {
pub email: String,
pub subscribed_at: i64,
pub subscription_type: String,
pub valid_from: i64,
pub valid_till: i64,
}
6 changes: 3 additions & 3 deletions database/src/tables/registered_app/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ mod tests {
session_id: "test_session_id".to_string(),
app_id: "test_app_id".to_string(),
app_metadata: "test_app_metadata".to_string(),
app_connection_address: "test_app_connection_address".to_string(),
app_ip_address: "test_app_ip_address".to_string(),
persistent: false,
network: "test_network".to_string(),
client: None,
Expand All @@ -120,7 +120,7 @@ mod tests {
session_id: "test_session_id_2".to_string(),
app_id: "test_app_id".to_string(),
app_metadata: "test_app_metadata".to_string(),
app_connection_address: "test_app_connection_address".to_string(),
app_ip_address: "test_app_ip_address".to_string(),
persistent: false,
network: "test_network".to_string(),
client: None,
Expand Down Expand Up @@ -218,7 +218,7 @@ mod tests {
session_id: "test_session_id".to_string(),
app_id: "test_app_id".to_string(),
app_metadata: "test_app_metadata".to_string(),
app_connection_address: "test_app_connection_address".to_string(),
app_ip_address: "test_app_ip_address".to_string(),
persistent: false,
network: "test_network".to_string(),
client: None,
Expand Down
2 changes: 1 addition & 1 deletion database/src/tables/requests/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ mod tests {
session_id: "test_session_id".to_string(),
app_id: "test_app_id".to_string(),
app_metadata: "test_app_metadata".to_string(),
app_connection_address: "test_app_connection_address".to_string(),
app_ip_address: "test_app_ip_address".to_string(),
persistent: false,
network: "test_network".to_string(),
client: Some(ClientData {
Expand Down
6 changes: 3 additions & 3 deletions database/src/tables/sessions/table_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ use sqlx::{postgres::PgRow, FromRow, Row};

pub const SESSIONS_TABLE_NAME: &str = "sessions";
pub const SESSIONS_KEYS: &str =
"session_id, app_id, app_metadata, app_connection_address, persistent, network, client_id, client_device, client_metadata, client_notification_endpoint, client_connected_at, session_open_timestamp, session_close_timestamp";
"session_id, app_id, app_metadata, app_ip_address, persistent, network, client_id, client_device, client_metadata, client_notification_endpoint, client_connected_at, session_open_timestamp, session_close_timestamp";

#[derive(Clone, Debug, Eq, PartialEq)]
pub struct DbNcSession {
pub session_id: String,
pub app_id: String,
pub app_metadata: String,
pub app_connection_address: String,
pub app_ip_address: String,
pub persistent: bool,
pub network: String,
pub client: Option<ClientData>, // Some if user has ever connected to the session
Expand All @@ -26,7 +26,7 @@ impl FromRow<'_, PgRow> for DbNcSession {
Ok(DbNcSession {
app_id: row.get("app_id"),
app_metadata: row.get("app_metadata"),
app_connection_address: row.get("app_connection_address"),
app_ip_address: row.get("app_ip_address"),
persistent: row.get("persistent"),
network: row.get("network"),
session_id: row.get("session_id"),
Expand Down
4 changes: 2 additions & 2 deletions database/src/tables/sessions/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl Db {
.bind(&session.session_id)
.bind(&session.app_id)
.bind(&session.app_metadata)
.bind(&session.app_connection_address)
.bind(&session.app_ip_address)
.bind(&session.persistent)
.bind(&session.network)
.bind(&client_id)
Expand Down Expand Up @@ -97,7 +97,7 @@ mod tests {
session_id: "test_session_id".to_string(),
app_id: "test_app_id".to_string(),
app_metadata: "test_app_metadata".to_string(),
app_connection_address: "test_app_connection_address".to_string(),
app_ip_address: "test_app_ip_address".to_string(),
persistent: false,
network: "test_network".to_string(),
client: Some(ClientData {
Expand Down

0 comments on commit 30aed50

Please sign in to comment.