linting, tenant slug -> name

This commit is contained in:
2025-10-29 18:26:59 +01:00
parent b6bcb72165
commit abc0116945
23 changed files with 324 additions and 487 deletions
+7 -7
View File
@@ -140,7 +140,7 @@ impl TestApp {
s3_bucket: "test-bucket".to_string(),
quickwit_endpoint: None,
quickwit_index: None,
default_tenant_slug: "admin".to_string(),
default_tenant_name: "admin".to_string(),
worker_max_document_bytes: 200 * 1024 * 1024,
webauthn_rp_id: Some("localhost".to_string()),
webauthn_origin: Some("http://localhost".to_string()),
@@ -193,7 +193,7 @@ impl TestApp {
let tenant = self
.state
.tenants
.get_by_slug(&self.state.config.default_tenant_slug)
.get_by_name(&self.state.config.default_tenant_name)
.map_err(|err| anyhow!("default tenant not found: {:?}", err))?;
let root = tenant
.storage_root
@@ -208,7 +208,7 @@ impl TestApp {
let tenant_id = self
.state
.tenants
.tenant_id_for_slug(&self.state.config.default_tenant_slug)
.tenant_id_for_name(&self.state.config.default_tenant_name)
.map_err(|err| anyhow!("default tenant not found: {:?}", err))?;
self.with_conn(move |conn| {
let password_hash = hash_password(&password)?;
@@ -264,13 +264,13 @@ impl TestApp {
}
async fn ensure_default_tenant(&self) -> Result<Uuid> {
let slug_value = self.state.config.default_tenant_slug.clone();
let name_value = self.state.config.default_tenant_name.clone();
let quickwit_enabled = self.state.config.quickwit_endpoint.is_some();
self.with_conn(move |conn| {
use backend::schema::tenants::dsl as tenants_dsl;
let existing = tenants_dsl::tenants
.filter(tenants_dsl::slug.eq(&slug_value))
.filter(tenants_dsl::name.eq(&name_value))
.first::<Tenant>(conn)
.optional()
.context("failed to load default tenant")?;
@@ -302,7 +302,7 @@ impl TestApp {
diesel::insert_into(tenants_dsl::tenants)
.values((
tenants_dsl::id.eq(new_id),
tenants_dsl::slug.eq(&slug_value),
tenants_dsl::name.eq(&name_value),
tenants_dsl::storage_root.eq(Some(root)),
tenants_dsl::quickwit_index.eq(quickwit_value),
tenants_dsl::status.eq(TenantStatus::Active),
@@ -352,7 +352,7 @@ impl TestApp {
#[derive(Deserialize)]
struct TenantSummary {
id: Uuid,
_slug: String,
name: String,
}
#[derive(Deserialize)]