tenants
This commit is contained in:
+1
-19
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user