diff --git a/Cargo.lock b/Cargo.lock index f558be26..32ae66c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2640,7 +2640,7 @@ version = "1.0.0" dependencies = [ "actix-web", "env_logger", - "redis 0.27.6", + "redis 0.28.2", "serde", "tracing", ] @@ -6578,6 +6578,29 @@ dependencies = [ "pin-project-lite", "ryu", "sha1_smol", + "tokio", + "tokio-util", + "url", +] + +[[package]] +name = "redis" +version = "0.28.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e37ec3fd44bea2ec947ba6cc7634d7999a6590aca7c35827c250bc0de502bda6" +dependencies = [ + "arc-swap", + "backon", + "bytes", + "combine", + "futures-channel", + "futures-util", + "itoa", + "num-bigint", + "percent-encoding", + "pin-project-lite", + "ryu", + "sha1_smol", "socket2", "tokio", "tokio-util", @@ -10056,6 +10079,17 @@ dependencies = [ "syn 2.0.98", ] +[[package]] +name = "zerocopy-derive" +version = "0.8.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06718a168365cad3d5ff0bb133aad346959a2074bd4a85c121255a11304a8626" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.93", +] + [[package]] name = "zerofrom" version = "0.1.5" diff --git a/Cargo.toml b/Cargo.toml index 0edc9c60..ff4f9586 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -110,7 +110,7 @@ openssl = { version = "0.10.60", features = ["v110"] } parking_lot = "0.12" pin-project-lite = "0.2" rand = "0.9" -redis = { version = "0.27" } +redis = { version = "0.28" } reqwest = { version = "0.12", features = ["json", "stream"] } rustls = "0.23" rustls-pemfile = "2" diff --git a/databases/diesel-async/src/actions.rs b/databases/diesel-async/src/actions.rs index 2bbb2c94..542f5662 100644 --- a/databases/diesel-async/src/actions.rs +++ b/databases/diesel-async/src/actions.rs @@ -9,7 +9,7 @@ use diesel_async::RunQueryDsl; type DbError = Box; // /// Run query using Diesel to find item by uid and return it. -pub async fn find_item_by_uid( +pub async fn find_item_by_id( conn: &mut AsyncPgConnection, uid: Uuid, ) -> Result, DbError> { diff --git a/databases/diesel-async/src/main.rs b/databases/diesel-async/src/main.rs index c4ea5ad6..b499a5cd 100644 --- a/databases/diesel-async/src/main.rs +++ b/databases/diesel-async/src/main.rs @@ -24,16 +24,16 @@ type DbPool = Pool; #[get("/items/{item_id}")] async fn get_item( pool: web::Data, - item_uid: web::Path, + item_id: web::Path, ) -> actix_web::Result { - let item_uid = item_uid.into_inner(); + let item_id = item_id.into_inner(); let mut conn = pool .get() .await .expect("Couldn't get db connection from the pool"); - let item = actions::find_item_by_uid(&mut conn, item_uid) + let item = actions::find_item_by_id(&mut conn, item_id) .await // map diesel query errors to a 500 error response .map_err(error::ErrorInternalServerError)?; @@ -43,7 +43,7 @@ async fn get_item( Some(item) => HttpResponse::Ok().json(item), // item was not found; return 404 response with error message - None => HttpResponse::NotFound().body(format!("No item found with UID: {item_uid}")), + None => HttpResponse::NotFound().body(format!("No item found with UID: {item_id}")), }) }