use unique and add entity-type

This commit is contained in:
Mads Rasmussen
2024-01-15 18:49:48 +01:00
parent d075ad7fa7
commit 81b990ddce

View File

@@ -1,3 +1,4 @@
import { UMB_MEDIA_TYPE_ENTITY_TYPE, UMB_MEDIA_TYPE_FOLDER_ENTITY_TYPE } from '../entity.js';
import { UmbMediaTypeTreeItemModel } from './types.js';
import { MediaTypeResource, MediaTypeTreeItemResponseModel } from '@umbraco-cms/backoffice/backend-api';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
@@ -43,10 +44,10 @@ const getChildrenOf = (parentUnique: string | null) => {
const mapper = (item: MediaTypeTreeItemResponseModel): UmbMediaTypeTreeItemModel => {
return {
id: item.id,
parentId: item.parentId || null,
unique: item.id,
parentUnique: item.parentId || null,
name: item.name,
entityType: 'media-type',
entityType: item.isFolder ? UMB_MEDIA_TYPE_FOLDER_ENTITY_TYPE : UMB_MEDIA_TYPE_ENTITY_TYPE,
hasChildren: item.hasChildren,
isContainer: item.isContainer,
isFolder: item.isFolder,