diff --git a/src/Squidex.Domain.Apps.Entities/Contents/Guards/GuardContent.cs b/src/Squidex.Domain.Apps.Entities/Contents/Guards/GuardContent.cs index 8c02f6d88..c40c5e629 100644 --- a/src/Squidex.Domain.Apps.Entities/Contents/Guards/GuardContent.cs +++ b/src/Squidex.Domain.Apps.Entities/Contents/Guards/GuardContent.cs @@ -25,7 +25,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guards ValidateData(command, e); }); - if (schema.IsSingleton && command.ContentId != Guid.Empty) + if (schema.Singleton && command.ContentId != Guid.Empty) { throw new DomainException("Singleton content cannot be created."); } @@ -65,7 +65,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guards { Guard.NotNull(command, nameof(command)); - if (schema.IsSingleton && command.Status != Status.Published) + if (schema.Singleton && command.Status != Status.Published) { throw new DomainException("Singleton content archived or unpublished."); } @@ -102,7 +102,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guards { Guard.NotNull(command, nameof(command)); - if (schema.IsSingleton) + if (schema.Singleton) { throw new DomainException("Singleton content cannot be deleted."); } diff --git a/src/Squidex.Domain.Apps.Entities/Schemas/ISchemaEntity.cs b/src/Squidex.Domain.Apps.Entities/Schemas/ISchemaEntity.cs index 7f5ccf51e..58233780d 100644 --- a/src/Squidex.Domain.Apps.Entities/Schemas/ISchemaEntity.cs +++ b/src/Squidex.Domain.Apps.Entities/Schemas/ISchemaEntity.cs @@ -23,9 +23,9 @@ namespace Squidex.Domain.Apps.Entities.Schemas string Category { get; } - bool IsPublished { get; } + bool Singleton { get; } - bool IsSingleton { get; } + bool IsPublished { get; } bool IsDeleted { get; } diff --git a/src/Squidex.Domain.Apps.Entities/Schemas/State/SchemaState.cs b/src/Squidex.Domain.Apps.Entities/Schemas/State/SchemaState.cs index 01bd7a7d1..070ca131d 100644 --- a/src/Squidex.Domain.Apps.Entities/Schemas/State/SchemaState.cs +++ b/src/Squidex.Domain.Apps.Entities/Schemas/State/SchemaState.cs @@ -38,7 +38,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.State public bool IsDeleted { get; set; } [JsonProperty] - public bool IsSingleton { get; set; } + public bool Singleton { get; set; } [JsonProperty] public string ScriptQuery { get; set; } @@ -68,7 +68,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.State { Name = @event.Name; - IsSingleton = @event.Singleton; + Singleton = @event.Singleton; var schema = new Schema(@event.Name); diff --git a/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Guard/GuardContentTests.cs b/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Guard/GuardContentTests.cs index 56357383f..a69db5009 100644 --- a/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Guard/GuardContentTests.cs +++ b/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Guard/GuardContentTests.cs @@ -35,7 +35,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guard [Fact] public void CanCreate_should_throw_exception_if_singleton() { - A.CallTo(() => schema.IsSingleton).Returns(true); + A.CallTo(() => schema.Singleton).Returns(true); var command = new CreateContent { Data = new NamedContentData() }; @@ -45,7 +45,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guard [Fact] public void CanCreate_should_not_throw_exception_if_singleton_and_id_empty() { - A.CallTo(() => schema.IsSingleton).Returns(true); + A.CallTo(() => schema.Singleton).Returns(true); var command = new CreateContent { Data = new NamedContentData(), ContentId = Guid.Empty }; @@ -133,7 +133,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guard [Fact] public void CanChangeContentStatus_should_throw_exception_if_singleton() { - A.CallTo(() => schema.IsSingleton).Returns(true); + A.CallTo(() => schema.Singleton).Returns(true); var command = new ChangeContentStatus { Status = Status.Draft }; @@ -143,7 +143,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guard [Fact] public void CanChangeContentStatus_should_not_throw_exception_if_publishing_with_pending_changes() { - A.CallTo(() => schema.IsSingleton).Returns(true); + A.CallTo(() => schema.Singleton).Returns(true); var command = new ChangeContentStatus { Status = Status.Published }; @@ -177,7 +177,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guard [Fact] public void CanDelete_should_throw_exception_if_singleton() { - A.CallTo(() => schema.IsSingleton).Returns(true); + A.CallTo(() => schema.Singleton).Returns(true); var command = new DeleteContent(); diff --git a/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemaGrainTests.cs b/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemaGrainTests.cs index cd880f849..b2f00be97 100644 --- a/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemaGrainTests.cs +++ b/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemaGrainTests.cs @@ -72,7 +72,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas Assert.Equal(SchemaName, sut.Snapshot.Name); Assert.Equal(SchemaName, sut.Snapshot.SchemaDef.Name); - Assert.True(sut.Snapshot.IsSingleton); + Assert.True(sut.Snapshot.Singleton); LastEvents .ShouldHaveSameEvents(