From d23fc1d7e76155832a1e14ecad2d9a8d085f3f8f Mon Sep 17 00:00:00 2001 From: minneelyyyy Date: Wed, 11 Dec 2024 00:37:44 -0500 Subject: [PATCH] fix: stealing other players' items --- src/inventory.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/inventory.rs b/src/inventory.rs index 9ce7b9d..ba9cc9f 100644 --- a/src/inventory.rs +++ b/src/inventory.rs @@ -53,9 +53,9 @@ impl Inventory { let x = sqlx::query_as( r#" SELECT id, name, game, item, data FROM items - where item = $1 + where item = $1 AND owner = $2 "# - ).bind(item as i64).fetch_one(db).await.ok(); + ).bind(item as i64).bind(self.user.get() as i64).fetch_one(db).await.ok(); Ok(x) } @@ -67,9 +67,9 @@ impl Inventory { let x = sqlx::query_as( r#" SELECT id, name, game, item, data FROM items - where name = $1 + where name = $1 AND user = $2 "# - ).bind(name).fetch_one(db).await.ok(); + ).bind(name).bind(self.user.get() as i64).fetch_one(db).await.ok(); Ok(x) }