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);"; 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)) 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 context.CommandBus.PublishAsync(command);
}); });
return Task.WhenAll( await Task.WhenAll(
CreatePagesAsync(publish), CreatePagesAsync(publish),
CreatePostsAsync(publish), CreatePostsAsync(publish),
CreateClientAsync(publish, appId.Id)); CreateClientAsync(publish, appId.Id));
} }
return next(); await next();
} }
private static bool IsRightTemplate(CreateApp createApp) private static bool IsRightTemplate(CreateApp createApp)
@ -173,6 +173,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
var command = new CreateSchema var command = new CreateSchema
{ {
Name = "pages", Name = "pages",
Publish = true,
Properties = new SchemaProperties Properties = new SchemaProperties
{ {
Label = "Pages" 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"; 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)) 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 context.CommandBus.PublishAsync(command);
}); });
return Task.WhenAll( await Task.WhenAll(
CreateBasicsAsync(publish), CreateBasicsAsync(publish),
CreateProjectsSchemaAsync(publish), CreateProjectsSchemaAsync(publish),
CreateExperienceSchemaAsync(publish), CreateExperienceSchemaAsync(publish),
@ -49,7 +49,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
CreateClientAsync(publish, appId.Id)); CreateClientAsync(publish, appId.Id));
} }
return next(); await next();
} }
private static bool IsRightTemplate(CreateApp createApp) 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>>() services.AddSingletonAs<GrainCommandMiddleware<RuleCommand, IRuleGrain>>()
.As<ICommandMiddleware>(); .As<ICommandMiddleware>();
services.AddSingletonAs<CreateBlogCommandMiddleware>()
.As<ICommandMiddleware>();
services.AddSingletonAs<CreateProfileCommandMiddleware>()
.As<ICommandMiddleware>();
services.AddSingletonAs<AppsByNameIndexCommandMiddleware>() services.AddSingletonAs<AppsByNameIndexCommandMiddleware>()
.As<ICommandMiddleware>(); .As<ICommandMiddleware>();
@ -134,6 +128,12 @@ namespace Squidex.Config.Domain
services.AddSingletonAs<SchemasByAppIndexCommandMiddleware>() services.AddSingletonAs<SchemasByAppIndexCommandMiddleware>()
.As<ICommandMiddleware>(); .As<ICommandMiddleware>();
services.AddSingletonAs<CreateBlogCommandMiddleware>()
.As<ICommandMiddleware>();
services.AddSingletonAs<CreateProfileCommandMiddleware>()
.As<ICommandMiddleware>();
services.AddSingletonAs<JintScriptEngine>() services.AddSingletonAs<JintScriptEngine>()
.As<IScriptEngine>(); .As<IScriptEngine>();

Loading…
Cancel
Save