Skip to content

Commit

Permalink
fix: removing update_tenant function
Browse files Browse the repository at this point in the history
  • Loading branch information
geekbrother committed Feb 1, 2024
1 parent 994ec79 commit f5170fc
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 39 deletions.
18 changes: 0 additions & 18 deletions src/stores/tenant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ pub trait TenantStore {
async fn get_tenant(&self, id: &str) -> Result<Tenant>;
async fn delete_tenant(&self, id: &str) -> Result<()>;
async fn create_tenant(&self, params: TenantUpdateParams) -> Result<Tenant>;
async fn update_tenant(&self, id: &str, params: TenantUpdateParams) -> Result<Tenant>;
async fn update_tenant_fcm(&self, id: &str, params: TenantFcmUpdateParams) -> Result<Tenant>;
async fn update_tenant_apns(&self, id: &str, params: TenantApnsUpdateParams) -> Result<Tenant>;
async fn update_tenant_apns_auth(
Expand Down Expand Up @@ -315,19 +314,6 @@ impl TenantStore for PgPool {
Ok(res)
}

#[instrument(skip(self))]
async fn update_tenant(&self, id: &str, params: TenantUpdateParams) -> Result<Tenant> {
let res = sqlx::query_as::<sqlx::postgres::Postgres, Tenant>(
"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<Tenant> {
let res = sqlx::query_as::<sqlx::postgres::Postgres, Tenant>(
Expand Down Expand Up @@ -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<Tenant> {
panic!("Shouldn't have run in single tenant mode")
}

async fn update_tenant_fcm(&self, _id: &str, _params: TenantFcmUpdateParams) -> Result<Tenant> {
panic!("Shouldn't have run in single tenant mode")
}
Expand Down
21 changes: 0 additions & 21 deletions tests/functional/stores/tenant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f5170fc

Please sign in to comment.