Browse Source

Fix templates.

pull/303/head
Sebastian 8 years ago
parent
commit
dde38676f6
  1. 7
      src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateBlogCommandMiddleware.cs
  2. 6
      src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateProfileCommandMiddleware.cs
  3. 12
      src/Squidex/Config/Domain/EntitiesServices.cs

7
src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateBlogCommandMiddleware.cs

@ -28,7 +28,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
replace(data);";
public Task HandleAsync(CommandContext context, Func<Task> next)
public async Task HandleAsync(CommandContext context, Func<Task> next)
{
if (context.IsCompleted && context.Command is CreateApp createApp && IsRightTemplate(createApp))
{
@ -44,13 +44,13 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
return context.CommandBus.PublishAsync(command);
});
return Task.WhenAll(
await Task.WhenAll(
CreatePagesAsync(publish),
CreatePostsAsync(publish),
CreateClientAsync(publish, appId.Id));
}
return next();
await next();
}
private static bool IsRightTemplate(CreateApp createApp)
@ -173,6 +173,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
var command = new CreateSchema
{
Name = "pages",
Publish = true,
Properties = new SchemaProperties
{
Label = "Pages"

6
src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateProfileCommandMiddleware.cs

@ -23,7 +23,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
{
private const string TemplateName = "Profile";
public Task HandleAsync(CommandContext context, Func<Task> next)
public async Task HandleAsync(CommandContext context, Func<Task> next)
{
if (context.IsCompleted && context.Command is CreateApp createApp && IsRightTemplate(createApp))
{
@ -39,7 +39,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
return context.CommandBus.PublishAsync(command);
});
return Task.WhenAll(
await Task.WhenAll(
CreateBasicsAsync(publish),
CreateProjectsSchemaAsync(publish),
CreateExperienceSchemaAsync(publish),
@ -49,7 +49,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
CreateClientAsync(publish, appId.Id));
}
return next();
await next();
}
private static bool IsRightTemplate(CreateApp createApp)

12
src/Squidex/Config/Domain/EntitiesServices.cs

@ -116,12 +116,6 @@ namespace Squidex.Config.Domain
services.AddSingletonAs<GrainCommandMiddleware<RuleCommand, IRuleGrain>>()
.As<ICommandMiddleware>();
services.AddSingletonAs<CreateBlogCommandMiddleware>()
.As<ICommandMiddleware>();
services.AddSingletonAs<CreateProfileCommandMiddleware>()
.As<ICommandMiddleware>();
services.AddSingletonAs<AppsByNameIndexCommandMiddleware>()
.As<ICommandMiddleware>();
@ -134,6 +128,12 @@ namespace Squidex.Config.Domain
services.AddSingletonAs<SchemasByAppIndexCommandMiddleware>()
.As<ICommandMiddleware>();
services.AddSingletonAs<CreateBlogCommandMiddleware>()
.As<ICommandMiddleware>();
services.AddSingletonAs<CreateProfileCommandMiddleware>()
.As<ICommandMiddleware>();
services.AddSingletonAs<JintScriptEngine>()
.As<IScriptEngine>();

Loading…
Cancel
Save