Skip to content

Commit

Permalink
Merge branch '2-dev' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrng committed Jan 8, 2025
2 parents bd45c8d + b39e221 commit f2f7e5a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/modules/asset/AssetsGroupsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ export class AssetsGroupsController {
lastUpdate: Date.now(),
name: body.name,
parent: body.parent ?? null,
type: body.type ?? null,
},
_id,
);
Expand Down
8 changes: 8 additions & 0 deletions lib/modules/asset/collections/assetsGroupsMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ export const assetGroupsMappings: CollectionMappings = {
},
type: "keyword",
},
type: {
fields: {
text: {
type: "text",
},
},
type: "keyword",
},
lastUpdate: {
type: "date",
},
Expand Down
1 change: 1 addition & 0 deletions lib/modules/asset/types/AssetGroupContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { KDocumentContent } from "kuzzle-sdk";

export interface AssetsGroupsBody {
name: string;
type: string | null;
children: string[];
parent: string | null;
lastUpdate: number;
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/asset/types/AssetGroupsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { AssetsGroupsBody, AssetsGroupContent } from "./AssetGroupContent";
type AssetsGroupsRequest = Omit<AssetsGroupsBody, "lastUpdate">;
// Make "parent" property to optional for request
export type AssetsGroupsBodyRequest = Partial<AssetsGroupsRequest> &
Omit<AssetsGroupsRequest, "parent">;
Omit<AssetsGroupsRequest, "parent" | "type">;

export type UpdateAssetLinkResponse = mUpdateResponse & {
assetsGroups: KDocument<AssetsGroupContent>;
Expand Down
7 changes: 7 additions & 0 deletions tests/fixtures/assetsGroups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,55 @@ export const assetGroupTestBody: AssetsGroupsBody = {
children: [],
lastUpdate: Date.now(),
parent: null,
type: null,
};

export const assetGroupTestParentBody1: AssetsGroupsBody = {
name: "Test parent 1",
children: [assetGroupTestChildrenId1],
lastUpdate: Date.now(),
parent: null,
type: "Type 1",
};

export const assetGroupTestParentBody2: AssetsGroupsBody = {
name: "Test parent 2",
children: [assetGroupTestChildrenId2],
lastUpdate: Date.now(),
parent: null,
type: null,
};

export const assetGroupTestChildrenBody1: AssetsGroupsBody = {
name: "Test children 1",
children: [],
lastUpdate: Date.now(),
parent: assetGroupTestParentId1,
type: null,
};

export const assetGroupTestChildrenBody2: AssetsGroupsBody = {
name: "Test children 2",
children: [],
lastUpdate: Date.now(),
parent: assetGroupTestParentId2,
type: "Type 2",
};

export const assetGroupParentWithAssetBody: AssetsGroupsBody = {
name: "Parent Group with asset",
children: [assetGroupChildrenWithAssetId],
lastUpdate: Date.now(),
parent: null,
type: null,
};

export const assetGroupChildrenWithAssetBody: AssetsGroupsBody = {
name: "Children Group with asset",
children: [],
lastUpdate: Date.now(),
parent: assetGroupParentWithAssetId,
type: null,
};

export const assetGroupFixtures = {
Expand Down

0 comments on commit f2f7e5a

Please sign in to comment.