Model mapping PoC (#15546)
* First take at new models for improved mapping between client and server * Add variants to Media * Re-introduced lost names * Start breaking apart "Id" reference properties in request models as well * Refactor to fix OpenAPI spec * Discard TODO (not relevant) * Split recycle bin response models * Delete unused marker interface * Use reference properties for content and media type handling * Rework document and media types to be explicit in relations (do not expose "content type", it is an implementation detail) * Mapping for document and media type copy + move * Ensure correct response model for Media * Regenerate OpenAPI JSON after forward merge * Fix forward merge issues * Fix forward merge + regenerate OpenApi.json * Added unit tests for content state helper * Move "allowed document types" endpoint to document type silo, refactored services and added "allowed media types" * Regenerate OpenApi.json after forward merge * Do not include content state for media items * Review fix
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Umbraco.Cms.Api.Common.ViewModels.Pagination;
|
||||
using Umbraco.Cms.Api.Management.Services.Paging;
|
||||
using Umbraco.Cms.Api.Management.ViewModels;
|
||||
using Umbraco.Cms.Api.Management.ViewModels.Tree;
|
||||
using Umbraco.Cms.Core;
|
||||
using Umbraco.Cms.Core.Models;
|
||||
@@ -115,12 +116,15 @@ public abstract class EntityTreeControllerBase<TItem> : ManagementApiControllerB
|
||||
{
|
||||
var viewModel = new TItem
|
||||
{
|
||||
Name = entity.Name!,
|
||||
Id = entity.Key,
|
||||
Type = _itemUdiType,
|
||||
HasChildren = entity.HasChildren,
|
||||
IsContainer = entity.IsContainer,
|
||||
ParentId = parentKey
|
||||
Parent = parentKey.HasValue
|
||||
? new ReferenceByIdModel
|
||||
{
|
||||
Id = parentKey.Value
|
||||
}
|
||||
: null
|
||||
};
|
||||
|
||||
return viewModel;
|
||||
|
||||
Reference in New Issue
Block a user