Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
using MethodConf.Cms.Dtos;
using MethodConf.Cms.Services.Interfaces;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Api.Delivery.Controllers.Content;
using Umbraco.Cms.Api.Management.Controllers.PartialView.Snippet;

namespace MethodConf.Cms.Controllers;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,38 +1,42 @@
using Microsoft.AspNetCore.OpenApi;
using Microsoft.OpenApi;
using Swashbuckle.AspNetCore.SwaggerGen;

namespace MethodConf.Cms.Converters;

public class MultiDimensionalArraySchemaFilter : ISchemaFilter
public class MultiDimensionalArraySchemaFilter : IOpenApiSchemaTransformer
{
public void Apply(IOpenApiSchema schema, SchemaFilterContext context)
public Task TransformAsync(
OpenApiSchema schema,
OpenApiSchemaTransformerContext context,
CancellationToken cancellationToken)
{
if (schema is not OpenApiSchema openApiSchema)
{
return;
}

var type = context.Type;
var type = context.JsonTypeInfo.Type;

if (!type.IsArray || type.GetArrayRank() <= 1)
{
return;
return Task.CompletedTask;
}

var elementType = type.GetElementType();

var elementSchema = context.SchemaGenerator.GenerateSchema(elementType, context.SchemaRepository);
var elementType = type.GetElementType()!;
var elementSchema = CreateElementSchema(elementType);

for (var i = type.GetArrayRank(); i > 0; i--)
{
elementSchema = new OpenApiSchema
{
Type = JsonSchemaType.Array,
Items = elementSchema
Items = elementSchema,
};
}

openApiSchema.Type = JsonSchemaType.Array;
openApiSchema.Items = elementSchema.Items;
schema.Type = JsonSchemaType.Array;
schema.Items = elementSchema.Items;

return Task.CompletedTask;
}

private static OpenApiSchema CreateElementSchema(Type elementType) =>
elementType == typeof(string)
? new OpenApiSchema { Type = JsonSchemaType.String }
: new OpenApiSchema();
}
2 changes: 1 addition & 1 deletion backend/src/MethodConf.Cms/Mapping/DefaultProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public DefaultProfile()
{
CreateMap<ConferenceSchedule, ConferenceScheduleResponseDto>();
CreateMap<Session, SessionItem>()
.ForMember(dest => dest.Key, opts => opts.MapFrom(src => src.UrlSegment));
.ForMember(dest => dest.Key, opts => opts.MapFrom<SessionUrlSegmentResolver>());
CreateMap<Track, TrackItem>()
.ForMember(dest => dest.Sessions, opts => opts.MapFrom((src, _) => src.Children<Session>() ?? []));

Expand Down
21 changes: 21 additions & 0 deletions backend/src/MethodConf.Cms/Mapping/SessionUrlSegmentResolver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using AutoMapper;
using MethodConf.Cms.Domain;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Web.Common.PublishedModels;

namespace MethodConf.Cms.Mapping;

public class SessionUrlSegmentResolver : IValueResolver<Session, SessionItem, string>
{
private readonly IDocumentUrlService _documentUrlService;

public SessionUrlSegmentResolver(IDocumentUrlService documentUrlService)
{
_documentUrlService = documentUrlService;
}

public string Resolve(Session source, SessionItem destination, string destMember, ResolutionContext context)
{
return _documentUrlService.GetUrlSegment(source.Key, "", false) ?? source.Key.ToString();
}
}
5 changes: 2 additions & 3 deletions backend/src/MethodConf.Cms/MethodConf.Cms.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Razor.Templating.Core" Version="3.1.0" />
<PackageReference Include="Umbraco.Cms" Version="17.4.2" />
<PackageReference Include="Umbraco.Community.DeliveryApiExtensions" Version="17.0.0" />
<PackageReference Include="uSync" Version="17.3.2" />
<PackageReference Include="Umbraco.Cms" Version="18.0.2" />
<PackageReference Include="uSync" Version="18.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 3 additions & 2 deletions backend/src/MethodConf.Cms/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using MethodConf.Cms.Converters;
using MethodConf.Cms.Infrastructure;
using MethodConf.Cms.Services;
using Microsoft.AspNetCore.OpenApi;
using Serilog;

var builder = WebApplication.CreateBuilder(args);
Expand All @@ -18,9 +19,9 @@
.AddComposers()
.Build();

builder.Services.AddSwaggerGen(opts =>
builder.Services.Configure<OpenApiOptions>("default", options =>
{
opts.SchemaFilter<MultiDimensionalArraySchemaFilter>();
options.AddSchemaTransformer<MultiDimensionalArraySchemaFilter>();
});

builder.AddApplicationInfrastructure();
Expand Down
5 changes: 4 additions & 1 deletion backend/src/MethodConf.Cms/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
},
"DeliveryApi": {
"Enabled": true,
"PublicAccess": true
"PublicAccess": true,
"OpenApi": {
"GenerateContentTypeSchemas": true
}
},
"Content": {
"AllowEditInvariantFromNonDefault": true,
Expand Down
2 changes: 0 additions & 2 deletions backend/src/MethodConf.Cms/uSync/v17/usync.config

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<Compositions />
<DefaultTemplate></DefaultTemplate>
<AllowedTemplates />
<AllowedInLibrary>false</AllowedInLibrary>
</Info>
<Structure>
<ContentType Key="440506e4-992b-4b23-97e1-6700e1fe108c" SortOrder="0">sponsors</ContentType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<Compositions />
<DefaultTemplate></DefaultTemplate>
<AllowedTemplates />
<AllowedInLibrary>false</AllowedInLibrary>
</Info>
<Structure>
<ContentType Key="d563b6b1-caa6-4976-918d-37df9b98b207" SortOrder="0">conference</ContentType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
</Compositions>
<DefaultTemplate></DefaultTemplate>
<AllowedTemplates />
<AllowedInLibrary>false</AllowedInLibrary>
</Info>
<Structure />
<GenericProperties />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<Compositions />
<DefaultTemplate></DefaultTemplate>
<AllowedTemplates />
<AllowedInLibrary>false</AllowedInLibrary>
</Info>
<Structure />
<GenericProperties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<Compositions />
<DefaultTemplate></DefaultTemplate>
<AllowedTemplates />
<AllowedInLibrary>false</AllowedInLibrary>
</Info>
<Structure />
<GenericProperties />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<Compositions />
<DefaultTemplate></DefaultTemplate>
<AllowedTemplates />
<AllowedInLibrary>false</AllowedInLibrary>
</Info>
<Structure>
<ContentType Key="1a5c955d-6fda-4c78-b3a6-fc71d8f54053" SortOrder="0">page</ContentType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<Compositions />
<DefaultTemplate></DefaultTemplate>
<AllowedTemplates />
<AllowedInLibrary>false</AllowedInLibrary>
</Info>
<Structure />
<GenericProperties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<Compositions />
<DefaultTemplate></DefaultTemplate>
<AllowedTemplates />
<AllowedInLibrary>false</AllowedInLibrary>
</Info>
<Structure />
<GenericProperties />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<Compositions />
<DefaultTemplate></DefaultTemplate>
<AllowedTemplates />
<AllowedInLibrary>false</AllowedInLibrary>
</Info>
<Structure />
<GenericProperties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<Compositions />
<DefaultTemplate></DefaultTemplate>
<AllowedTemplates />
<AllowedInLibrary>false</AllowedInLibrary>
</Info>
<Structure>
<ContentType Key="08e16cb8-8009-4f54-98c9-0824c5245a18" SortOrder="0">track</ContentType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<Compositions />
<DefaultTemplate></DefaultTemplate>
<AllowedTemplates />
<AllowedInLibrary>false</AllowedInLibrary>
</Info>
<Structure />
<GenericProperties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<Compositions />
<DefaultTemplate></DefaultTemplate>
<AllowedTemplates />
<AllowedInLibrary>false</AllowedInLibrary>
</Info>
<Structure>
<ContentType Key="1df2a959-cf53-49c9-9163-6e8aca98477d" SortOrder="0">speaker</ContentType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<Compositions />
<DefaultTemplate></DefaultTemplate>
<AllowedTemplates />
<AllowedInLibrary>false</AllowedInLibrary>
</Info>
<Structure />
<GenericProperties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<Compositions />
<DefaultTemplate></DefaultTemplate>
<AllowedTemplates />
<AllowedInLibrary>false</AllowedInLibrary>
</Info>
<Structure />
<GenericProperties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<Compositions />
<DefaultTemplate></DefaultTemplate>
<AllowedTemplates />
<AllowedInLibrary>false</AllowedInLibrary>
</Info>
<Structure />
<GenericProperties />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<Compositions />
<DefaultTemplate></DefaultTemplate>
<AllowedTemplates />
<AllowedInLibrary>false</AllowedInLibrary>
</Info>
<Structure />
<GenericProperties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<Compositions />
<DefaultTemplate></DefaultTemplate>
<AllowedTemplates />
<AllowedInLibrary>false</AllowedInLibrary>
</Info>
<Structure />
<GenericProperties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<Compositions />
<DefaultTemplate></DefaultTemplate>
<AllowedTemplates />
<AllowedInLibrary>false</AllowedInLibrary>
</Info>
<Structure>
<ContentType Key="183a88ff-8ad5-4d31-8d49-82380c97f3c6" SortOrder="0">session</ContentType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,36 @@
<ValidationRegExpMessage></ValidationRegExpMessage>
<LabelOnTop>false</LabelOnTop>
</GenericProperty>
<GenericProperty>
<Key>948d8635-d460-4fed-91ce-760aa4b46104</Key>
<Name>Height</Name>
<Alias>umbracoHeight</Alias>
<Definition>5eb57825-e15e-4fc7-8e37-fca65cdafbde</Definition>
<Type>Umbraco.Label</Type>
<Mandatory>false</Mandatory>
<Validation></Validation>
<Description><![CDATA[]]></Description>
<SortOrder>4</SortOrder>
<Tab Alias="vectorGraphics">Vector Graphics</Tab>
<MandatoryMessage></MandatoryMessage>
<ValidationRegExpMessage></ValidationRegExpMessage>
<LabelOnTop>false</LabelOnTop>
</GenericProperty>
<GenericProperty>
<Key>d70dbf39-d331-4abe-8894-2304fb943e90</Key>
<Name>Width</Name>
<Alias>umbracoWidth</Alias>
<Definition>5eb57825-e15e-4fc7-8e37-fca65cdafbde</Definition>
<Type>Umbraco.Label</Type>
<Mandatory>false</Mandatory>
<Validation></Validation>
<Description><![CDATA[]]></Description>
<SortOrder>3</SortOrder>
<Tab Alias="vectorGraphics">Vector Graphics</Tab>
<MandatoryMessage></MandatoryMessage>
<ValidationRegExpMessage></ValidationRegExpMessage>
<LabelOnTop>false</LabelOnTop>
</GenericProperty>
</GenericProperties>
<Structure />
<Tabs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</Info>
<GenericProperties>
<GenericProperty>
<Key>2a280588-0000-0000-0000-000000000000</Key>
<Key>70f24c26-1c0e-4053-bd8e-e9e6e4ec4c01</Key>
<Name>Comments</Name>
<Alias>umbracoMemberComments</Alias>
<Definition>c6bac0dd-4ab9-45b1-8e30-e4b619ee5da3</Definition>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<RelationType Key="962cb9c2-84b5-3ee1-9968-f1d81f6f89fd" Alias="relateParentElementContainerOnContainerDelete" Level="0">
<Info>
<Name>Relate Parent Element Container On Container Delete</Name>
<ParentType>2815b0cf-9706-499f-aa2a-8a4c7aef005d</ParentType>
<ChildType>2815b0cf-9706-499f-aa2a-8a4c7aef005d</ChildType>
<Bidirectional>false</Bidirectional>
<IsDependency>false</IsDependency>
</Info>
</RelationType>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<RelationType Key="28c4ae8b-c764-3486-baa2-23e83e8fe9e2" Alias="relateParentElementContainerOnElementDelete" Level="0">
<Info>
<Name>Relate Parent Element Container On Element Delete</Name>
<ParentType>2815b0cf-9706-499f-aa2a-8a4c7aef005d</ParentType>
<ChildType>3d7b623c-94b1-487d-8554-a46ec37568be</ChildType>
<Bidirectional>false</Bidirectional>
<IsDependency>false</IsDependency>
</Info>
</RelationType>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<RelationType Key="9eaf0f14-a7bc-3883-9300-88a7ae23cf75" Alias="umbElement" Level="0">
<Info>
<Name>Related Element</Name>
<ParentType />
<ChildType />
<Bidirectional>false</Bidirectional>
<IsDependency>true</IsDependency>
</Info>
</RelationType>
2 changes: 2 additions & 0 deletions backend/src/MethodConf.Cms/uSync/v18/usync.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<uSync version="18.0.1.0" format="10.7.0" hmac="" />
Loading