diff --git a/Lombiq.HelpfulExtensions/Extensions/Widgets/Migrations.cs b/Lombiq.HelpfulExtensions/Extensions/Widgets/Migrations.cs index 3fecdc7c..4fa656fa 100644 --- a/Lombiq.HelpfulExtensions/Extensions/Widgets/Migrations.cs +++ b/Lombiq.HelpfulExtensions/Extensions/Widgets/Migrations.cs @@ -11,18 +11,16 @@ namespace Lombiq.HelpfulExtensions.Extensions.Widgets; public class Migrations(IContentDefinitionManager contentDefinitionManager) : DataMigration { - private readonly IContentDefinitionManager _contentDefinitionManager = contentDefinitionManager; - public async Task CreateAsync() { - await _contentDefinitionManager.AlterTypeDefinitionAsync(ContainerWidget, builder => builder + await contentDefinitionManager.AlterTypeDefinitionAsync(ContainerWidget, builder => builder .Securable() .Stereotype(CommonStereotypes.Widget) .WithPart("TitlePart", part => part.WithPosition("0")) .WithPart("FlowPart", part => part.WithPosition("1")) ); - await _contentDefinitionManager.AlterTypeDefinitionAsync(HtmlWidget, builder => builder + await contentDefinitionManager.AlterTypeDefinitionAsync(HtmlWidget, builder => builder .Securable() .Stereotype(CommonStereotypes.Widget) .WithPart("HtmlBodyPart", part => part @@ -34,7 +32,7 @@ await _contentDefinitionManager.AlterTypeDefinitionAsync(HtmlWidget, builder => ) ); - await _contentDefinitionManager.AlterTypeDefinitionAsync(LiquidWidget, builder => builder + await contentDefinitionManager.AlterTypeDefinitionAsync(LiquidWidget, builder => builder .Securable() .Stereotype(CommonStereotypes.Widget) .WithPart("LiquidPart", part => part @@ -42,12 +40,12 @@ await _contentDefinitionManager.AlterTypeDefinitionAsync(LiquidWidget, builder = ) ); - await _contentDefinitionManager.AlterTypeDefinitionAsync(MenuWidget, builder => builder + await contentDefinitionManager.AlterTypeDefinitionAsync(MenuWidget, builder => builder .Securable() .Stereotype(CommonStereotypes.Widget) ); - await _contentDefinitionManager.AlterTypeDefinitionAsync(MarkdownWidget, builder => builder + await contentDefinitionManager.AlterTypeDefinitionAsync(MarkdownWidget, builder => builder .Securable() .Stereotype(CommonStereotypes.Widget) .WithPart("MarkdownBodyPart", part => part @@ -55,7 +53,7 @@ await _contentDefinitionManager.AlterTypeDefinitionAsync(MarkdownWidget, builder ) ); - var contentItemWidgetPartName = await _contentDefinitionManager.AlterPartDefinitionAsync(builder => builder + var contentItemWidgetPartName = await contentDefinitionManager.AlterPartDefinitionAsync(builder => builder .WithField(part => part.ContentToDisplay, field => field .WithDisplayName("Content to display") .WithSettings(new ContentPickerFieldSettings @@ -67,7 +65,7 @@ await _contentDefinitionManager.AlterTypeDefinitionAsync(MarkdownWidget, builder .WithField(part => part.GroupId, field => field.WithDisplayName("Group ID")) ); - await _contentDefinitionManager.AlterTypeDefinitionAsync(WidgetTypes.ContentItemWidget, builder => builder + await contentDefinitionManager.AlterTypeDefinitionAsync(WidgetTypes.ContentItemWidget, builder => builder .Securable() .Stereotype(CommonStereotypes.Widget) .WithPart(contentItemWidgetPartName) @@ -78,7 +76,7 @@ await _contentDefinitionManager.AlterTypeDefinitionAsync(WidgetTypes.ContentItem public async Task UpdateFrom1Async() { - await _contentDefinitionManager.AlterTypeDefinitionAsync(ContainerWidget, builder => builder + await contentDefinitionManager.AlterTypeDefinitionAsync(ContainerWidget, builder => builder .WithPart("TitlePart", part => part.WithPosition("0")) .WithPart("FlowPart", part => part.WithPosition("1")) ); @@ -88,7 +86,7 @@ await _contentDefinitionManager.AlterTypeDefinitionAsync(ContainerWidget, builde public async Task UpdateFrom2Async() { - await _contentDefinitionManager.AlterTypeDefinitionAsync(MenuWidget, builder => builder + await contentDefinitionManager.AlterTypeDefinitionAsync(MenuWidget, builder => builder .Securable() .Stereotype(CommonStereotypes.Widget) ); @@ -98,7 +96,7 @@ await _contentDefinitionManager.AlterTypeDefinitionAsync(MenuWidget, builder => public async Task UpdateFrom3Async() { - await _contentDefinitionManager.AlterTypeDefinitionAsync(MarkdownWidget, builder => builder + await contentDefinitionManager.AlterTypeDefinitionAsync(MarkdownWidget, builder => builder .Securable() .Stereotype(CommonStereotypes.Widget) .WithPart("MarkdownBodyPart", part => part @@ -111,13 +109,13 @@ await _contentDefinitionManager.AlterTypeDefinitionAsync(MarkdownWidget, builder public async Task UpdateFrom4Async() { - var contentItemWidgetPartName = await _contentDefinitionManager.AlterPartDefinitionAsync(builder => builder + var contentItemWidgetPartName = await contentDefinitionManager.AlterPartDefinitionAsync(builder => builder .WithField(part => part.ContentToDisplay, field => field.WithDisplayName("Content to display")) .WithField(part => part.DisplayType, field => field.WithDisplayName("Display type")) .WithField(part => part.GroupId, field => field.WithDisplayName("Group ID")) ); - await _contentDefinitionManager.AlterTypeDefinitionAsync(WidgetTypes.ContentItemWidget, builder => builder + await contentDefinitionManager.AlterTypeDefinitionAsync(WidgetTypes.ContentItemWidget, builder => builder .Securable() .Stereotype(CommonStereotypes.Widget) .WithPart(contentItemWidgetPartName)