Update Rocket (#1959)

This commit is contained in:
Wyatt Herkamp 2023-11-06 06:04:18 -05:00 committed by GitHub
parent 0cffeb62a0
commit 8b8b2ae391
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 22 additions and 34 deletions

View File

@ -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" }

View File

@ -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

View File

@ -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]

View File

@ -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,12 +22,14 @@ 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"

View File

@ -9,9 +9,7 @@ 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"

View File

@ -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

View File

@ -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]

View File

@ -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"

View File

@ -64,7 +64,7 @@ pub fn derive_database(input: TokenStream) -> TokenStream {
) -> rocket::request::Outcome<Self, Self::Error> {
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, ()))
}
}

View File

@ -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"]

View File

@ -131,10 +131,10 @@ pub trait Database:
}
let dbtype = std::any::type_name::<Self>();
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<Self, Self::Error> {
match D::fetch(req.rocket()) {
Some(pool) => Outcome::Success(Connection(pool.borrow())),
None => Outcome::Failure((Status::InternalServerError, None)),
None => Outcome::Error((Status::InternalServerError, None)),
}
}
}