This commit is contained in:
2025-10-29 22:27:32 +01:00
parent 7a6ac5f0be
commit 5fe0da1a65
4 changed files with 83 additions and 87 deletions
+1 -19
View File
@@ -1,9 +1,4 @@
use diesel::{
dsl::{exists, select},
pg::PgConnection,
prelude::*,
sql_types::Text,
};
use diesel::{pg::PgConnection, prelude::*, sql_types::Text};
use serde_json::json;
use uuid::Uuid;
@@ -51,10 +46,6 @@ impl TenantService {
Ok(tenant)
}
pub fn tenant_id_for_name(&self, name: &str) -> AppResult<Uuid> {
Ok(self.get_by_name(name)?.id)
}
pub fn create_tenant(
&self,
name: &str,
@@ -74,15 +65,6 @@ impl TenantService {
AppError::internal("database pool error")
})?;
let exists: bool =
select(exists(dsl::tenants.filter(dsl::name.eq(name)))).get_result(&mut conn)?;
if exists {
return Err(AppError::conflict(format!(
"tenant '{}' already exists",
name
)));
}
let id = Uuid::new_v4();
let storage_root = normalize_storage_root(storage_root, id);
let quickwit_index = normalize_quickwit_index(quickwit_index, id);