Removed "type" from tree item response models (#15862)

This commit is contained in:
Kenn Jacobsen
2024-03-15 10:37:32 +01:00
committed by GitHub
parent ab3e420cd2
commit 7964f33d0d
10 changed files with 3 additions and 34 deletions

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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

View File

@@ -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"
}

View File

@@ -2,7 +2,5 @@
public class TreeItemPresentationModel
{
public string Type { get; set; } = string.Empty;
public bool HasChildren { get; set; }
}