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:
Kenn Jacobsen
2024-03-25 12:15:50 +01:00
committed by GitHub
parent e441639786
commit f6f868e463
24 changed files with 1308 additions and 53 deletions

View File

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