Files
Umbraco-CMS/src/Umbraco.Cms.Api.Management/Controllers/Media/Collection/MediaCollectionControllerBase.cs

29 lines
1.2 KiB
C#
Raw Normal View History

V14: Document and media collection view endpoints (#15696) * Fix authz status * Adding another silo for list views * Adding base classes and handling collection operation statuses * Change signature to reuse functionality. Fix references * Adding collection response models * Adding content and media type collection response models * Adding mapping * Adding mapping for document and media types * Adding list view page model * Initial implementation * Moving implementation to service base * Adding content and media service interfaces for handling list views * Registering and implementation * Update controllers to use new services * Renaming param * Refactor to pass content type instead of content type key * Handle the case where only data type is provided * Add missing operation status * Update OpenApi.json * Added comment for a temp workaround * Removing orderCulture from media interface as it is not yet supported * Adding a base class for content type collection reference model * Adding common collection controller base and moving the ContentCollectionOperationStatusResult to there * Cleaning up controllers after implementing the base class * Cleaning up concrete controller bases * OpenApi.json updates * Changing GetPagedChildren to return a paged model * Fix ordering * Adding , * Fix wording * Append operation status to unsuccessful API responses * A little bit of clean-up * Update default orderBy value * Update the default value of orderBy * Adding missing owner and updater system fields * Updating OpenApi.json with owner and updater props * Create base and rename owner to creator * Update OpenApi.json * Reordering of properties * "Owner" will be "creator" * Fix comment --------- Co-authored-by: kjac <kja@umbraco.dk>
2024-02-14 15:13:56 +01:00
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Api.Management.Controllers.Content;
using Umbraco.Cms.Api.Management.Routing;
using Umbraco.Cms.Api.Management.ViewModels.Media;
using Umbraco.Cms.Api.Management.ViewModels.Media.Collection;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Mapping;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Services.OperationStatus;
using Umbraco.Cms.Web.Common.Authorization;
namespace Umbraco.Cms.Api.Management.Controllers.Media.Collection;
[ApiController]
[VersionedApiBackOfficeRoute($"{Constants.Web.RoutePath.Collection}/{Constants.UdiEntityType.Media}")]
[ApiExplorerSettings(GroupName = nameof(Constants.UdiEntityType.Media))]
[Authorize(Policy = "New" + AuthorizationPolicies.SectionAccessMedia)]
public abstract class MediaCollectionControllerBase : ContentCollectionControllerBase<IMedia, MediaCollectionResponseModel, MediaValueModel, MediaVariantResponseModel>
{
protected MediaCollectionControllerBase(IUmbracoMapper mapper)
: base(mapper)
{
}
protected IActionResult CollectionOperationStatusResult(ContentCollectionOperationStatus status)
=> ContentCollectionOperationStatusResult(status, "media");
}