From 8b8b2ae391b954609aca051e3fbdc7122cfc528e Mon Sep 17 00:00:00 2001 From: Wyatt Herkamp Date: Mon, 6 Nov 2023 06:04:18 -0500 Subject: [PATCH] Update Rocket (#1959) --- examples/rocket_example/api/Cargo.toml | 8 ++------ examples/rocket_example/entity/Cargo.toml | 4 +--- examples/rocket_example/migration/Cargo.toml | 2 +- examples/rocket_okapi_example/api/Cargo.toml | 16 +++++++--------- examples/rocket_okapi_example/dto/Cargo.toml | 6 ++---- examples/rocket_okapi_example/entity/Cargo.toml | 4 +--- .../rocket_okapi_example/migration/Cargo.toml | 2 +- sea-orm-rocket/codegen/Cargo.toml | 2 +- sea-orm-rocket/codegen/src/database.rs | 2 +- sea-orm-rocket/lib/Cargo.toml | 4 ++-- sea-orm-rocket/lib/src/database.rs | 6 +++--- 11 files changed, 22 insertions(+), 34 deletions(-) diff --git a/examples/rocket_example/api/Cargo.toml b/examples/rocket_example/api/Cargo.toml index 26269bcf2..f80c7d4ba 100644 --- a/examples/rocket_example/api/Cargo.toml +++ b/examples/rocket_example/api/Cargo.toml @@ -11,12 +11,8 @@ async-trait = { version = "0.1" } rocket-example-service = { path = "../service" } futures = { version = "0.3" } futures-util = { version = "0.3" } -rocket = { version = "0.5.0-rc.1", features = [ - "json", -] } -rocket_dyn_templates = { version = "0.1.0-rc.1", features = [ - "tera", -] } +rocket = { version = "0.5.0-rc.4", features = ["json"] } +rocket_dyn_templates = { version = "0.1.0-rc.1", features = ["tera"] } serde_json = { version = "1" } entity = { path = "../entity" } migration = { path = "../migration" } diff --git a/examples/rocket_example/entity/Cargo.toml b/examples/rocket_example/entity/Cargo.toml index 28bd59aef..f5f931816 100644 --- a/examples/rocket_example/entity/Cargo.toml +++ b/examples/rocket_example/entity/Cargo.toml @@ -9,9 +9,7 @@ name = "entity" path = "src/lib.rs" [dependencies] -rocket = { version = "0.5.0-rc.1", features = [ - "json", -] } +rocket = { version = "0.5.0-rc.4", features = ["json"] } [dependencies.sea-orm] path = "../../../" # remove this line in your own project diff --git a/examples/rocket_example/migration/Cargo.toml b/examples/rocket_example/migration/Cargo.toml index e2774d565..3bd0ff4f6 100644 --- a/examples/rocket_example/migration/Cargo.toml +++ b/examples/rocket_example/migration/Cargo.toml @@ -9,7 +9,7 @@ name = "migration" path = "src/lib.rs" [dependencies] -rocket = { version = "0.5.0-rc.1" } +rocket = { version = "0.5.0-rc.4" } async-std = { version = "1", features = ["attributes", "tokio1"] } [dependencies.sea-orm-migration] diff --git a/examples/rocket_okapi_example/api/Cargo.toml b/examples/rocket_okapi_example/api/Cargo.toml index 1698ca436..91fe0e6a1 100644 --- a/examples/rocket_okapi_example/api/Cargo.toml +++ b/examples/rocket_okapi_example/api/Cargo.toml @@ -11,12 +11,8 @@ async-trait = { version = "0.1" } rocket-okapi-example-service = { path = "../service" } futures = { version = "0.3" } futures-util = { version = "0.3" } -rocket = { version = "0.5.0-rc.1", features = [ - "json", -] } -rocket_dyn_templates = { version = "0.1.0-rc.1", features = [ - "tera", -] } +rocket = { version = "0.5.0-rc.4", features = ["json"] } +rocket_dyn_templates = { version = "0.1.0-rc.1", features = ["tera"] } serde_json = { version = "1" } entity = { path = "../entity" } migration = { path = "../migration" } @@ -26,14 +22,16 @@ dto = { path = "../dto" } [dependencies.sea-orm-rocket] path = "../../../sea-orm-rocket/lib" # remove this line in your own project and use the version line -features = ["rocket_okapi"] # enables rocket_okapi so to have open api features enabled +features = [ + "rocket_okapi", +] # enables rocket_okapi so to have open api features enabled # version = "0.5.1" [dependencies.rocket_okapi] version = "0.8.0-rc.2" -features = ["swagger", "rapidoc","rocket_db_pools"] +features = ["swagger", "rapidoc", "rocket_db_pools"] [dependencies.rocket_cors] git = "https://github.com/lawliet89/rocket_cors.git" rev = "54fae070" -default-features = false \ No newline at end of file +default-features = false diff --git a/examples/rocket_okapi_example/dto/Cargo.toml b/examples/rocket_okapi_example/dto/Cargo.toml index a0f208dba..233a3dc8c 100644 --- a/examples/rocket_okapi_example/dto/Cargo.toml +++ b/examples/rocket_okapi_example/dto/Cargo.toml @@ -9,12 +9,10 @@ name = "dto" path = "src/lib.rs" [dependencies] -rocket = { version = "0.5.0-rc.1", features = [ - "json", -] } +rocket = { version = "0.5.0-rc.4", features = ["json"] } [dependencies.entity] path = "../entity" [dependencies.rocket_okapi] -version = "0.8.0-rc.2" \ No newline at end of file +version = "0.8.0-rc.2" diff --git a/examples/rocket_okapi_example/entity/Cargo.toml b/examples/rocket_okapi_example/entity/Cargo.toml index 10cbf52a6..5cc820a06 100644 --- a/examples/rocket_okapi_example/entity/Cargo.toml +++ b/examples/rocket_okapi_example/entity/Cargo.toml @@ -9,9 +9,7 @@ name = "entity" path = "src/lib.rs" [dependencies] -rocket = { version = "0.5.0-rc.1", features = [ - "json", -] } +rocket = { version = "0.5.0-rc.4", features = ["json"] } [dependencies.sea-orm] path = "../../../" # remove this line in your own project diff --git a/examples/rocket_okapi_example/migration/Cargo.toml b/examples/rocket_okapi_example/migration/Cargo.toml index e2774d565..3bd0ff4f6 100644 --- a/examples/rocket_okapi_example/migration/Cargo.toml +++ b/examples/rocket_okapi_example/migration/Cargo.toml @@ -9,7 +9,7 @@ name = "migration" path = "src/lib.rs" [dependencies] -rocket = { version = "0.5.0-rc.1" } +rocket = { version = "0.5.0-rc.4" } async-std = { version = "1", features = ["attributes", "tokio1"] } [dependencies.sea-orm-migration] diff --git a/sea-orm-rocket/codegen/Cargo.toml b/sea-orm-rocket/codegen/Cargo.toml index 03e34ab0e..c83b273f1 100644 --- a/sea-orm-rocket/codegen/Cargo.toml +++ b/sea-orm-rocket/codegen/Cargo.toml @@ -17,6 +17,6 @@ devise = "0.3" quote = "1" [dev-dependencies] -rocket = { version = "0.5.0-rc.1", default-features = false } +rocket = { version = "0.5.0-rc.4", default-features = false } trybuild = "1.0" version_check = "0.9" diff --git a/sea-orm-rocket/codegen/src/database.rs b/sea-orm-rocket/codegen/src/database.rs index 360c84742..c1aba5f3f 100644 --- a/sea-orm-rocket/codegen/src/database.rs +++ b/sea-orm-rocket/codegen/src/database.rs @@ -64,7 +64,7 @@ pub fn derive_database(input: TokenStream) -> TokenStream { ) -> rocket::request::Outcome { match #db_ty::fetch(req.rocket()) { Some(db) => rocket::outcome::Outcome::Success(db), - None => rocket::outcome::Outcome::Failure(( + None => rocket::outcome::Outcome::Error(( rocket::http::Status::InternalServerError, ())) } } diff --git a/sea-orm-rocket/lib/Cargo.toml b/sea-orm-rocket/lib/Cargo.toml index 57ad8b6ac..0c882a850 100644 --- a/sea-orm-rocket/lib/Cargo.toml +++ b/sea-orm-rocket/lib/Cargo.toml @@ -13,7 +13,7 @@ edition = "2021" all-features = true [dependencies.rocket] -version = "0.5.0-rc.1" +version = "0.5.0-rc.4" default-features = false [dependencies.sea-orm-rocket-codegen] @@ -26,6 +26,6 @@ default-features = false optional = true [dev-dependencies.rocket] -version = "0.5.0-rc.1" +version = "0.5.0-rc.4" default-features = false features = ["json"] \ No newline at end of file diff --git a/sea-orm-rocket/lib/src/database.rs b/sea-orm-rocket/lib/src/database.rs index 54f6da34d..fe275e185 100644 --- a/sea-orm-rocket/lib/src/database.rs +++ b/sea-orm-rocket/lib/src/database.rs @@ -131,10 +131,10 @@ pub trait Database: } let dbtype = std::any::type_name::(); - let fairing = Paint::default(format!("{dbtype}::init()")).bold(); + let fairing = Paint::new(format!("{dbtype}::init()")).bold(); error!( "Attempted to fetch unattached database `{}`.", - Paint::default(dbtype).bold() + Paint::new(dbtype).bold() ); info_!( "`{}` fairing must be attached prior to using this database.", @@ -261,7 +261,7 @@ impl<'r, D: Database> FromRequest<'r> for Connection<'r, D> { async fn from_request(req: &'r Request<'_>) -> Outcome { match D::fetch(req.rocket()) { Some(pool) => Outcome::Success(Connection(pool.borrow())), - None => Outcome::Failure((Status::InternalServerError, None)), + None => Outcome::Error((Status::InternalServerError, None)), } } }