From 3d7673b23ec3f55ccf5f77cefabe0ef4eb5a5096 Mon Sep 17 00:00:00 2001 From: dal Date: Tue, 11 Mar 2025 11:00:23 -0600 Subject: [PATCH] small tweaks on asset types --- .../rest/routes/assets/get_asset_access.rs | 1 - api/src/utils/sharing/asset_sharing.rs | 30 +++++++++++-------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/api/src/routes/rest/routes/assets/get_asset_access.rs b/api/src/routes/rest/routes/assets/get_asset_access.rs index debbfd7c9..3a7d124ff 100644 --- a/api/src/routes/rest/routes/assets/get_asset_access.rs +++ b/api/src/routes/rest/routes/assets/get_asset_access.rs @@ -13,7 +13,6 @@ use axum::http::StatusCode; use database::enums::{AssetPermissionRole, AssetType, UserOrganizationRole}; use database::pool::{get_pg_pool, PgPool}; -use database::models::User; use database::schema::{ asset_permissions, collections_to_assets, dashboards, teams_to_users, threads_deprecated, threads_to_dashboards, users_to_organizations, diff --git a/api/src/utils/sharing/asset_sharing.rs b/api/src/utils/sharing/asset_sharing.rs index 0c65f747a..81ec36b53 100644 --- a/api/src/utils/sharing/asset_sharing.rs +++ b/api/src/utils/sharing/asset_sharing.rs @@ -18,17 +18,17 @@ use std::{ use serde::{Deserialize, Serialize}; use uuid::Uuid; -use database::{enums::{AssetPermissionRole, AssetType, IdentityType}, - pool::get_pg_pool, - models::{AssetPermission, CollectionToAsset, User}, - schema::{ - asset_permissions, collections, collections_to_assets, dashboards, messages_deprecated, - organizations, teams, teams_to_users, threads_deprecated, user_favorites, users, - },}; -use crate::{ - utils::clients::{ - email::resend::{send_email, CollectionInvite, DashboardInvite, EmailType, ThreadInvite}, - sentry_utils::send_sentry_error, +use crate::utils::clients::{ + email::resend::{send_email, CollectionInvite, DashboardInvite, EmailType, ThreadInvite}, + sentry_utils::send_sentry_error, +}; +use database::{ + enums::{AssetPermissionRole, AssetType, IdentityType}, + models::{AssetPermission, CollectionToAsset, User}, + pool::get_pg_pool, + schema::{ + asset_permissions, collections, collections_to_assets, dashboards, messages_deprecated, + organizations, teams, teams_to_users, threads_deprecated, user_favorites, users, }, }; use middleware::AuthenticatedUser; @@ -664,7 +664,10 @@ async fn get_asset_name(asset_id: Arc, asset_type: AssetType) -> Result { match messages_deprecated::table - .inner_join(threads_deprecated::table.on(messages_deprecated::thread_id.eq(threads_deprecated::id))) + .inner_join( + threads_deprecated::table + .on(messages_deprecated::thread_id.eq(threads_deprecated::id)), + ) .filter(threads_deprecated::id.eq(asset_id.as_ref())) .select(messages_deprecated::title.nullable()) .order(messages_deprecated::created_at.desc()) @@ -682,6 +685,9 @@ async fn get_asset_name(asset_id: Arc, asset_type: AssetType) -> Result { return Err(anyhow!("Public access is not supported for chats yet")); } + AssetType::Metric => { + return Err(anyhow!("Public access is not supported for metrics yet")); + } }; Ok(name)