Merge branch 'v13/feature/content-and-content-type-read-api' into v13/feature/content-create-update-delete
This commit is contained in:
@@ -22,8 +22,9 @@ public class ByKeyDocumentController : DocumentControllerBase
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(DocumentViewModel), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<ActionResult<DocumentViewModel>> ByKey(Guid key)
|
||||
public async Task<IActionResult> ByKey(Guid key)
|
||||
{
|
||||
// FIXME: create and use an async get method here.
|
||||
IContent? content = _contentService.GetById(key);
|
||||
if (content == null)
|
||||
{
|
||||
|
||||
@@ -22,8 +22,9 @@ public class ByKeyDocumentTypeController : DocumentTypeControllerBase
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(DocumentTypeViewModel), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<ActionResult<DocumentTypeViewModel>> ByKey(Guid key)
|
||||
public async Task<IActionResult> ByKey(Guid key)
|
||||
{
|
||||
// FIXME: create and use an async get method here.
|
||||
IContentType? contentType = _contentTypeService.Get(key);
|
||||
if (contentType == null)
|
||||
{
|
||||
|
||||
@@ -45,11 +45,7 @@ public class ContentUrlFactory : IContentUrlFactory
|
||||
|
||||
public async Task<IEnumerable<ContentUrlInfo>> GetUrlsAsync(IContent content)
|
||||
{
|
||||
if (_umbracoContextAccessor.TryGetUmbracoContext(out IUmbracoContext? umbracoContext) == false)
|
||||
{
|
||||
_loggerFactory.CreateLogger<ContentUrlFactory>().LogWarning($"Unable to create an Umbraco context while attempting to get URLs for content: {content.Key}");
|
||||
return Array.Empty<ContentUrlInfo>();
|
||||
}
|
||||
IUmbracoContext umbracoContext = _umbracoContextAccessor.GetRequiredUmbracoContext();
|
||||
|
||||
UrlInfo[] urlInfos = (await content.GetContentUrlsAsync(
|
||||
_publishedRouter,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Umbraco.Cms.Api.Management.ViewModels.ContentType;
|
||||
using Umbraco.Cms.Core;
|
||||
using Umbraco.Cms.Core.Models;
|
||||
using Umbraco.Extensions;
|
||||
|
||||
namespace Umbraco.Cms.Api.Management.Mapping.ContentType;
|
||||
|
||||
@@ -29,6 +30,8 @@ public abstract class ContentTypeMapDefinition<TContentType, TPropertyTypeViewMo
|
||||
Alias = propertyType.Alias,
|
||||
Description = propertyType.Description,
|
||||
DataTypeKey = propertyType.DataTypeKey,
|
||||
VariesByCulture = propertyType.VariesByCulture(),
|
||||
VariesBySegment = propertyType.VariesBySegment(),
|
||||
Validation = new PropertyTypeValidation
|
||||
{
|
||||
Mandatory = propertyType.Mandatory,
|
||||
|
||||
@@ -7461,6 +7461,12 @@
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"variesByCulture": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"variesBySegment": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"validation": {
|
||||
"oneOf": [
|
||||
{
|
||||
|
||||
@@ -14,6 +14,10 @@ public abstract class PropertyTypeViewModelBase
|
||||
|
||||
public Guid DataTypeKey { get; set; }
|
||||
|
||||
public bool VariesByCulture { get; set; }
|
||||
|
||||
public bool VariesBySegment { get; set; }
|
||||
|
||||
public PropertyTypeValidation Validation { get; set; } = new();
|
||||
|
||||
public PropertyTypeAppearance Appearance { get; set; } = new();
|
||||
|
||||
Reference in New Issue
Block a user