diff --git a/lib/modules/asset/AssetsGroupsController.ts b/lib/modules/asset/AssetsGroupsController.ts index be717793..6992aa12 100644 --- a/lib/modules/asset/AssetsGroupsController.ts +++ b/lib/modules/asset/AssetsGroupsController.ts @@ -257,6 +257,7 @@ export class AssetsGroupsController { lastUpdate: Date.now(), name: body.name, parent: body.parent ?? null, + type: body.type ?? null, }, _id, ); diff --git a/lib/modules/asset/collections/assetsGroupsMapping.ts b/lib/modules/asset/collections/assetsGroupsMapping.ts index 851ad8bc..d8334818 100644 --- a/lib/modules/asset/collections/assetsGroupsMapping.ts +++ b/lib/modules/asset/collections/assetsGroupsMapping.ts @@ -27,6 +27,14 @@ export const assetGroupsMappings: CollectionMappings = { }, type: "keyword", }, + type: { + fields: { + text: { + type: "text", + }, + }, + type: "keyword", + }, lastUpdate: { type: "date", }, diff --git a/lib/modules/asset/types/AssetGroupContent.ts b/lib/modules/asset/types/AssetGroupContent.ts index 9faac443..fa05ebc1 100644 --- a/lib/modules/asset/types/AssetGroupContent.ts +++ b/lib/modules/asset/types/AssetGroupContent.ts @@ -2,6 +2,7 @@ import { KDocumentContent } from "kuzzle-sdk"; export interface AssetsGroupsBody { name: string; + type: string | null; children: string[]; parent: string | null; lastUpdate: number; diff --git a/lib/modules/asset/types/AssetGroupsApi.ts b/lib/modules/asset/types/AssetGroupsApi.ts index 9e93ccc1..780136fb 100644 --- a/lib/modules/asset/types/AssetGroupsApi.ts +++ b/lib/modules/asset/types/AssetGroupsApi.ts @@ -11,7 +11,7 @@ import { AssetsGroupsBody, AssetsGroupContent } from "./AssetGroupContent"; type AssetsGroupsRequest = Omit; // Make "parent" property to optional for request export type AssetsGroupsBodyRequest = Partial & - Omit; + Omit; export type UpdateAssetLinkResponse = mUpdateResponse & { assetsGroups: KDocument; diff --git a/tests/fixtures/assetsGroups.ts b/tests/fixtures/assetsGroups.ts index ca72606b..c720f52d 100644 --- a/tests/fixtures/assetsGroups.ts +++ b/tests/fixtures/assetsGroups.ts @@ -13,6 +13,7 @@ export const assetGroupTestBody: AssetsGroupsBody = { children: [], lastUpdate: Date.now(), parent: null, + type: null, }; export const assetGroupTestParentBody1: AssetsGroupsBody = { @@ -20,6 +21,7 @@ export const assetGroupTestParentBody1: AssetsGroupsBody = { children: [assetGroupTestChildrenId1], lastUpdate: Date.now(), parent: null, + type: "Type 1", }; export const assetGroupTestParentBody2: AssetsGroupsBody = { @@ -27,6 +29,7 @@ export const assetGroupTestParentBody2: AssetsGroupsBody = { children: [assetGroupTestChildrenId2], lastUpdate: Date.now(), parent: null, + type: null, }; export const assetGroupTestChildrenBody1: AssetsGroupsBody = { @@ -34,6 +37,7 @@ export const assetGroupTestChildrenBody1: AssetsGroupsBody = { children: [], lastUpdate: Date.now(), parent: assetGroupTestParentId1, + type: null, }; export const assetGroupTestChildrenBody2: AssetsGroupsBody = { @@ -41,6 +45,7 @@ export const assetGroupTestChildrenBody2: AssetsGroupsBody = { children: [], lastUpdate: Date.now(), parent: assetGroupTestParentId2, + type: "Type 2", }; export const assetGroupParentWithAssetBody: AssetsGroupsBody = { @@ -48,6 +53,7 @@ export const assetGroupParentWithAssetBody: AssetsGroupsBody = { children: [assetGroupChildrenWithAssetId], lastUpdate: Date.now(), parent: null, + type: null, }; export const assetGroupChildrenWithAssetBody: AssetsGroupsBody = { @@ -55,6 +61,7 @@ export const assetGroupChildrenWithAssetBody: AssetsGroupsBody = { children: [], lastUpdate: Date.now(), parent: assetGroupParentWithAssetId, + type: null, }; export const assetGroupFixtures = {