From fb6eaeffd20707ab729532719b079555ce52361d Mon Sep 17 00:00:00 2001 From: jake Date: Tue, 1 Dec 2020 22:56:22 -0700 Subject: [PATCH] remove change_item --- src/entity/gateway/entitygateway.rs | 5 ----- src/entity/gateway/inmemory.rs | 9 --------- src/entity/gateway/postgres/postgres.rs | 8 -------- 3 files changed, 22 deletions(-) diff --git a/src/entity/gateway/entitygateway.rs b/src/entity/gateway/entitygateway.rs index 57d2b8c..7aeb2c3 100644 --- a/src/entity/gateway/entitygateway.rs +++ b/src/entity/gateway/entitygateway.rs @@ -65,11 +65,6 @@ pub trait EntityGateway: Send + Sync + Clone { unimplemented!(); } - // TODO: remove - async fn change_item(&mut self, _id: &ItemEntityId, _item: &ItemDetail) -> Result<(), GatewayError> { - unimplemented!(); - } - async fn change_item_location(&mut self, _item_id: &ItemEntityId, _item_location: ItemLocation) -> Result<(), GatewayError> { unimplemented!(); } diff --git a/src/entity/gateway/inmemory.rs b/src/entity/gateway/inmemory.rs index 04924ab..e3a1c36 100644 --- a/src/entity/gateway/inmemory.rs +++ b/src/entity/gateway/inmemory.rs @@ -223,15 +223,6 @@ impl EntityGateway for InMemoryGateway { Ok(new_item) } - async fn change_item(&mut self, id: &ItemEntityId, item: &ItemDetail) -> Result<(), GatewayError> { - let mut items = self.items.lock().unwrap(); - if let Some((_, ref mut old_item)) = items.iter_mut().find(|(existing_id, _)| **existing_id == *id) { - old_item.item = item.clone(); - } - - Ok(()) - } - async fn change_item_location(&mut self, item_id: &ItemEntityId, item_location: ItemLocation) -> Result<(), GatewayError> { self.items.lock().unwrap().get_mut(&item_id) .map(|item_entity| { diff --git a/src/entity/gateway/postgres/postgres.rs b/src/entity/gateway/postgres/postgres.rs index 00de8ba..b041790 100644 --- a/src/entity/gateway/postgres/postgres.rs +++ b/src/entity/gateway/postgres/postgres.rs @@ -331,14 +331,6 @@ impl EntityGateway for PostgresGateway { */ } - async fn change_item(&mut self, id: &ItemEntityId, item: &ItemDetail) -> Result<(), GatewayError> { - sqlx::query("update item set item = $1 where id = $2") - .bind(sqlx::types::Json(PgItemDetail::from(item.clone()))) - .bind(id.0) - .execute(&self.pool).await?; - Ok(()) - } - async fn change_item_location(&mut self, item_id: &ItemEntityId, item_location: ItemLocation) -> Result<(), GatewayError> { sqlx::query("insert into item_location (item, location) values ($1, $2)") .bind(item_id.0)