fixed #857 - fixed default ticket expiry on MySQL, bumped sea-orm

This commit is contained in:
Eugene Pankov 2023-08-08 20:48:58 +02:00 committed by Eugene
parent d9385ca44b
commit aca8d3d515
10 changed files with 552 additions and 272 deletions

794
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -27,7 +27,7 @@ poem-openapi = { version = "2.0", features = [
russh-keys = { version = "0.37.1", features = ["openssl"] } russh-keys = { version = "0.37.1", features = ["openssl"] }
# russh-keys = { version = "0.23.0-beta.1", features = ["openssl"], path = "../../russh/russh-keys" } # russh-keys = { version = "0.23.0-beta.1", features = ["openssl"], path = "../../russh/russh-keys" }
rust-embed = "6.3" rust-embed = "6.3"
sea-orm = { version = "0.11.2", features = [ sea-orm = { version = "0.12.2", features = [
"runtime-tokio-native-tls", "runtime-tokio-native-tls",
"macros", "macros",
], default-features = false } ], default-features = false }

View file

@ -84,6 +84,7 @@ impl Api {
username: Set(body.username.clone()), username: Set(body.username.clone()),
target: Set(body.target_name.clone()), target: Set(body.target_name.clone()),
created: Set(chrono::Utc::now()), created: Set(chrono::Utc::now()),
expiry: Set(None),
..Default::default() ..Default::default()
}; };

View file

@ -26,7 +26,7 @@ poem-openapi = { version = "2.0", features = [
rand = "0.8" rand = "0.8"
rand_chacha = "0.3" rand_chacha = "0.3"
rand_core = { version = "0.6", features = ["std"] } rand_core = { version = "0.6", features = ["std"] }
sea-orm = { version = "0.11.2", features = [ sea-orm = { version = "0.12.2", features = [
"runtime-tokio-native-tls", "runtime-tokio-native-tls",
"macros", "macros",
], default-features = false } ], default-features = false }

View file

@ -30,7 +30,7 @@ poem-openapi = { version = "2.0", features = [
rand = "0.8" rand = "0.8"
rand_chacha = "0.3" rand_chacha = "0.3"
rand_core = { version = "0.6", features = ["std"] } rand_core = { version = "0.6", features = ["std"] }
sea-orm = { version = "0.11.2", features = [ sea-orm = { version = "0.12.2", features = [
"runtime-tokio-native-tls", "runtime-tokio-native-tls",
"macros", "macros",
], default-features = false } ], default-features = false }

View file

@ -7,7 +7,7 @@ version = "0.7.4"
[dependencies] [dependencies]
chrono = { version = "0.4", default_features = false, features = ["serde"] } chrono = { version = "0.4", default_features = false, features = ["serde"] }
poem-openapi = { version = "2.0", features = ["chrono", "uuid"] } poem-openapi = { version = "2.0", features = ["chrono", "uuid"] }
sea-orm = { version = "0.11.2", features = [ sea-orm = { version = "0.12.2", features = [
"macros", "macros",
"with-chrono", "with-chrono",
"with-uuid", "with-uuid",

View file

@ -10,14 +10,14 @@ version = "0.7.4"
[dependencies] [dependencies]
async-std = { version = "^1.11", features = ["attributes"] } async-std = { version = "^1.11", features = ["attributes"] }
chrono = { version = "0.4", default_features = false, features = ["serde"] } chrono = { version = "0.4", default_features = false, features = ["serde"] }
sea-orm = { version = "0.11.2", features = [ sea-orm = { version = "0.12.2", features = [
"runtime-tokio-native-tls", "runtime-tokio-native-tls",
"macros", "macros",
"with-chrono", "with-chrono",
"with-uuid", "with-uuid",
"with-json", "with-json",
], default-features = false } ], default-features = false }
sea-orm-migration = { version = "0.11.2", default-features = false, features = [ sea-orm-migration = { version = "0.12.2", default-features = false, features = [
"cli", "cli",
] } ] }
uuid = { version = "1.2", features = ["v4", "serde"] } uuid = { version = "1.2", features = ["v4", "serde"] }

View file

@ -37,9 +37,20 @@ impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
let builder = manager.get_database_backend(); let builder = manager.get_database_backend();
let schema = Schema::new(builder); let schema = Schema::new(builder);
manager manager
.create_table(schema.create_table_from_entity(ticket::Entity)) .create_table(schema.create_table_from_entity(ticket::Entity))
.await .await?;
// https://github.com/warp-tech/warpgate/issues/857
let _ = manager
.get_connection()
.execute_unprepared(
"ALTER TABLE `tickets` MODIFY COLUMN `expiry` TIMESTAMP NULL DEFAULT NULL",
)
.await;
Ok(())
} }
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {

View file

@ -16,7 +16,7 @@ russh = { version = "0.37.1", features = ["vendored-openssl"] }
# russh = { version = "0.35.0-beta.6", features = ["vendored-openssl"], path = "../../russh/russh"} # russh = { version = "0.35.0-beta.6", features = ["vendored-openssl"], path = "../../russh/russh"}
russh-keys = { version = "0.37.1", features = ["vendored-openssl"] } russh-keys = { version = "0.37.1", features = ["vendored-openssl"] }
# russh-keys = { version = "0.23.0-beta.1", features = ["vendored-openssl"], path = "../../russh/russh-keys" } # russh-keys = { version = "0.23.0-beta.1", features = ["vendored-openssl"], path = "../../russh/russh-keys" }
sea-orm = { version = "0.11.2", features = [ sea-orm = { version = "0.12.2", features = [
"runtime-tokio-native-tls", "runtime-tokio-native-tls",
], default-features = false } ], default-features = false }
thiserror = "1.0" thiserror = "1.0"

View file

@ -21,7 +21,7 @@ notify = "^5.0.0"
rcgen = { version = "0.10", features = ["zeroize"] } rcgen = { version = "0.10", features = ["zeroize"] }
serde_json = "1.0" serde_json = "1.0"
serde_yaml = "0.8.23" serde_yaml = "0.8.23"
sea-orm = { version = "0.11.2", default-features = false } sea-orm = { version = "0.12.2", default-features = false }
time = "0.3" time = "0.3"
tokio = { version = "1.20", features = ["tracing", "signal", "macros"] } tokio = { version = "1.20", features = ["tracing", "signal", "macros"] }
tracing = "0.1" tracing = "0.1"