* Rename ModelsBuilderDashboard folder to ModelsBuilder * Fix modelsbuilder paths and related naming * Rename analytics route to telemetry * Fix controller bases - routes and tags * Fix items route * Fix more controllerbase routes * Fix route * Fix OpenApi file * Merging DictionaryItem and Dictionary * Fix TrackedReferences naming * Update OpenApi file * Rename Analytics* related types to Telemetry* * New Backoffice: Return AnalyticsLevelViewModel from Telemetry/ (#13298) * Return TelemetryLevelViewModel instead of TelemetryLevel * Fix schema * Change telemetry/current to telemetry/level (cherry picked from commit f2b8494c669cbbf04b623753abbf1be211973aa9) * Add contants for tree and recycle-bin subpaths (cherry picked from commit 4449f56bc00832ea6d357a3854b454791c80e0e2) Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>
40 lines
1.5 KiB
C#
40 lines
1.5 KiB
C#
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Umbraco.Cms.Core.Models;
|
|
using Umbraco.Cms.Core.Services;
|
|
using Umbraco.Cms.ManagementApi.Services.Paging;
|
|
using Umbraco.Cms.ManagementApi.ViewModels.Pagination;
|
|
using Umbraco.Cms.ManagementApi.ViewModels.Tree;
|
|
|
|
namespace Umbraco.Cms.ManagementApi.Controllers.Dictionary.Tree;
|
|
|
|
public class RootDictionaryTreeController : DictionaryTreeControllerBase
|
|
{
|
|
public RootDictionaryTreeController(IEntityService entityService, ILocalizationService localizationService)
|
|
: base(entityService, localizationService)
|
|
{
|
|
}
|
|
|
|
[HttpGet("root")]
|
|
[MapToApiVersion("1.0")]
|
|
[ProducesResponseType(typeof(PagedViewModel<EntityTreeItemViewModel>), StatusCodes.Status200OK)]
|
|
public async Task<ActionResult<PagedViewModel<EntityTreeItemViewModel>>> Root(int skip = 0, int take = 100)
|
|
{
|
|
if (PaginationService.ConvertSkipTakeToPaging(skip, take, out var pageNumber, out var pageSize, out ProblemDetails? error) == false)
|
|
{
|
|
return BadRequest(error);
|
|
}
|
|
|
|
IDictionaryItem[] dictionaryItems = PaginatedDictionaryItems(
|
|
pageNumber,
|
|
pageSize,
|
|
LocalizationService.GetRootDictionaryItems(),
|
|
out var totalItems);
|
|
|
|
EntityTreeItemViewModel[] viewModels = MapTreeItemViewModels(null, dictionaryItems);
|
|
|
|
PagedViewModel<EntityTreeItemViewModel> result = PagedViewModel(viewModels, totalItems);
|
|
return await Task.FromResult(Ok(result));
|
|
}
|
|
}
|