Skip to content

Commit

Permalink
Preview urls docs fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStehle committed Jan 8, 2019
1 parent 58bb930 commit 68e7cc7
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 15 deletions.
15 changes: 15 additions & 0 deletions src/Squidex/Areas/Api/Controllers/Schemas/Models/PreviewUrlsDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================

using System.Collections.Generic;

namespace Squidex.Areas.Api.Controllers.Schemas.Models
{
public sealed class PreviewUrlsDto : Dictionary<string, string>
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,14 @@ public static SchemaDetailsDto FromSchema(ISchemaEntity schema)
foreach (var field in schema.SchemaDef.Fields)
{
var fieldPropertiesDto = FieldPropertiesDtoFactory.Create(field.RawProperties);
var fieldDto = SimpleMapper.Map(field,
new FieldDto
{
FieldId = field.Id,
Properties = fieldPropertiesDto,
Partitioning = field.Partitioning.Key
});
var fieldDto =
SimpleMapper.Map(field,
new FieldDto
{
FieldId = field.Id,
Properties = fieldPropertiesDto,
Partitioning = field.Partitioning.Key
});

if (field is IArrayField arrayField)
{
Expand All @@ -143,12 +144,13 @@ public static SchemaDetailsDto FromSchema(ISchemaEntity schema)
foreach (var nestedField in arrayField.Fields)
{
var nestedFieldPropertiesDto = FieldPropertiesDtoFactory.Create(nestedField.RawProperties);
var nestedFieldDto = SimpleMapper.Map(nestedField,
new NestedFieldDto
{
FieldId = nestedField.Id,
Properties = nestedFieldPropertiesDto
});
var nestedFieldDto =
SimpleMapper.Map(nestedField,
new NestedFieldDto
{
FieldId = nestedField.Id,
Properties = nestedFieldPropertiesDto
});

fieldDto.Nested.Add(nestedFieldDto);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ public async Task<IActionResult> PutCategory(string app, string name, [FromBody]
[Route("apps/{app}/schemas/{name}/preview-urls")]
[ApiPermission(Permissions.AppSchemasUpdate)]
[ApiCosts(1)]
public async Task<IActionResult> PutPreviewUrls(string app, string name, [FromBody] Dictionary<string, string> request)
public async Task<IActionResult> PutPreviewUrls(string app, string name, [FromBody] PreviewUrlsDto request)
{
await CommandBus.PublishAsync(new ConfigurePreviewUrls { PreviewUrls = request ?? new Dictionary<string, string>() });
await CommandBus.PublishAsync(new ConfigurePreviewUrls { PreviewUrls = request ?? new PreviewUrlsDto() });

return NoContent();
}
Expand Down

0 comments on commit 68e7cc7

Please sign in to comment.