small tweaks on asset types

This commit is contained in:
dal 2025-03-11 11:00:23 -06:00
parent 182057426a
commit 3d7673b23e
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
2 changed files with 18 additions and 13 deletions

View File

@ -13,7 +13,6 @@ use axum::http::StatusCode;
use database::enums::{AssetPermissionRole, AssetType, UserOrganizationRole}; use database::enums::{AssetPermissionRole, AssetType, UserOrganizationRole};
use database::pool::{get_pg_pool, PgPool}; use database::pool::{get_pg_pool, PgPool};
use database::models::User;
use database::schema::{ use database::schema::{
asset_permissions, collections_to_assets, dashboards, teams_to_users, threads_deprecated, asset_permissions, collections_to_assets, dashboards, teams_to_users, threads_deprecated,
threads_to_dashboards, users_to_organizations, threads_to_dashboards, users_to_organizations,

View File

@ -18,17 +18,17 @@ use std::{
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use uuid::Uuid; use uuid::Uuid;
use database::{enums::{AssetPermissionRole, AssetType, IdentityType}, use crate::utils::clients::{
pool::get_pg_pool, email::resend::{send_email, CollectionInvite, DashboardInvite, EmailType, ThreadInvite},
models::{AssetPermission, CollectionToAsset, User}, sentry_utils::send_sentry_error,
schema::{ };
asset_permissions, collections, collections_to_assets, dashboards, messages_deprecated, use database::{
organizations, teams, teams_to_users, threads_deprecated, user_favorites, users, enums::{AssetPermissionRole, AssetType, IdentityType},
},}; models::{AssetPermission, CollectionToAsset, User},
use crate::{ pool::get_pg_pool,
utils::clients::{ schema::{
email::resend::{send_email, CollectionInvite, DashboardInvite, EmailType, ThreadInvite}, asset_permissions, collections, collections_to_assets, dashboards, messages_deprecated,
sentry_utils::send_sentry_error, organizations, teams, teams_to_users, threads_deprecated, user_favorites, users,
}, },
}; };
use middleware::AuthenticatedUser; use middleware::AuthenticatedUser;
@ -664,7 +664,10 @@ async fn get_asset_name(asset_id: Arc<Uuid>, asset_type: AssetType) -> Result<St
} }
AssetType::Thread => { AssetType::Thread => {
match messages_deprecated::table 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())) .filter(threads_deprecated::id.eq(asset_id.as_ref()))
.select(messages_deprecated::title.nullable()) .select(messages_deprecated::title.nullable())
.order(messages_deprecated::created_at.desc()) .order(messages_deprecated::created_at.desc())
@ -682,6 +685,9 @@ async fn get_asset_name(asset_id: Arc<Uuid>, asset_type: AssetType) -> Result<St
AssetType::Chat => { AssetType::Chat => {
return Err(anyhow!("Public access is not supported for chats yet")); 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) Ok(name)