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::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,

View File

@ -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<Uuid>, asset_type: AssetType) -> Result<St
}
AssetType::Thread => {
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<Uuid>, asset_type: AssetType) -> Result<St
AssetType::Chat => {
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)