diff --git a/apps/web/src/api/buster_rest/metrics/getMetricQueryRequests.ts b/apps/web/src/api/buster_rest/metrics/getMetricQueryRequests.ts index d1157a116..08a855c02 100644 --- a/apps/web/src/api/buster_rest/metrics/getMetricQueryRequests.ts +++ b/apps/web/src/api/buster_rest/metrics/getMetricQueryRequests.ts @@ -13,6 +13,7 @@ import type { BusterMetricDataExtended, } from '@/api/asset_interfaces/metric'; import { metricsQueryKeys } from '@/api/query_keys/metric'; +import { silenceAssetErrors } from '@/api/repsonse-helpers/silenece-asset-errors'; import { getProtectedAssetPassword, setProtectedAssetPasswordError, @@ -131,6 +132,7 @@ export const prefetchGetMetric = async ( password: undefined, queryClient, }), + retry: silenceAssetErrors, }); } diff --git a/packages/database/src/queries/cascading-permissions/check-collections-containing-asset.ts b/packages/database/src/queries/cascading-permissions/check-collections-containing-asset.ts index c79abee88..acb11b77b 100644 --- a/packages/database/src/queries/cascading-permissions/check-collections-containing-asset.ts +++ b/packages/database/src/queries/cascading-permissions/check-collections-containing-asset.ts @@ -11,19 +11,9 @@ export interface CollectionWithSharing { export async function checkCollectionsContainingAsset( assetId: string, - assetType: 'metric_file' | 'dashboard_file' | 'chat' + assetType: Extract ): Promise { - // Map our asset type strings to the enum values expected by the database - const assetTypeMap: Record = { - metric: 'metric_file', - dashboard: 'dashboard_file', - chat: 'chat', - }; - - const dbAssetType = assetTypeMap[assetType]; - if (!dbAssetType) { - throw new Error(`Invalid asset type: ${assetType}`); - } + // The asset type parameter already matches the AssetType enum values const result = await db .select({ @@ -36,7 +26,7 @@ export async function checkCollectionsContainingAsset( .where( and( eq(collectionsToAssets.assetId, assetId), - eq(collectionsToAssets.assetType, dbAssetType), + eq(collectionsToAssets.assetType, assetType), isNull(collectionsToAssets.deletedAt), isNull(collections.deletedAt) )