mirror of https://github.com/buster-so/buster.git
scope down more types
This commit is contained in:
parent
4c8875b7c6
commit
6bcd9e7b9e
|
@ -1,9 +1,10 @@
|
|||
import type { AssetType } from '@buster/server-shared/assets';
|
||||
import type { BusterSearchResult } from '@/api/asset_interfaces/search';
|
||||
import { mainApi } from '../instances';
|
||||
|
||||
export const search = async (params: {
|
||||
query: string;
|
||||
asset_types: ('dashboard_file' | 'metric_file' | 'collection')[];
|
||||
asset_types: Extract<AssetType, 'dashboard_file' | 'metric_file' | 'collection'>[];
|
||||
num_results?: number;
|
||||
}) => {
|
||||
return mainApi.post<BusterSearchResult[]>('/search', params).then((res) => res.data);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { AssetType } from '@buster/database';
|
||||
import type { AssetType } from '@buster/database/schema-types';
|
||||
import { z } from 'zod';
|
||||
|
||||
// Internal types for asset permissions
|
||||
|
@ -7,12 +7,7 @@ export const IdentityTypeSchema = z.enum(['user', 'team', 'organization']);
|
|||
export type IdentityType = z.infer<typeof IdentityTypeSchema>;
|
||||
|
||||
// Types that support cascading permissions
|
||||
export type CascadingAssetType =
|
||||
| 'chat'
|
||||
| 'metric_file'
|
||||
| 'dashboard_file'
|
||||
| 'report_file'
|
||||
| 'collection';
|
||||
export type CascadingAssetType = AssetType;
|
||||
|
||||
// Permission roles - matching database AssetPermissionRole enum
|
||||
export const AssetPermissionRoleSchema = z.enum([
|
||||
|
|
|
@ -94,10 +94,7 @@ export function createDoneToolStart(context: DoneToolContext, doneToolState: Don
|
|||
try {
|
||||
await updateChat(context.chatId, {
|
||||
mostRecentFileId: mostRecentFile.id,
|
||||
mostRecentFileType: mostRecentFile.fileType as
|
||||
| 'metric_file'
|
||||
| 'dashboard_file'
|
||||
| 'report_file',
|
||||
mostRecentFileType: mostRecentFile.fileType,
|
||||
mostRecentVersionNumber: mostRecentFile.versionNumber || 1,
|
||||
});
|
||||
} catch (error) {
|
||||
|
|
Loading…
Reference in New Issue