Browse Source

Extend schema grain.

pull/304/head
Sebastian 8 years ago
parent
commit
3eb794d2b6
  1. 2
      src/Squidex.Domain.Apps.Entities/Schemas/Commands/CreateSchema.cs
  2. 2
      src/Squidex.Domain.Apps.Entities/Schemas/ISchemaEntity.cs
  3. 5
      src/Squidex.Domain.Apps.Entities/Schemas/State/SchemaState.cs
  4. 2
      src/Squidex.Domain.Apps.Events/Schemas/SchemaCreated.cs
  5. 5
      tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemaGrainTests.cs

2
src/Squidex.Domain.Apps.Entities/Schemas/Commands/CreateSchema.cs

@ -22,6 +22,8 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Commands
public SchemaProperties Properties { get; set; }
public bool Singleton { get; set; }
public bool Publish { get; set; }
public CreateSchema()

2
src/Squidex.Domain.Apps.Entities/Schemas/ISchemaEntity.cs

@ -25,6 +25,8 @@ namespace Squidex.Domain.Apps.Entities.Schemas
bool IsPublished { get; }
bool IsSingleton { get; }
bool IsDeleted { get; }
string ScriptQuery { get; }

5
src/Squidex.Domain.Apps.Entities/Schemas/State/SchemaState.cs

@ -37,6 +37,9 @@ namespace Squidex.Domain.Apps.Entities.Schemas.State
[JsonProperty]
public bool IsDeleted { get; set; }
[JsonProperty]
public bool IsSingleton { get; set; }
[JsonProperty]
public string ScriptQuery { get; set; }
@ -65,6 +68,8 @@ namespace Squidex.Domain.Apps.Entities.Schemas.State
{
Name = @event.Name;
IsSingleton = @event.Singleton;
var schema = new Schema(@event.Name);
if (@event.Properties != null)

2
src/Squidex.Domain.Apps.Events/Schemas/SchemaCreated.cs

@ -20,6 +20,8 @@ namespace Squidex.Domain.Apps.Events.Schemas
public SchemaProperties Properties { get; set; }
public bool Singleton { get; set; }
public bool Publish { get; set; }
}
}

5
tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemaGrainTests.cs

@ -62,7 +62,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas
{
var properties = new SchemaProperties();
var command = new CreateSchema { Name = SchemaName, SchemaId = SchemaId, Properties = properties };
var command = new CreateSchema { Name = SchemaName, SchemaId = SchemaId, Properties = properties, Singleton = true };
var result = await sut.ExecuteAsync(CreateCommand(command));
@ -72,10 +72,11 @@ namespace Squidex.Domain.Apps.Entities.Schemas
Assert.Equal(SchemaName, sut.Snapshot.Name);
Assert.Equal(SchemaName, sut.Snapshot.SchemaDef.Name);
Assert.True(sut.Snapshot.IsSingleton);
LastEvents
.ShouldHaveSameEvents(
CreateEvent(new SchemaCreated { Name = SchemaName, Properties = properties })
CreateEvent(new SchemaCreated { Name = SchemaName, Properties = properties, Singleton = true })
);
}

Loading…
Cancel
Save