* Adds support for the "folders only" flag on retrieving siblings of a node. * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Updated test code. * Removed double secondary ordering by node Id and ensured we include this clause for all sort orders. * Ensure that ordering by node Id is always added only once and last, and only if it's not already been included in the order by clause. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
30 lines
1.1 KiB
C#
30 lines
1.1 KiB
C#
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Umbraco.Cms.Api.Common.ViewModels.Pagination;
|
|
using Umbraco.Cms.Api.Management.Factories;
|
|
using Umbraco.Cms.Api.Management.ViewModels.Tree;
|
|
using Umbraco.Cms.Core.Services;
|
|
|
|
namespace Umbraco.Cms.Api.Management.Controllers.DocumentBlueprint.Tree;
|
|
|
|
public class SiblingsDocumentBlueprintTreeController : DocumentBlueprintTreeControllerBase
|
|
{
|
|
public SiblingsDocumentBlueprintTreeController(IEntityService entityService, IDocumentPresentationFactory documentPresentationFactory)
|
|
: base(entityService, documentPresentationFactory)
|
|
{
|
|
}
|
|
|
|
[HttpGet("siblings")]
|
|
[ProducesResponseType(typeof(SubsetViewModel<DocumentBlueprintTreeItemResponseModel>), StatusCodes.Status200OK)]
|
|
public async Task<ActionResult<SubsetViewModel<DocumentBlueprintTreeItemResponseModel>>> Siblings(
|
|
CancellationToken cancellationToken,
|
|
Guid target,
|
|
int before,
|
|
int after,
|
|
bool foldersOnly = false)
|
|
{
|
|
RenderFoldersOnly(foldersOnly);
|
|
return await GetSiblings(target, before, after);
|
|
}
|
|
}
|