Trees: Expanding sibling endpoints to include all entities with trees (#20150)
* Adding member types sibling endpoints * Introducing sibling endpoint for Partial Views and logic. * Introducing sibling endpoint for stylesheets * Introducing sibling endpoint for scripts * Introducing FileSystemTreeServiceBase.cs * Introducing interfaces for implementation specific services * Introducing services for specific trees * Modifying controller bases to fit new interface and logic. * Obsoleting old constructors related to PartialView * Obsoleting ctors related to Stylesheets * Obsoleting ctors related to scripts * Adding tests for scriptsTreeService * Adding tests for siblings * Removing unused dependencies * Removing signs and replacing it with flags * Fixing breaking changes by obsoletion * Fixing more breaking changes * Registering missing service * Fixing breaking changes again * Changing name of method GetSiblingsViewModels * Rewritten tests for less bloat and less duplicate code * Expanding tests to include other methods from service * Test refactoring: avoided populating file systems that weren't under test, updated encapsulation, renaming, further re-use. * Management API: Expanding the existing sibling endpoints to support trashed entities (#20154) * Refactoring existing logic to include trashed items * Including tests for trashed entities * Groundwork for trashed siblings * Documents trashed siblings endpoint * Controller for Media trashed items * Expanding tests to include a test for trashed siblings * Code review corrections * Resolving code review --------- Co-authored-by: Andy Butland <abutland73@gmail.com>
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Umbraco.Cms.Api.Management.Controllers.Tree;
|
||||
using Umbraco.Cms.Api.Management.Routing;
|
||||
using Umbraco.Cms.Api.Management.Services.FileSystem;
|
||||
using Umbraco.Cms.Core;
|
||||
using Umbraco.Cms.Core.DependencyInjection;
|
||||
using Umbraco.Cms.Core.IO;
|
||||
using Umbraco.Cms.Web.Common.Authorization;
|
||||
|
||||
@@ -13,9 +16,30 @@ namespace Umbraco.Cms.Api.Management.Controllers.Script.Tree;
|
||||
[Authorize(Policy = AuthorizationPolicies.TreeAccessScripts)]
|
||||
public class ScriptTreeControllerBase : FileSystemTreeControllerBase
|
||||
{
|
||||
private readonly IScriptTreeService _scriptTreeService;
|
||||
|
||||
// TODO Remove the static service provider, and replace with base when the other constructors are obsoleted.
|
||||
public ScriptTreeControllerBase(IScriptTreeService scriptTreeService)
|
||||
: this(scriptTreeService, StaticServiceProvider.Instance.GetRequiredService<FileSystems>()) =>
|
||||
_scriptTreeService = scriptTreeService;
|
||||
|
||||
// FileSystem is required therefore, we can't remove it without some wizadry. When obsoletion is due, remove this.
|
||||
[ActivatorUtilitiesConstructor]
|
||||
[Obsolete("Scheduled for removal in Umbraco 19")]
|
||||
public ScriptTreeControllerBase(IScriptTreeService scriptTreeService, FileSystems fileSystems)
|
||||
: base(scriptTreeService)
|
||||
{
|
||||
_scriptTreeService = scriptTreeService;
|
||||
FileSystem = fileSystems.ScriptsFileSystem ??
|
||||
throw new ArgumentException("Missing scripts file system", nameof(fileSystems));
|
||||
}
|
||||
|
||||
[Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")]
|
||||
public ScriptTreeControllerBase(FileSystems fileSystems)
|
||||
: this(StaticServiceProvider.Instance.GetRequiredService<IScriptTreeService>())
|
||||
=> FileSystem = fileSystems.ScriptsFileSystem ??
|
||||
throw new ArgumentException("Missing scripts file system", nameof(fileSystems));
|
||||
|
||||
[Obsolete("Included in the service class. Scheduled to be removed in Umbraco 19")]
|
||||
protected override IFileSystem FileSystem { get; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user