diff --git a/src/item/itemSettings.ts b/src/item/itemSettings.ts index 2d88fd24..69d75a0a 100644 --- a/src/item/itemSettings.ts +++ b/src/item/itemSettings.ts @@ -14,6 +14,9 @@ export type ItemSettings = { isResizable?: boolean; isCollapsible?: boolean; enableSaveActions?: boolean; + /** + * @deprecated use entities tags and item tags instead + */ tags?: string[]; displayCoEditors?: boolean; // allow null to delete setting in the backend diff --git a/src/search/search.ts b/src/search/search.ts index 9284e528..e36ea7b5 100644 --- a/src/search/search.ts +++ b/src/search/search.ts @@ -1,6 +1,5 @@ import { ItemTypeUnion } from '@/item/itemType.js'; - -export const INDEX_NAME = 'itemIndex'; +import { TagCategory } from '@/tag/tag.js'; type IndexMember = { id: string; @@ -13,14 +12,13 @@ export type IndexItem = { creator: IndexMember; description: string; type: ItemTypeUnion; - categories: string[]; content: string; isPublishedRoot: boolean; isHidden: boolean; createdAt: string; updatedAt: string; lang: string; -}; +} & { [key in TagCategory]: string[] }; // TODO: get type from meilisearch library? type Hits = IndexItem & { diff --git a/src/tag/factory.ts b/src/tag/factory.ts index 3acfd245..effe853b 100644 --- a/src/tag/factory.ts +++ b/src/tag/factory.ts @@ -1,11 +1,11 @@ import { v4 } from 'uuid'; -import { TagCategory } from './tag.js'; +import { Tag, TagCategory } from './tag.js'; import { faker } from '@faker-js/faker'; export function TagFactory( args: { name?: string; category?: TagCategory } = {}, -) { +): Tag { return { id: v4(), name: args.name ?? faker.word.noun(), diff --git a/src/tag/tag.ts b/src/tag/tag.ts index 85e4b6c8..70eecbbf 100644 --- a/src/tag/tag.ts +++ b/src/tag/tag.ts @@ -1,5 +1,9 @@ +import { UUID } from '@/types.js'; + export enum TagCategory { Level = 'level', Discipline = 'discipline', ResourceType = 'resource-type', } + +export type Tag = { id: UUID; name: string; category: TagCategory };