Add ancestor endpoints and remove explicit parent context (#15746)
* Remove explicit parent context in API outputs * Add ancestor endpoints for document and data type (experimental for now) * Add ancestor endpoints for doctypes, media, mediatypes, partial views, scripts, static files, stylesheets and templates * Add unit tests for ancestor ID parsing * Add ancestor endpoint for dictionary items * Update OpenApi.json * Fix merge and regenerate OpenApi.json * Regenerate OpenApi.json * Rename "folder" to "parent" for consistency * Fix merge * Fix merge * Include "self" in ancestor endpoints * Handle ancestors for root items correctly * Remove "type" from recycle bin items * Tests against fixed values instead of calculated ones. --------- Co-authored-by: Sven Geusens <sge@umbraco.dk>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Management.ViewModels.Tree;
|
||||
using Umbraco.Cms.Core.IO;
|
||||
|
||||
namespace Umbraco.Cms.Api.Management.Controllers.Script.Tree;
|
||||
|
||||
[ApiVersion("1.0")]
|
||||
public class AncestorsScriptTreeController : ScriptTreeControllerBase
|
||||
{
|
||||
public AncestorsScriptTreeController(FileSystems fileSystems)
|
||||
: base(fileSystems)
|
||||
{
|
||||
}
|
||||
|
||||
[HttpGet("ancestors")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(IEnumerable<FileSystemTreeItemPresentationModel>), StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<IEnumerable<FileSystemTreeItemPresentationModel>>> Ancestors(string descendantPath)
|
||||
=> await GetAncestors(descendantPath);
|
||||
}
|
||||
Reference in New Issue
Block a user