Update Rocket (#1959)
This commit is contained in:
parent
0cffeb62a0
commit
8b8b2ae391
@ -11,12 +11,8 @@ async-trait = { version = "0.1" }
|
|||||||
rocket-example-service = { path = "../service" }
|
rocket-example-service = { path = "../service" }
|
||||||
futures = { version = "0.3" }
|
futures = { version = "0.3" }
|
||||||
futures-util = { version = "0.3" }
|
futures-util = { version = "0.3" }
|
||||||
rocket = { version = "0.5.0-rc.1", features = [
|
rocket = { version = "0.5.0-rc.4", features = ["json"] }
|
||||||
"json",
|
rocket_dyn_templates = { version = "0.1.0-rc.1", features = ["tera"] }
|
||||||
] }
|
|
||||||
rocket_dyn_templates = { version = "0.1.0-rc.1", features = [
|
|
||||||
"tera",
|
|
||||||
] }
|
|
||||||
serde_json = { version = "1" }
|
serde_json = { version = "1" }
|
||||||
entity = { path = "../entity" }
|
entity = { path = "../entity" }
|
||||||
migration = { path = "../migration" }
|
migration = { path = "../migration" }
|
||||||
|
@ -9,9 +9,7 @@ name = "entity"
|
|||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rocket = { version = "0.5.0-rc.1", features = [
|
rocket = { version = "0.5.0-rc.4", features = ["json"] }
|
||||||
"json",
|
|
||||||
] }
|
|
||||||
|
|
||||||
[dependencies.sea-orm]
|
[dependencies.sea-orm]
|
||||||
path = "../../../" # remove this line in your own project
|
path = "../../../" # remove this line in your own project
|
||||||
|
@ -9,7 +9,7 @@ name = "migration"
|
|||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rocket = { version = "0.5.0-rc.1" }
|
rocket = { version = "0.5.0-rc.4" }
|
||||||
async-std = { version = "1", features = ["attributes", "tokio1"] }
|
async-std = { version = "1", features = ["attributes", "tokio1"] }
|
||||||
|
|
||||||
[dependencies.sea-orm-migration]
|
[dependencies.sea-orm-migration]
|
||||||
|
@ -11,12 +11,8 @@ async-trait = { version = "0.1" }
|
|||||||
rocket-okapi-example-service = { path = "../service" }
|
rocket-okapi-example-service = { path = "../service" }
|
||||||
futures = { version = "0.3" }
|
futures = { version = "0.3" }
|
||||||
futures-util = { version = "0.3" }
|
futures-util = { version = "0.3" }
|
||||||
rocket = { version = "0.5.0-rc.1", features = [
|
rocket = { version = "0.5.0-rc.4", features = ["json"] }
|
||||||
"json",
|
rocket_dyn_templates = { version = "0.1.0-rc.1", features = ["tera"] }
|
||||||
] }
|
|
||||||
rocket_dyn_templates = { version = "0.1.0-rc.1", features = [
|
|
||||||
"tera",
|
|
||||||
] }
|
|
||||||
serde_json = { version = "1" }
|
serde_json = { version = "1" }
|
||||||
entity = { path = "../entity" }
|
entity = { path = "../entity" }
|
||||||
migration = { path = "../migration" }
|
migration = { path = "../migration" }
|
||||||
@ -26,7 +22,9 @@ dto = { path = "../dto" }
|
|||||||
|
|
||||||
[dependencies.sea-orm-rocket]
|
[dependencies.sea-orm-rocket]
|
||||||
path = "../../../sea-orm-rocket/lib" # remove this line in your own project and use the version line
|
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"
|
# version = "0.5.1"
|
||||||
|
|
||||||
[dependencies.rocket_okapi]
|
[dependencies.rocket_okapi]
|
||||||
|
@ -9,9 +9,7 @@ name = "dto"
|
|||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rocket = { version = "0.5.0-rc.1", features = [
|
rocket = { version = "0.5.0-rc.4", features = ["json"] }
|
||||||
"json",
|
|
||||||
] }
|
|
||||||
|
|
||||||
[dependencies.entity]
|
[dependencies.entity]
|
||||||
path = "../entity"
|
path = "../entity"
|
||||||
|
@ -9,9 +9,7 @@ name = "entity"
|
|||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rocket = { version = "0.5.0-rc.1", features = [
|
rocket = { version = "0.5.0-rc.4", features = ["json"] }
|
||||||
"json",
|
|
||||||
] }
|
|
||||||
|
|
||||||
[dependencies.sea-orm]
|
[dependencies.sea-orm]
|
||||||
path = "../../../" # remove this line in your own project
|
path = "../../../" # remove this line in your own project
|
||||||
|
@ -9,7 +9,7 @@ name = "migration"
|
|||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rocket = { version = "0.5.0-rc.1" }
|
rocket = { version = "0.5.0-rc.4" }
|
||||||
async-std = { version = "1", features = ["attributes", "tokio1"] }
|
async-std = { version = "1", features = ["attributes", "tokio1"] }
|
||||||
|
|
||||||
[dependencies.sea-orm-migration]
|
[dependencies.sea-orm-migration]
|
||||||
|
@ -17,6 +17,6 @@ devise = "0.3"
|
|||||||
quote = "1"
|
quote = "1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[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"
|
trybuild = "1.0"
|
||||||
version_check = "0.9"
|
version_check = "0.9"
|
||||||
|
@ -64,7 +64,7 @@ pub fn derive_database(input: TokenStream) -> TokenStream {
|
|||||||
) -> rocket::request::Outcome<Self, Self::Error> {
|
) -> rocket::request::Outcome<Self, Self::Error> {
|
||||||
match #db_ty::fetch(req.rocket()) {
|
match #db_ty::fetch(req.rocket()) {
|
||||||
Some(db) => rocket::outcome::Outcome::Success(db),
|
Some(db) => rocket::outcome::Outcome::Success(db),
|
||||||
None => rocket::outcome::Outcome::Failure((
|
None => rocket::outcome::Outcome::Error((
|
||||||
rocket::http::Status::InternalServerError, ()))
|
rocket::http::Status::InternalServerError, ()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ edition = "2021"
|
|||||||
all-features = true
|
all-features = true
|
||||||
|
|
||||||
[dependencies.rocket]
|
[dependencies.rocket]
|
||||||
version = "0.5.0-rc.1"
|
version = "0.5.0-rc.4"
|
||||||
default-features = false
|
default-features = false
|
||||||
|
|
||||||
[dependencies.sea-orm-rocket-codegen]
|
[dependencies.sea-orm-rocket-codegen]
|
||||||
@ -26,6 +26,6 @@ default-features = false
|
|||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
[dev-dependencies.rocket]
|
[dev-dependencies.rocket]
|
||||||
version = "0.5.0-rc.1"
|
version = "0.5.0-rc.4"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["json"]
|
features = ["json"]
|
@ -131,10 +131,10 @@ pub trait Database:
|
|||||||
}
|
}
|
||||||
|
|
||||||
let dbtype = std::any::type_name::<Self>();
|
let dbtype = std::any::type_name::<Self>();
|
||||||
let fairing = Paint::default(format!("{dbtype}::init()")).bold();
|
let fairing = Paint::new(format!("{dbtype}::init()")).bold();
|
||||||
error!(
|
error!(
|
||||||
"Attempted to fetch unattached database `{}`.",
|
"Attempted to fetch unattached database `{}`.",
|
||||||
Paint::default(dbtype).bold()
|
Paint::new(dbtype).bold()
|
||||||
);
|
);
|
||||||
info_!(
|
info_!(
|
||||||
"`{}` fairing must be attached prior to using this database.",
|
"`{}` 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> {
|
async fn from_request(req: &'r Request<'_>) -> Outcome<Self, Self::Error> {
|
||||||
match D::fetch(req.rocket()) {
|
match D::fetch(req.rocket()) {
|
||||||
Some(pool) => Outcome::Success(Connection(pool.borrow())),
|
Some(pool) => Outcome::Success(Connection(pool.borrow())),
|
||||||
None => Outcome::Failure((Status::InternalServerError, None)),
|
None => Outcome::Error((Status::InternalServerError, None)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user