mirror of https://github.com/buster-so/buster.git
make database source of truth for assettype enum
This commit is contained in:
parent
c47f28a4bc
commit
3fb8d8c425
|
@ -1,6 +1,8 @@
|
|||
// Type definitions for database enums
|
||||
import { z } from 'zod';
|
||||
|
||||
export type AssetType = 'chat' | 'metric_file' | 'dashboard_file' | 'report_file' | 'collection';
|
||||
export const AssetTypeSchema = z.enum(['chat', 'metric_file', 'dashboard_file', 'report_file', 'collection']);
|
||||
export type AssetType = z.infer<typeof AssetTypeSchema>;
|
||||
|
||||
export type AssetPermissionRole =
|
||||
| 'owner'
|
||||
|
|
|
@ -19,11 +19,12 @@ import {
|
|||
uuid,
|
||||
varchar,
|
||||
} from 'drizzle-orm/pg-core';
|
||||
import type {
|
||||
OrganizationColorPalettes,
|
||||
UserPersonalizationConfigType,
|
||||
UserShortcutTrackingType,
|
||||
UserSuggestedPromptsType,
|
||||
import {
|
||||
AssetTypeSchema,
|
||||
type OrganizationColorPalettes,
|
||||
type UserPersonalizationConfigType,
|
||||
type UserShortcutTrackingType,
|
||||
type UserSuggestedPromptsType,
|
||||
} from './schema-types';
|
||||
import { DEFAULT_USER_SUGGESTED_PROMPTS } from './schema-types/user';
|
||||
import type { MessageMetadata } from './schemas/message-schemas';
|
||||
|
@ -36,13 +37,7 @@ export const assetPermissionRoleEnum = pgEnum('asset_permission_role_enum', [
|
|||
'can_filter',
|
||||
'can_view',
|
||||
]);
|
||||
export const assetTypeEnum = pgEnum('asset_type_enum', [
|
||||
'chat',
|
||||
'metric_file',
|
||||
'dashboard_file',
|
||||
'report_file',
|
||||
'collection',
|
||||
]);
|
||||
export const assetTypeEnum = pgEnum('asset_type_enum', AssetTypeSchema.options);
|
||||
// Asset type enum removed - now using text for all asset_type columns
|
||||
export const dataSourceOnboardingStatusEnum = pgEnum('data_source_onboarding_status_enum', [
|
||||
'notStarted',
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import { z } from 'zod';
|
||||
import { AssetTypeSchema } from '@buster/database';
|
||||
import type { AssetType } from '@buster/database';
|
||||
import type { z } from 'zod';
|
||||
|
||||
export const BaseAssetTypeSchema = z.enum(['metric_file', 'dashboard_file', 'report_file']);
|
||||
export const BaseAssetTypeSchema = AssetTypeSchema.exclude(['chat', 'collection']);
|
||||
|
||||
export type BaseAssetType = z.infer<typeof BaseAssetTypeSchema>;
|
||||
|
||||
export const AssetTypeSchema = z.enum([...BaseAssetTypeSchema.options, 'chat', 'collection']);
|
||||
export { AssetTypeSchema };
|
||||
|
||||
export type AssetType = z.infer<typeof AssetTypeSchema>;
|
||||
export type { AssetType };
|
Loading…
Reference in New Issue