From f5170fc0242359929c45575d3e6dccf134085cfa Mon Sep 17 00:00:00 2001 From: Max Kalashnikoff Date: Thu, 1 Feb 2024 14:51:06 +0100 Subject: [PATCH] fix: removing update_tenant function --- src/stores/tenant.rs | 18 ------------------ tests/functional/stores/tenant.rs | 21 --------------------- 2 files changed, 39 deletions(-) diff --git a/src/stores/tenant.rs b/src/stores/tenant.rs index 788c51c1..5783f38d 100644 --- a/src/stores/tenant.rs +++ b/src/stores/tenant.rs @@ -258,7 +258,6 @@ pub trait TenantStore { async fn get_tenant(&self, id: &str) -> Result; async fn delete_tenant(&self, id: &str) -> Result<()>; async fn create_tenant(&self, params: TenantUpdateParams) -> Result; - async fn update_tenant(&self, id: &str, params: TenantUpdateParams) -> Result; async fn update_tenant_fcm(&self, id: &str, params: TenantFcmUpdateParams) -> Result; async fn update_tenant_apns(&self, id: &str, params: TenantApnsUpdateParams) -> Result; async fn update_tenant_apns_auth( @@ -315,19 +314,6 @@ impl TenantStore for PgPool { Ok(res) } - #[instrument(skip(self))] - async fn update_tenant(&self, id: &str, params: TenantUpdateParams) -> Result { - let res = sqlx::query_as::( - "UPDATE public.tenants SET id = $2, updated_at = NOW() WHERE id = $1 RETURNING *;", - ) - .bind(id) - .bind(params.id) - .fetch_one(self) - .await?; - - Ok(res) - } - #[instrument(skip(self))] async fn update_tenant_fcm(&self, id: &str, params: TenantFcmUpdateParams) -> Result { let res = sqlx::query_as::( @@ -463,10 +449,6 @@ impl TenantStore for DefaultTenantStore { panic!("Shouldn't have run in single tenant mode") } - async fn update_tenant(&self, _id: &str, _params: TenantUpdateParams) -> Result { - panic!("Shouldn't have run in single tenant mode") - } - async fn update_tenant_fcm(&self, _id: &str, _params: TenantFcmUpdateParams) -> Result { panic!("Shouldn't have run in single tenant mode") } diff --git a/tests/functional/stores/tenant.rs b/tests/functional/stores/tenant.rs index 4b5c0b78..ae5aa22d 100644 --- a/tests/functional/stores/tenant.rs +++ b/tests/functional/stores/tenant.rs @@ -61,27 +61,6 @@ async fn tenant_get(ctx: &mut StoreContext) { assert_eq!(tenant.id, id); } -#[test_context(StoreContext)] -#[tokio::test] -async fn tenant_update(ctx: &mut StoreContext) { - let tenant = ctx - .tenants - .create_tenant(TenantUpdateParams { - id: Uuid::new_v4().to_string(), - }) - .await - .expect("creation failed"); - - let res = ctx - .tenants - .update_tenant(&tenant.id, TenantUpdateParams { - id: Uuid::new_v4().to_string(), - }) - .await; - - assert!(res.is_ok()) -} - #[test_context(StoreContext)] #[tokio::test] async fn tenant_fcm(ctx: &mut StoreContext) {