Skip to content

Commit

Permalink
Update Rocket (#1959)
Browse files Browse the repository at this point in the history
  • Loading branch information
wyatt-herkamp authored Nov 6, 2023
1 parent 0cffeb6 commit 8b8b2ae
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 34 deletions.
8 changes: 2 additions & 6 deletions examples/rocket_example/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
4 changes: 1 addition & 3 deletions examples/rocket_example/entity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/rocket_example/migration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
16 changes: 7 additions & 9 deletions examples/rocket_okapi_example/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand All @@ -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
default-features = false
6 changes: 2 additions & 4 deletions examples/rocket_okapi_example/dto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
version = "0.8.0-rc.2"
4 changes: 1 addition & 3 deletions examples/rocket_okapi_example/entity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/rocket_okapi_example/migration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion sea-orm-rocket/codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion sea-orm-rocket/codegen/src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, ()))
}
}
Expand Down
4 changes: 2 additions & 2 deletions sea-orm-rocket/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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"]
6 changes: 3 additions & 3 deletions sea-orm-rocket/lib/src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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)),
}
}
}
Expand Down

0 comments on commit 8b8b2ae

Please sign in to comment.