Removed "type" from tree item response models (#15862)
This commit is contained in:
@@ -36,7 +36,6 @@ public class DictionaryTreeControllerBase : NamedEntityTreeControllerBase<NamedE
|
||||
{
|
||||
Name = dictionaryItem.ItemKey,
|
||||
Id = dictionaryItem.Key,
|
||||
Type = Constants.UdiEntityType.DictionaryItem,
|
||||
HasChildren = hasChildren,
|
||||
Parent = parentKey.HasValue
|
||||
? new ReferenceByIdModel
|
||||
|
||||
@@ -18,6 +18,4 @@ public class PartialViewTreeControllerBase : FileSystemTreeControllerBase
|
||||
throw new ArgumentException("Missing partial views file system", nameof(fileSystems));
|
||||
|
||||
protected override IFileSystem FileSystem { get; }
|
||||
|
||||
protected override string ItemType(string path) => Constants.UdiEntityType.PartialView;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ public class RelationTypeTreeControllerBase : NamedEntityTreeControllerBase<Rela
|
||||
{
|
||||
Name = relationType.Name!,
|
||||
Id = relationType.Key,
|
||||
Type = Constants.UdiEntityType.RelationType,
|
||||
HasChildren = false,
|
||||
IsDeletable = relationType.IsDeletableRelationType(),
|
||||
Parent = parentKey.HasValue
|
||||
|
||||
@@ -18,6 +18,4 @@ public class ScriptTreeControllerBase : FileSystemTreeControllerBase
|
||||
throw new ArgumentException("Missing scripts file system", nameof(fileSystems));
|
||||
|
||||
protected override IFileSystem FileSystem { get; }
|
||||
|
||||
protected override string ItemType(string path) => Constants.UdiEntityType.Script;
|
||||
}
|
||||
|
||||
@@ -17,8 +17,6 @@ public class StaticFileTreeControllerBase : FileSystemTreeControllerBase
|
||||
|
||||
protected override IFileSystem FileSystem { get; }
|
||||
|
||||
protected override string ItemType(string path) => "static-file";
|
||||
|
||||
protected override string[] GetDirectories(string path) =>
|
||||
IsTreeRootPath(path)
|
||||
? _allowedRootFolders
|
||||
|
||||
@@ -18,6 +18,4 @@ public class StylesheetTreeControllerBase : FileSystemTreeControllerBase
|
||||
throw new ArgumentException("Missing stylesheets file system", nameof(fileSystems));
|
||||
|
||||
protected override IFileSystem FileSystem { get; }
|
||||
|
||||
protected override string ItemType(string path) => Constants.UdiEntityType.Stylesheet;
|
||||
}
|
||||
|
||||
@@ -13,15 +13,8 @@ namespace Umbraco.Cms.Api.Management.Controllers.Tree;
|
||||
public abstract class EntityTreeControllerBase<TItem> : ManagementApiControllerBase
|
||||
where TItem : EntityTreeItemResponseModel, new()
|
||||
{
|
||||
private readonly string _itemUdiType;
|
||||
|
||||
protected EntityTreeControllerBase(IEntityService entityService)
|
||||
{
|
||||
EntityService = entityService;
|
||||
|
||||
// ReSharper disable once VirtualMemberCallInConstructor
|
||||
_itemUdiType = ItemObjectType.GetUdiType();
|
||||
}
|
||||
=> EntityService = entityService;
|
||||
|
||||
protected IEntityService EntityService { get; }
|
||||
|
||||
@@ -94,7 +87,6 @@ public abstract class EntityTreeControllerBase<TItem> : ManagementApiControllerB
|
||||
var viewModel = new TItem
|
||||
{
|
||||
Id = entity.Key,
|
||||
Type = _itemUdiType,
|
||||
HasChildren = entity.HasChildren,
|
||||
Parent = parentKey.HasValue
|
||||
? new ReferenceByIdModel
|
||||
|
||||
@@ -12,8 +12,6 @@ public abstract class FileSystemTreeControllerBase : ManagementApiControllerBase
|
||||
{
|
||||
protected abstract IFileSystem FileSystem { get; }
|
||||
|
||||
protected abstract string ItemType(string path);
|
||||
|
||||
protected async Task<ActionResult<PagedViewModel<FileSystemTreeItemPresentationModel>>> GetRoot(int skip, int take)
|
||||
{
|
||||
FileSystemTreeItemPresentationModel[] viewModels = GetPathViewModels(string.Empty, skip, take, out var totalItems);
|
||||
@@ -77,7 +75,6 @@ public abstract class FileSystemTreeControllerBase : ManagementApiControllerBase
|
||||
Path = path.SystemPathToVirtualPath(),
|
||||
Name = name,
|
||||
HasChildren = isFolder && DirectoryHasChildren(path),
|
||||
Type = ItemType(path),
|
||||
IsFolder = isFolder,
|
||||
Parent = parentPath.IsNullOrWhiteSpace()
|
||||
? null
|
||||
|
||||
@@ -32310,14 +32310,10 @@
|
||||
"hasChildren",
|
||||
"id",
|
||||
"isTrashed",
|
||||
"noAccess",
|
||||
"type"
|
||||
"noAccess"
|
||||
],
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"hasChildren": {
|
||||
"type": "boolean"
|
||||
},
|
||||
@@ -39794,14 +39790,10 @@
|
||||
},
|
||||
"TreeItemPresentationModel": {
|
||||
"required": [
|
||||
"hasChildren",
|
||||
"type"
|
||||
"hasChildren"
|
||||
],
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"hasChildren": {
|
||||
"type": "boolean"
|
||||
}
|
||||
|
||||
@@ -2,7 +2,5 @@
|
||||
|
||||
public class TreeItemPresentationModel
|
||||
{
|
||||
public string Type { get; set; } = string.Empty;
|
||||
|
||||
public bool HasChildren { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user