From 99752173e1e54e1844e5405da4f3ed87a63908ae Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 18 Dec 2020 17:19:36 +0100 Subject: [PATCH] Separator folders/namespaces for domain objects. --- .../src/Migrations/Migrations/ClearRules.cs | 4 +- .../src/Migrations/Migrations/ClearSchemas.cs | 4 +- .../Migrations/Migrations/CreateAssetSlugs.cs | 6 +- backend/src/Migrations/RebuilderExtensions.cs | 27 +- .../HandleRules/RuleEventFormatter.cs | 4 +- ...ongoAssetFolderRepository_SnapshotStore.cs | 16 +- .../Assets/MongoAssetRepository.cs | 1 - .../MongoAssetRepository_SnapshotStore.cs | 16 +- .../MongoContentRepository_SnapshotStore.cs | 22 +- .../Contents/Operations/QueryByQuery.cs | 1 - .../Rules/MongoRuleEventRepository.cs | 1 - .../AppCommandMiddleware.cs | 2 +- .../DomainObject/AppDomainObject.State.cs | 231 ++++++++++++++++++ .../{ => DomainObject}/AppDomainObject.cs | 7 +- .../AppDomainObjectGrain.cs | 5 +- .../{ => DomainObject}/Guards/GuardApp.cs | 2 +- .../Guards/GuardAppClients.cs | 2 +- .../Guards/GuardAppContributors.cs | 2 +- .../Guards/GuardAppLanguages.cs | 2 +- .../Guards/GuardAppPatterns.cs | 2 +- .../Guards/GuardAppRoles.cs | 2 +- .../Guards/GuardAppWorkflows.cs | 2 +- .../Apps/{ => DomainObject}/IAppGrain.cs | 2 +- .../Apps/Indexes/AppsIndex.cs | 1 + .../Apps/State/AppState.cs | 228 ----------------- .../Assets/BackupAssets.cs | 6 +- .../AssetCommandMiddleware.cs | 2 +- .../DomainObject/AssetDomainObject.State.cs | 178 ++++++++++++++ .../{ => DomainObject}/AssetDomainObject.cs | 7 +- .../AssetDomainObjectGrain.cs | 5 +- .../AssetFolderDomainObject.State.cs | 72 ++++++ .../AssetFolderDomainObject.cs | 7 +- .../AssetFolderDomainObjectGrain.cs | 5 +- .../{ => DomainObject}/Guards/GuardAsset.cs | 2 +- .../Guards/GuardAssetFolder.cs | 2 +- .../{ => DomainObject}/IAssetFolderGrain.cs | 2 +- .../Assets/{ => DomainObject}/IAssetGrain.cs | 2 +- .../Assets/Queries/AssetLoader.cs | 1 + .../Assets/State/AssetFolderState.cs | 69 ------ .../Assets/State/AssetState.cs | 175 ------------- .../Comments/CommentsLoader.cs | 1 + .../CommentsCommandMiddleware.cs | 2 +- .../{ => DomainObject}/CommentsGrain.cs | 4 +- .../Guards/GuardComments.cs | 2 +- .../{ => DomainObject}/ICommentsGrain.cs | 2 +- .../Contents/BackupContents.cs | 4 +- .../Contents/BulkUpdateCommandMiddleware.cs | 1 - .../ContentCommandMiddleware.cs | 2 +- .../DomainObject/ContentDomainObject.State.cs | 159 ++++++++++++ .../{ => DomainObject}/ContentDomainObject.cs | 9 +- .../ContentDomainObjectGrain.cs | 5 +- .../ContentOperationContext.cs | 2 +- .../{State => DomainObject}/ContentVersion.cs | 2 +- .../{ => DomainObject}/Guards/GuardContent.cs | 2 +- .../{ => DomainObject}/IContentGrain.cs | 2 +- .../Contents/IContentQueryService.cs | 1 - .../Contents/Queries/ContentLoader.cs | 1 + .../Contents/State/ContentState.cs | 156 ------------ .../{ => DomainObject}/Guards/GuardRule.cs | 2 +- .../Guards/RuleTriggerValidator.cs | 2 +- .../Rules/{ => DomainObject}/IRuleGrain.cs | 2 +- .../DomainObject/RuleDomainObject.State.cs | 96 ++++++++ .../{ => DomainObject}/RuleDomainObject.cs | 7 +- .../RuleDomainObjectGrain.cs | 5 +- .../Rules/Indexes/RulesIndex.cs | 1 + .../Rules/RuleCommandMiddleware.cs | 1 + .../Rules/State/RuleState.cs | 93 ------- .../Guards/FieldPropertiesValidator.cs | 2 +- .../{ => DomainObject}/Guards/GuardHelper.cs | 2 +- .../{ => DomainObject}/Guards/GuardSchema.cs | 2 +- .../Guards/GuardSchemaField.cs | 2 +- .../{ => DomainObject}/ISchemaGrain.cs | 2 +- .../DomainObject/SchemaDomainObject.State.cs | 210 ++++++++++++++++ .../{ => DomainObject}/SchemaDomainObject.cs | 7 +- .../SchemaDomainObjectGrain.cs | 5 +- .../Schemas/Indexes/SchemasIndex.cs | 1 + .../Schemas/State/SchemaState.cs | 207 ---------------- .../src/Squidex/Config/Domain/AppsServices.cs | 1 + .../Squidex/Config/Domain/AssetServices.cs | 1 + .../Squidex/Config/Domain/CommandsServices.cs | 9 +- .../Squidex/Config/Domain/ContentsServices.cs | 2 +- .../src/Squidex/Config/Domain/RuleServices.cs | 1 + .../Squidex/Config/Domain/SchemasServices.cs | 1 + .../Squidex/Config/Domain/StoreServices.cs | 10 +- .../AppCommandMiddlewareTests.cs | 5 +- .../AppDomainObjectTests.cs | 5 +- .../Guards/GuardAppClientsTests.cs | 2 +- .../Guards/GuardAppContributorsTests.cs | 2 +- .../Guards/GuardAppLanguagesTests.cs | 2 +- .../Guards/GuardAppPatternsTests.cs | 2 +- .../Guards/GuardAppRolesTests.cs | 2 +- .../Guards/GuardAppTests.cs | 2 +- .../Guards/GuardAppWorkflowTests.cs | 2 +- .../Apps/Indexes/AppsIndexTests.cs | 1 + .../Assets/BackupAssetsTests.cs | 6 +- .../AssetCommandMiddlewareTests.cs | 5 +- .../AssetDomainObjectGrainTests.cs | 2 +- .../AssetDomainObjectTests.cs | 5 +- .../AssetFolderDomainObjectGrainTests.cs | 2 +- .../AssetFolderDomainObjectTests.cs | 5 +- .../Guards/GuardAssetFolderTests.cs | 2 +- .../Guards/GuardAssetTests.cs | 2 +- .../Assets/Queries/AssetLoaderTests.cs | 1 + .../Assets/Queries/AssetQueryParserTests.cs | 1 - .../Comments/CommentsLoaderTests.cs | 1 + .../CommentsCommandMiddlewareTests.cs | 2 +- .../{ => DomainObject}/CommentsGrainTests.cs | 2 +- .../Guards/GuardCommentsTests.cs | 2 +- .../Contents/BackupContentsTests.cs | 4 +- .../BulkUpdateCommandMiddlewareTests.cs | 1 - .../ContentCommandMiddlewareTests.cs | 5 +- .../ContentDomainObjectGrainTests.cs | 2 +- .../ContentDomainObjectTests.cs | 6 +- .../Guards}/GuardContentTests.cs | 3 +- .../Contents/GraphQL/GraphQLQueriesTests.cs | 1 - .../Contents/Queries/ContentLoaderTests.cs | 1 + .../Queries/ResolveReferencesTests.cs | 1 - .../Contents/ReferenceFluidExtensionTests.cs | 1 - .../Guards/GuardRuleTests.cs | 2 +- .../Triggers/ContentChangedTriggerTests.cs | 2 +- .../Triggers/UsageTriggerValidationTests.cs | 2 +- .../RuleCommandMiddlewareTests.cs | 5 +- .../RuleDomainObjectTests.cs | 5 +- .../Rules/Indexes/RulesIndexTests.cs | 1 + .../ArrayFieldPropertiesTests.cs | 2 +- .../AssetsFieldPropertiesTests.cs | 2 +- .../BooleanFieldPropertiesTests.cs | 2 +- .../DateTimeFieldPropertiesTests.cs | 2 +- .../GeolocationFieldPropertiesTests.cs | 2 +- .../JsonFieldPropertiesTests.cs | 2 +- .../NumberFieldPropertiesTests.cs | 2 +- .../ReferencesFieldPropertiesTests.cs | 2 +- .../StringFieldPropertiesTests.cs | 2 +- .../TagsFieldPropertiesTests.cs | 2 +- .../FieldProperties/UIFieldPropertiesTests.cs | 2 +- .../Guards/GuardSchemaFieldTests.cs | 2 +- .../Guards/GuardSchemaTests.cs | 2 +- .../SchemaDomainObjectTests.cs | 5 +- .../Schemas/Indexes/SchemasIndexTests.cs | 1 + .../EventSourcing/MongoParallelInsertTests.cs | 2 +- 140 files changed, 1146 insertions(+), 1151 deletions(-) rename backend/src/Squidex.Domain.Apps.Entities/Apps/{ => DomainObject}/AppCommandMiddleware.cs (97%) create mode 100644 backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/AppDomainObject.State.cs rename backend/src/Squidex.Domain.Apps.Entities/Apps/{ => DomainObject}/AppDomainObject.cs (98%) rename backend/src/Squidex.Domain.Apps.Entities/Apps/{ => DomainObject}/AppDomainObjectGrain.cs (86%) rename backend/src/Squidex.Domain.Apps.Entities/Apps/{ => DomainObject}/Guards/GuardApp.cs (97%) rename backend/src/Squidex.Domain.Apps.Entities/Apps/{ => DomainObject}/Guards/GuardAppClients.cs (98%) rename backend/src/Squidex.Domain.Apps.Entities/Apps/{ => DomainObject}/Guards/GuardAppContributors.cs (98%) rename backend/src/Squidex.Domain.Apps.Entities/Apps/{ => DomainObject}/Guards/GuardAppLanguages.cs (98%) rename backend/src/Squidex.Domain.Apps.Entities/Apps/{ => DomainObject}/Guards/GuardAppPatterns.cs (98%) rename backend/src/Squidex.Domain.Apps.Entities/Apps/{ => DomainObject}/Guards/GuardAppRoles.cs (98%) rename backend/src/Squidex.Domain.Apps.Entities/Apps/{ => DomainObject}/Guards/GuardAppWorkflows.cs (98%) rename backend/src/Squidex.Domain.Apps.Entities/Apps/{ => DomainObject}/IAppGrain.cs (91%) delete mode 100644 backend/src/Squidex.Domain.Apps.Entities/Apps/State/AppState.cs rename backend/src/Squidex.Domain.Apps.Entities/Assets/{ => DomainObject}/AssetCommandMiddleware.cs (99%) create mode 100644 backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetDomainObject.State.cs rename backend/src/Squidex.Domain.Apps.Entities/Assets/{ => DomainObject}/AssetDomainObject.cs (96%) rename backend/src/Squidex.Domain.Apps.Entities/Assets/{ => DomainObject}/AssetDomainObjectGrain.cs (89%) create mode 100644 backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetFolderDomainObject.State.cs rename backend/src/Squidex.Domain.Apps.Entities/Assets/{ => DomainObject}/AssetFolderDomainObject.cs (94%) rename backend/src/Squidex.Domain.Apps.Entities/Assets/{ => DomainObject}/AssetFolderDomainObjectGrain.cs (87%) rename backend/src/Squidex.Domain.Apps.Entities/Assets/{ => DomainObject}/Guards/GuardAsset.cs (97%) rename backend/src/Squidex.Domain.Apps.Entities/Assets/{ => DomainObject}/Guards/GuardAssetFolder.cs (97%) rename backend/src/Squidex.Domain.Apps.Entities/Assets/{ => DomainObject}/IAssetFolderGrain.cs (89%) rename backend/src/Squidex.Domain.Apps.Entities/Assets/{ => DomainObject}/IAssetGrain.cs (91%) delete mode 100644 backend/src/Squidex.Domain.Apps.Entities/Assets/State/AssetFolderState.cs delete mode 100644 backend/src/Squidex.Domain.Apps.Entities/Assets/State/AssetState.cs rename backend/src/Squidex.Domain.Apps.Entities/Comments/{ => DomainObject}/CommentsCommandMiddleware.cs (98%) rename backend/src/Squidex.Domain.Apps.Entities/Comments/{ => DomainObject}/CommentsGrain.cs (97%) rename backend/src/Squidex.Domain.Apps.Entities/Comments/{ => DomainObject}/Guards/GuardComments.cs (97%) rename backend/src/Squidex.Domain.Apps.Entities/Comments/{ => DomainObject}/ICommentsGrain.cs (92%) rename backend/src/Squidex.Domain.Apps.Entities/Contents/{ => DomainObject}/ContentCommandMiddleware.cs (96%) create mode 100644 backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/ContentDomainObject.State.cs rename backend/src/Squidex.Domain.Apps.Entities/Contents/{ => DomainObject}/ContentDomainObject.cs (97%) rename backend/src/Squidex.Domain.Apps.Entities/Contents/{ => DomainObject}/ContentDomainObjectGrain.cs (87%) rename backend/src/Squidex.Domain.Apps.Entities/Contents/{Operations => DomainObject}/ContentOperationContext.cs (99%) rename backend/src/Squidex.Domain.Apps.Entities/Contents/{State => DomainObject}/ContentVersion.cs (94%) rename backend/src/Squidex.Domain.Apps.Entities/Contents/{ => DomainObject}/Guards/GuardContent.cs (98%) rename backend/src/Squidex.Domain.Apps.Entities/Contents/{ => DomainObject}/IContentGrain.cs (91%) delete mode 100644 backend/src/Squidex.Domain.Apps.Entities/Contents/State/ContentState.cs rename backend/src/Squidex.Domain.Apps.Entities/Rules/{ => DomainObject}/Guards/GuardRule.cs (97%) rename backend/src/Squidex.Domain.Apps.Entities/Rules/{ => DomainObject}/Guards/RuleTriggerValidator.cs (98%) rename backend/src/Squidex.Domain.Apps.Entities/Rules/{ => DomainObject}/IRuleGrain.cs (91%) create mode 100644 backend/src/Squidex.Domain.Apps.Entities/Rules/DomainObject/RuleDomainObject.State.cs rename backend/src/Squidex.Domain.Apps.Entities/Rules/{ => DomainObject}/RuleDomainObject.cs (95%) rename backend/src/Squidex.Domain.Apps.Entities/Rules/{ => DomainObject}/RuleDomainObjectGrain.cs (86%) delete mode 100644 backend/src/Squidex.Domain.Apps.Entities/Rules/State/RuleState.cs rename backend/src/Squidex.Domain.Apps.Entities/Schemas/{ => DomainObject}/Guards/FieldPropertiesValidator.cs (99%) rename backend/src/Squidex.Domain.Apps.Entities/Schemas/{ => DomainObject}/Guards/GuardHelper.cs (96%) rename backend/src/Squidex.Domain.Apps.Entities/Schemas/{ => DomainObject}/Guards/GuardSchema.cs (99%) rename backend/src/Squidex.Domain.Apps.Entities/Schemas/{ => DomainObject}/Guards/GuardSchemaField.cs (98%) rename backend/src/Squidex.Domain.Apps.Entities/Schemas/{ => DomainObject}/ISchemaGrain.cs (90%) create mode 100644 backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/SchemaDomainObject.State.cs rename backend/src/Squidex.Domain.Apps.Entities/Schemas/{ => DomainObject}/SchemaDomainObject.cs (98%) rename backend/src/Squidex.Domain.Apps.Entities/Schemas/{ => DomainObject}/SchemaDomainObjectGrain.cs (85%) delete mode 100644 backend/src/Squidex.Domain.Apps.Entities/Schemas/State/SchemaState.cs rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/{ => DomainObject}/AppCommandMiddlewareTests.cs (97%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/{ => DomainObject}/AppDomainObjectTests.cs (99%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/{ => DomainObject}/Guards/GuardAppClientsTests.cs (98%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/{ => DomainObject}/Guards/GuardAppContributorsTests.cs (99%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/{ => DomainObject}/Guards/GuardAppLanguagesTests.cs (98%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/{ => DomainObject}/Guards/GuardAppPatternsTests.cs (99%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/{ => DomainObject}/Guards/GuardAppRolesTests.cs (99%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/{ => DomainObject}/Guards/GuardAppTests.cs (98%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/{ => DomainObject}/Guards/GuardAppWorkflowTests.cs (99%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/{ => DomainObject}/AssetCommandMiddlewareTests.cs (99%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/{ => DomainObject}/AssetDomainObjectGrainTests.cs (95%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/{ => DomainObject}/AssetDomainObjectTests.cs (98%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/{ => DomainObject}/AssetFolderDomainObjectGrainTests.cs (95%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/{ => DomainObject}/AssetFolderDomainObjectTests.cs (98%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/{ => DomainObject}/Guards/GuardAssetFolderTests.cs (98%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/{ => DomainObject}/Guards/GuardAssetTests.cs (98%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/{ => DomainObject}/CommentsCommandMiddlewareTests.cs (98%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/{ => DomainObject}/CommentsGrainTests.cs (99%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/{ => DomainObject}/Guards/GuardCommentsTests.cs (99%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/{ => DomainObject}/ContentCommandMiddlewareTests.cs (96%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/{ => DomainObject}/ContentDomainObjectGrainTests.cs (95%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/{ => DomainObject}/ContentDomainObjectTests.cs (99%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/{Guard => DomainObject/Guards}/GuardContentTests.cs (99%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/{ => DomainObject}/Guards/GuardRuleTests.cs (98%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/{ => DomainObject}/Guards/Triggers/ContentChangedTriggerTests.cs (98%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/{ => DomainObject}/Guards/Triggers/UsageTriggerValidationTests.cs (97%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/{ => DomainObject}/RuleCommandMiddlewareTests.cs (96%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/{ => DomainObject}/RuleDomainObjectTests.cs (97%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/{ => DomainObject}/Guards/FieldProperties/ArrayFieldPropertiesTests.cs (94%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/{ => DomainObject}/Guards/FieldProperties/AssetsFieldPropertiesTests.cs (98%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/{ => DomainObject}/Guards/FieldProperties/BooleanFieldPropertiesTests.cs (93%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/{ => DomainObject}/Guards/FieldProperties/DateTimeFieldPropertiesTests.cs (97%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/{ => DomainObject}/Guards/FieldProperties/GeolocationFieldPropertiesTests.cs (93%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/{ => DomainObject}/Guards/FieldProperties/JsonFieldPropertiesTests.cs (90%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/{ => DomainObject}/Guards/FieldProperties/NumberFieldPropertiesTests.cs (97%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/{ => DomainObject}/Guards/FieldProperties/ReferencesFieldPropertiesTests.cs (96%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/{ => DomainObject}/Guards/FieldProperties/StringFieldPropertiesTests.cs (98%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/{ => DomainObject}/Guards/FieldProperties/TagsFieldPropertiesTests.cs (96%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/{ => DomainObject}/Guards/FieldProperties/UIFieldPropertiesTests.cs (94%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/{ => DomainObject}/Guards/GuardSchemaFieldTests.cs (99%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/{ => DomainObject}/Guards/GuardSchemaTests.cs (99%) rename backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/{ => DomainObject}/SchemaDomainObjectTests.cs (99%) diff --git a/backend/src/Migrations/Migrations/ClearRules.cs b/backend/src/Migrations/Migrations/ClearRules.cs index 97b3976b1..d281028b2 100644 --- a/backend/src/Migrations/Migrations/ClearRules.cs +++ b/backend/src/Migrations/Migrations/ClearRules.cs @@ -7,7 +7,7 @@ using System; using System.Threading.Tasks; -using Squidex.Domain.Apps.Entities.Rules.State; +using Squidex.Domain.Apps.Entities.Rules.DomainObject; using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.States; @@ -24,7 +24,7 @@ namespace Migrations.Migrations public Task UpdateAsync() { - return store.ClearSnapshotsAsync(); + return store.ClearSnapshotsAsync(); } } } diff --git a/backend/src/Migrations/Migrations/ClearSchemas.cs b/backend/src/Migrations/Migrations/ClearSchemas.cs index 302f8793c..a9e14a935 100644 --- a/backend/src/Migrations/Migrations/ClearSchemas.cs +++ b/backend/src/Migrations/Migrations/ClearSchemas.cs @@ -7,7 +7,7 @@ using System; using System.Threading.Tasks; -using Squidex.Domain.Apps.Entities.Schemas.State; +using Squidex.Domain.Apps.Entities.Schemas.DomainObject; using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.States; @@ -24,7 +24,7 @@ namespace Migrations.Migrations public Task UpdateAsync() { - return store.ClearSnapshotsAsync(); + return store.ClearSnapshotsAsync(); } } } diff --git a/backend/src/Migrations/Migrations/CreateAssetSlugs.cs b/backend/src/Migrations/Migrations/CreateAssetSlugs.cs index dc3bef24c..9f2ec3948 100644 --- a/backend/src/Migrations/Migrations/CreateAssetSlugs.cs +++ b/backend/src/Migrations/Migrations/CreateAssetSlugs.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; using Squidex.Domain.Apps.Entities.Assets; -using Squidex.Domain.Apps.Entities.Assets.State; +using Squidex.Domain.Apps.Entities.Assets.DomainObject; using Squidex.Infrastructure; using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.States; @@ -16,9 +16,9 @@ namespace Migrations.Migrations { public sealed class CreateAssetSlugs : IMigration { - private readonly ISnapshotStore stateForAssets; + private readonly ISnapshotStore stateForAssets; - public CreateAssetSlugs(ISnapshotStore stateForAssets) + public CreateAssetSlugs(ISnapshotStore stateForAssets) { this.stateForAssets = stateForAssets; } diff --git a/backend/src/Migrations/RebuilderExtensions.cs b/backend/src/Migrations/RebuilderExtensions.cs index c1ead0a17..635e0bf11 100644 --- a/backend/src/Migrations/RebuilderExtensions.cs +++ b/backend/src/Migrations/RebuilderExtensions.cs @@ -7,16 +7,11 @@ using System.Threading; using System.Threading.Tasks; -using Squidex.Domain.Apps.Entities.Apps; -using Squidex.Domain.Apps.Entities.Apps.State; -using Squidex.Domain.Apps.Entities.Assets; -using Squidex.Domain.Apps.Entities.Assets.State; -using Squidex.Domain.Apps.Entities.Contents; -using Squidex.Domain.Apps.Entities.Contents.State; -using Squidex.Domain.Apps.Entities.Rules; -using Squidex.Domain.Apps.Entities.Rules.State; -using Squidex.Domain.Apps.Entities.Schemas; -using Squidex.Domain.Apps.Entities.Schemas.State; +using Squidex.Domain.Apps.Entities.Apps.DomainObject; +using Squidex.Domain.Apps.Entities.Assets.DomainObject; +using Squidex.Domain.Apps.Entities.Contents.DomainObject; +using Squidex.Domain.Apps.Entities.Rules.DomainObject; +using Squidex.Domain.Apps.Entities.Schemas.DomainObject; using Squidex.Infrastructure.Commands; namespace Migrations @@ -25,32 +20,32 @@ namespace Migrations { public static Task RebuildAppsAsync(this Rebuilder rebuilder, CancellationToken ct = default) { - return rebuilder.RebuildAsync("^app\\-", ct); + return rebuilder.RebuildAsync("^app\\-", ct); } public static Task RebuildSchemasAsync(this Rebuilder rebuilder, CancellationToken ct = default) { - return rebuilder.RebuildAsync("^schema\\-", ct); + return rebuilder.RebuildAsync("^schema\\-", ct); } public static Task RebuildRulesAsync(this Rebuilder rebuilder, CancellationToken ct = default) { - return rebuilder.RebuildAsync("^rule\\-", ct); + return rebuilder.RebuildAsync("^rule\\-", ct); } public static Task RebuildAssetsAsync(this Rebuilder rebuilder, CancellationToken ct = default) { - return rebuilder.RebuildAsync("^asset\\-", ct); + return rebuilder.RebuildAsync("^asset\\-", ct); } public static Task RebuildAssetFoldersAsync(this Rebuilder rebuilder, CancellationToken ct = default) { - return rebuilder.RebuildAsync("^assetFolder\\-", ct); + return rebuilder.RebuildAsync("^assetFolder\\-", ct); } public static Task RebuildContentAsync(this Rebuilder rebuilder, CancellationToken ct = default) { - return rebuilder.RebuildAsync("^content\\-", ct); + return rebuilder.RebuildAsync("^content\\-", ct); } } } \ No newline at end of file diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleEventFormatter.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleEventFormatter.cs index 6c3b4130d..86979892d 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleEventFormatter.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleEventFormatter.cs @@ -348,7 +348,7 @@ namespace Squidex.Domain.Apps.Core.HandleRules script = null!; - var comparer = StringComparison.OrdinalIgnoreCase; + const StringComparison comparer = StringComparison.OrdinalIgnoreCase; if (text.StartsWith(ScriptPrefix, comparer) && text.EndsWith(ScriptSuffix, comparer)) { @@ -366,7 +366,7 @@ namespace Squidex.Domain.Apps.Core.HandleRules script = null!; - var comparer = StringComparison.OrdinalIgnoreCase; + const StringComparison comparer = StringComparison.OrdinalIgnoreCase; if (text.StartsWith(TemplatePrefix, comparer) && text.EndsWith(TemplateSuffix, comparer)) { diff --git a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetFolderRepository_SnapshotStore.cs b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetFolderRepository_SnapshotStore.cs index fd34b6cf9..2ccbdb7d5 100644 --- a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetFolderRepository_SnapshotStore.cs +++ b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetFolderRepository_SnapshotStore.cs @@ -10,7 +10,7 @@ using System.Threading; using System.Threading.Tasks; using MongoDB.Bson; using MongoDB.Driver; -using Squidex.Domain.Apps.Entities.Assets.State; +using Squidex.Domain.Apps.Entities.Assets.DomainObject; using Squidex.Infrastructure; using Squidex.Infrastructure.MongoDb; using Squidex.Infrastructure.Reflection; @@ -19,9 +19,9 @@ using Squidex.Log; namespace Squidex.Domain.Apps.Entities.MongoDb.Assets { - public sealed partial class MongoAssetFolderRepository : ISnapshotStore + public sealed partial class MongoAssetFolderRepository : ISnapshotStore { - async Task<(AssetFolderState Value, long Version)> ISnapshotStore.ReadAsync(DomainId key) + async Task<(AssetFolderDomainObject.State Value, long Version)> ISnapshotStore.ReadAsync(DomainId key) { using (Profiler.TraceMethod()) { @@ -38,7 +38,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Assets } } - async Task ISnapshotStore.WriteAsync(DomainId key, AssetFolderState value, long oldVersion, long newVersion) + async Task ISnapshotStore.WriteAsync(DomainId key, AssetFolderDomainObject.State value, long oldVersion, long newVersion) { using (Profiler.TraceMethod()) { @@ -50,7 +50,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Assets } } - async Task ISnapshotStore.ReadAllAsync(Func callback, CancellationToken ct) + async Task ISnapshotStore.ReadAllAsync(Func callback, CancellationToken ct) { using (Profiler.TraceMethod()) { @@ -58,7 +58,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Assets } } - async Task ISnapshotStore.RemoveAsync(DomainId key) + async Task ISnapshotStore.RemoveAsync(DomainId key) { using (Profiler.TraceMethod()) { @@ -66,9 +66,9 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Assets } } - private static AssetFolderState Map(MongoAssetFolderEntity existing) + private static AssetFolderDomainObject.State Map(MongoAssetFolderEntity existing) { - return SimpleMapper.Map(existing, new AssetFolderState()); + return SimpleMapper.Map(existing, new AssetFolderDomainObject.State()); } } } diff --git a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetRepository.cs b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetRepository.cs index c6a405970..379e9d6e2 100644 --- a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetRepository.cs +++ b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetRepository.cs @@ -16,7 +16,6 @@ using Squidex.Domain.Apps.Entities.MongoDb.Assets.Visitors; using Squidex.Infrastructure; using Squidex.Infrastructure.MongoDb; using Squidex.Infrastructure.MongoDb.Queries; -using Squidex.Infrastructure.Tasks; using Squidex.Infrastructure.Translations; using Squidex.Log; diff --git a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetRepository_SnapshotStore.cs b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetRepository_SnapshotStore.cs index a0c340740..a6b8fb548 100644 --- a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetRepository_SnapshotStore.cs +++ b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetRepository_SnapshotStore.cs @@ -10,7 +10,7 @@ using System.Threading; using System.Threading.Tasks; using MongoDB.Bson; using MongoDB.Driver; -using Squidex.Domain.Apps.Entities.Assets.State; +using Squidex.Domain.Apps.Entities.Assets.DomainObject; using Squidex.Infrastructure; using Squidex.Infrastructure.MongoDb; using Squidex.Infrastructure.Reflection; @@ -19,9 +19,9 @@ using Squidex.Log; namespace Squidex.Domain.Apps.Entities.MongoDb.Assets { - public sealed partial class MongoAssetRepository : ISnapshotStore + public sealed partial class MongoAssetRepository : ISnapshotStore { - async Task<(AssetState Value, long Version)> ISnapshotStore.ReadAsync(DomainId key) + async Task<(AssetDomainObject.State Value, long Version)> ISnapshotStore.ReadAsync(DomainId key) { using (Profiler.TraceMethod()) { @@ -38,7 +38,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Assets } } - async Task ISnapshotStore.WriteAsync(DomainId key, AssetState value, long oldVersion, long newVersion) + async Task ISnapshotStore.WriteAsync(DomainId key, AssetDomainObject.State value, long oldVersion, long newVersion) { using (Profiler.TraceMethod()) { @@ -50,7 +50,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Assets } } - async Task ISnapshotStore.ReadAllAsync(Func callback, CancellationToken ct) + async Task ISnapshotStore.ReadAllAsync(Func callback, CancellationToken ct) { using (Profiler.TraceMethod()) { @@ -58,7 +58,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Assets } } - async Task ISnapshotStore.RemoveAsync(DomainId key) + async Task ISnapshotStore.RemoveAsync(DomainId key) { using (Profiler.TraceMethod()) { @@ -66,9 +66,9 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Assets } } - private static AssetState Map(MongoAssetEntity existing) + private static AssetDomainObject.State Map(MongoAssetEntity existing) { - return SimpleMapper.Map(existing, new AssetState()); + return SimpleMapper.Map(existing, new AssetDomainObject.State()); } } } diff --git a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/MongoContentRepository_SnapshotStore.cs b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/MongoContentRepository_SnapshotStore.cs index 2917a1b33..f28534fda 100644 --- a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/MongoContentRepository_SnapshotStore.cs +++ b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/MongoContentRepository_SnapshotStore.cs @@ -9,7 +9,7 @@ using System; using System.Threading; using System.Threading.Tasks; using Squidex.Domain.Apps.Core.Contents; -using Squidex.Domain.Apps.Entities.Contents.State; +using Squidex.Domain.Apps.Entities.Contents.DomainObject; using Squidex.Domain.Apps.Entities.Schemas; using Squidex.Infrastructure; using Squidex.Infrastructure.Reflection; @@ -18,14 +18,14 @@ using Squidex.Log; namespace Squidex.Domain.Apps.Entities.MongoDb.Contents { - public partial class MongoContentRepository : ISnapshotStore + public partial class MongoContentRepository : ISnapshotStore { - Task ISnapshotStore.ReadAllAsync(Func callback, CancellationToken ct) + Task ISnapshotStore.ReadAllAsync(Func callback, CancellationToken ct) { throw new NotSupportedException(); } - async Task ISnapshotStore.ClearAsync() + async Task ISnapshotStore.ClearAsync() { using (Profiler.TraceMethod()) { @@ -34,7 +34,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents } } - async Task ISnapshotStore.RemoveAsync(DomainId key) + async Task ISnapshotStore.RemoveAsync(DomainId key) { using (Profiler.TraceMethod()) { @@ -43,7 +43,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents } } - async Task<(ContentState Value, long Version)> ISnapshotStore.ReadAsync(DomainId key) + async Task<(ContentDomainObject.State Value, long Version)> ISnapshotStore.ReadAsync(DomainId key) { using (Profiler.TraceMethod()) { @@ -60,14 +60,14 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents contentEntity.ParseData(schema.SchemaDef, converter); - return (SimpleMapper.Map(contentEntity, new ContentState()), contentEntity.Version); + return (SimpleMapper.Map(contentEntity, new ContentDomainObject.State()), contentEntity.Version); } return (null!, EtagVersion.NotFound); } } - async Task ISnapshotStore.WriteAsync(DomainId key, ContentState value, long oldVersion, long newVersion) + async Task ISnapshotStore.WriteAsync(DomainId key, ContentDomainObject.State value, long oldVersion, long newVersion) { using (Profiler.TraceMethod()) { @@ -90,7 +90,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents } } - private async Task UpsertOrDeletePublishedAsync(ContentState value, long oldVersion, long newVersion, ISchemaEntity schema) + private async Task UpsertOrDeletePublishedAsync(ContentDomainObject.State value, long oldVersion, long newVersion, ISchemaEntity schema) { if (value.Status == Status.Published && !value.IsDeleted) { @@ -109,7 +109,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents return collectionPublished.RemoveAsync(documentId); } - private async Task UpsertDraftContentAsync(ContentState value, long oldVersion, long newVersion, ISchemaEntity schema) + private async Task UpsertDraftContentAsync(ContentDomainObject.State value, long oldVersion, long newVersion, ISchemaEntity schema) { var content = SimpleMapper.Map(value, new MongoContentEntity { @@ -128,7 +128,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents await collectionAll.UpsertVersionedAsync(content.DocumentId, oldVersion, content); } - private async Task UpsertPublishedContentAsync(ContentState value, long oldVersion, long newVersion, ISchemaEntity schema) + private async Task UpsertPublishedContentAsync(ContentDomainObject.State value, long oldVersion, long newVersion, ISchemaEntity schema) { var content = SimpleMapper.Map(value, new MongoContentEntity { diff --git a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/QueryByQuery.cs b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/QueryByQuery.cs index 064269047..a81e539da 100644 --- a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/QueryByQuery.cs +++ b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/QueryByQuery.cs @@ -20,7 +20,6 @@ using Squidex.Domain.Apps.Entities.Schemas; using Squidex.Infrastructure; using Squidex.Infrastructure.MongoDb.Queries; using Squidex.Infrastructure.Queries; -using Squidex.Infrastructure.Tasks; using Squidex.Infrastructure.Translations; namespace Squidex.Domain.Apps.Entities.MongoDb.Contents.Operations diff --git a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Rules/MongoRuleEventRepository.cs b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Rules/MongoRuleEventRepository.cs index b06b7e2b7..ad04ed92c 100644 --- a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Rules/MongoRuleEventRepository.cs +++ b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Rules/MongoRuleEventRepository.cs @@ -18,7 +18,6 @@ using Squidex.Domain.Apps.Entities.Rules.Repositories; using Squidex.Infrastructure; using Squidex.Infrastructure.MongoDb; using Squidex.Infrastructure.Reflection; -using Squidex.Infrastructure.Tasks; namespace Squidex.Domain.Apps.Entities.MongoDb.Rules { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/AppCommandMiddleware.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/AppCommandMiddleware.cs similarity index 97% rename from backend/src/Squidex.Domain.Apps.Entities/Apps/AppCommandMiddleware.cs rename to backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/AppCommandMiddleware.cs index 8dd631ed2..418256aeb 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/AppCommandMiddleware.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/AppCommandMiddleware.cs @@ -14,7 +14,7 @@ using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Translations; using Squidex.Infrastructure.Validation; -namespace Squidex.Domain.Apps.Entities.Apps +namespace Squidex.Domain.Apps.Entities.Apps.DomainObject { public sealed class AppCommandMiddleware : GrainCommandMiddleware { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/AppDomainObject.State.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/AppDomainObject.State.cs new file mode 100644 index 000000000..1a5d53096 --- /dev/null +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/AppDomainObject.State.cs @@ -0,0 +1,231 @@ +// ========================================================================== +// Squidex Headless CMS +// ========================================================================== +// Copyright (c) Squidex UG (haftungsbeschränkt) +// All rights reserved. Licensed under the MIT license. +// ========================================================================== + +using System; +using System.Runtime.Serialization; +using Squidex.Domain.Apps.Core.Apps; +using Squidex.Domain.Apps.Core.Contents; +using Squidex.Domain.Apps.Events.Apps; +using Squidex.Infrastructure; +using Squidex.Infrastructure.Commands; +using Squidex.Infrastructure.EventSourcing; +using Squidex.Infrastructure.Reflection; +using Squidex.Infrastructure.States; + +namespace Squidex.Domain.Apps.Entities.Apps.DomainObject +{ + public sealed partial class AppDomainObject + { + [CollectionName("Apps")] + public sealed class State : DomainObjectState, IAppEntity + { + public string Name { get; set; } + + public string Label { get; set; } + + public string Description { get; set; } + + public Roles Roles { get; set; } = Roles.Empty; + + public AppImage? Image { get; set; } + + public AppPlan? Plan { get; set; } + + public AppClients Clients { get; set; } = AppClients.Empty; + + public AppPatterns Patterns { get; set; } = AppPatterns.Empty; + + public AppContributors Contributors { get; set; } = AppContributors.Empty; + + public LanguagesConfig Languages { get; set; } = LanguagesConfig.English; + + public Workflows Workflows { get; set; } = Workflows.Empty; + + public bool IsArchived { get; set; } + + [IgnoreDataMember] + public DomainId UniqueId + { + get { return Id; } + } + + public override bool ApplyEvent(IEvent @event) + { + switch (@event) + { + case AppCreated e: + { + Id = e.AppId.Id; + + SimpleMapper.Map(e, this); + + return true; + } + + case AppUpdated e when Is.Change(Label, e.Label) || Is.Change(Description, e.Description): + { + SimpleMapper.Map(e, this); + + return true; + } + + case AppImageUploaded e: + return UpdateImage(e, ev => ev.Image); + + case AppImageRemoved e when Image != null: + return UpdateImage(e, ev => null); + + case AppPlanChanged e when Is.Change(Plan?.PlanId, e.PlanId): + return UpdatePlan(e, ev => ev.ToAppPlan()); + + case AppPlanReset e when Plan != null: + return UpdatePlan(e, ev => null); + + case AppContributorAssigned e: + return UpdateContributors(e, (ev, c) => c.Assign(ev.ContributorId, ev.Role)); + + case AppContributorRemoved e: + return UpdateContributors(e, (ev, c) => c.Remove(ev.ContributorId)); + + case AppClientAttached e: + return UpdateClients(e, (ev, c) => c.Add(ev.Id, ev.Secret)); + + case AppClientUpdated e: + return UpdateClients(e, (ev, c) => c.Update(ev.Id, ev.Name, ev.Role, ev.ApiCallsLimit, ev.ApiTrafficLimit, ev.AllowAnonymous)); + + case AppClientRevoked e: + return UpdateClients(e, (ev, c) => c.Revoke(ev.Id)); + + case AppWorkflowAdded e: + return UpdateWorkflows(e, (ev, w) => w.Add(ev.WorkflowId, ev.Name)); + + case AppWorkflowUpdated e: + return UpdateWorkflows(e, (ev, w) => w.Update(ev.WorkflowId, ev.Workflow)); + + case AppWorkflowDeleted e: + return UpdateWorkflows(e, (ev, w) => w.Remove(ev.WorkflowId)); + + case AppPatternAdded e: + return UpdatePatterns(e, (ev, p) => p.Add(ev.PatternId, ev.Name, ev.Pattern, ev.Message)); + + case AppPatternDeleted e: + return UpdatePatterns(e, (ev, p) => p.Remove(ev.PatternId)); + + case AppPatternUpdated e: + return UpdatePatterns(e, (ev, p) => p.Update(ev.PatternId, ev.Name, ev.Pattern, ev.Message)); + + case AppRoleAdded e: + return UpdateRoles(e, (ev, r) => r.Add(ev.Name)); + + case AppRoleUpdated e: + return UpdateRoles(e, (ev, r) => r.Update(ev.Name, ev.ToPermissions(), ev.Properties)); + + case AppRoleDeleted e: + return UpdateRoles(e, (ev, r) => r.Remove(ev.Name)); + + case AppLanguageAdded e: + return UpdateLanguages(e, (ev, l) => l.Set(ev.Language)); + + case AppLanguageRemoved e: + return UpdateLanguages(e, (ev, l) => l.Remove(ev.Language)); + + case AppLanguageUpdated e: + return UpdateLanguages(e, (ev, l) => + { + l = l.Set(ev.Language, ev.IsOptional, ev.Fallback); + + if (ev.IsMaster) + { + l = Languages.MakeMaster(ev.Language); + } + + return l; + }); + + case AppArchived _: + { + Plan = null; + + IsArchived = true; + + return true; + } + } + + return false; + } + + private bool UpdateContributors(T @event, Func update) + { + var previous = Contributors; + + Contributors = update(@event, previous); + + return !ReferenceEquals(previous, Contributors); + } + + private bool UpdateClients(T @event, Func update) + { + var previous = Clients; + + Clients = update(@event, previous); + + return !ReferenceEquals(previous, Clients); + } + + private bool UpdateLanguages(T @event, Func update) + { + var previous = Languages; + + Languages = update(@event, previous); + + return !ReferenceEquals(previous, Languages); + } + + private bool UpdatePatterns(T @event, Func update) + { + var previous = Patterns; + + Patterns = update(@event, previous); + + return !ReferenceEquals(previous, Patterns); + } + + private bool UpdateRoles(T @event, Func update) + { + var previous = Roles; + + Roles = update(@event, previous); + + return !ReferenceEquals(previous, Roles); + } + + private bool UpdateWorkflows(T @event, Func update) + { + var previous = Workflows; + + Workflows = update(@event, previous); + + return !ReferenceEquals(previous, Workflows); + } + + private bool UpdateImage(T @event, Func update) + { + Image = update(@event); + + return true; + } + + private bool UpdatePlan(T @event, Func update) + { + Plan = update(@event); + + return true; + } + } + } +} diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/AppDomainObject.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/AppDomainObject.cs similarity index 98% rename from backend/src/Squidex.Domain.Apps.Entities/Apps/AppDomainObject.cs rename to backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/AppDomainObject.cs index 7c59510b1..eb68ce085 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/AppDomainObject.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/AppDomainObject.cs @@ -10,9 +10,8 @@ using System.Collections.Generic; using System.Threading.Tasks; using Squidex.Domain.Apps.Core.Apps; using Squidex.Domain.Apps.Entities.Apps.Commands; -using Squidex.Domain.Apps.Entities.Apps.Guards; +using Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards; using Squidex.Domain.Apps.Entities.Apps.Plans; -using Squidex.Domain.Apps.Entities.Apps.State; using Squidex.Domain.Apps.Events; using Squidex.Domain.Apps.Events.Apps; using Squidex.Infrastructure; @@ -23,9 +22,9 @@ using Squidex.Infrastructure.States; using Squidex.Log; using Squidex.Shared.Users; -namespace Squidex.Domain.Apps.Entities.Apps +namespace Squidex.Domain.Apps.Entities.Apps.DomainObject { - public class AppDomainObject : DomainObject + public sealed partial class AppDomainObject : DomainObject { private readonly InitialPatterns initialPatterns; private readonly IAppPlansProvider appPlansProvider; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/AppDomainObjectGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/AppDomainObjectGrain.cs similarity index 86% rename from backend/src/Squidex.Domain.Apps.Entities/Apps/AppDomainObjectGrain.cs rename to backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/AppDomainObjectGrain.cs index 4a590f9d9..e50af86ed 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/AppDomainObjectGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/AppDomainObjectGrain.cs @@ -7,13 +7,12 @@ using System; using System.Threading.Tasks; -using Squidex.Domain.Apps.Entities.Apps.State; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Orleans; -namespace Squidex.Domain.Apps.Entities.Apps +namespace Squidex.Domain.Apps.Entities.Apps.DomainObject { - public sealed class AppDomainObjectGrain : DomainObjectGrain, IAppGrain + public sealed class AppDomainObjectGrain : DomainObjectGrain, IAppGrain { public AppDomainObjectGrain(IServiceProvider serviceProvider) : base(serviceProvider) diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardApp.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/Guards/GuardApp.cs similarity index 97% rename from backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardApp.cs rename to backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/Guards/GuardApp.cs index fb92f11f2..c2e8aba93 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardApp.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/Guards/GuardApp.cs @@ -12,7 +12,7 @@ using Squidex.Infrastructure.Translations; using Squidex.Infrastructure.Validation; using Squidex.Text; -namespace Squidex.Domain.Apps.Entities.Apps.Guards +namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards { public static class GuardApp { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppClients.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/Guards/GuardAppClients.cs similarity index 98% rename from backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppClients.cs rename to backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/Guards/GuardAppClients.cs index 1ccca8a7c..11b307505 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppClients.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/Guards/GuardAppClients.cs @@ -11,7 +11,7 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Translations; using Squidex.Infrastructure.Validation; -namespace Squidex.Domain.Apps.Entities.Apps.Guards +namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards { public static class GuardAppClients { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppContributors.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/Guards/GuardAppContributors.cs similarity index 98% rename from backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppContributors.cs rename to backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/Guards/GuardAppContributors.cs index 7edd25feb..c588560c9 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppContributors.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/Guards/GuardAppContributors.cs @@ -16,7 +16,7 @@ using Squidex.Infrastructure.Translations; using Squidex.Infrastructure.Validation; using Squidex.Shared.Users; -namespace Squidex.Domain.Apps.Entities.Apps.Guards +namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards { public static class GuardAppContributors { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppLanguages.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/Guards/GuardAppLanguages.cs similarity index 98% rename from backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppLanguages.cs rename to backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/Guards/GuardAppLanguages.cs index ec3f66b45..6a50f3d7f 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppLanguages.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/Guards/GuardAppLanguages.cs @@ -11,7 +11,7 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Translations; using Squidex.Infrastructure.Validation; -namespace Squidex.Domain.Apps.Entities.Apps.Guards +namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards { public static class GuardAppLanguages { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppPatterns.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/Guards/GuardAppPatterns.cs similarity index 98% rename from backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppPatterns.cs rename to backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/Guards/GuardAppPatterns.cs index a20fefe8f..b5c0a2b29 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppPatterns.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/Guards/GuardAppPatterns.cs @@ -12,7 +12,7 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Translations; using Squidex.Infrastructure.Validation; -namespace Squidex.Domain.Apps.Entities.Apps.Guards +namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards { public static class GuardAppPatterns { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppRoles.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/Guards/GuardAppRoles.cs similarity index 98% rename from backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppRoles.cs rename to backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/Guards/GuardAppRoles.cs index fb214760b..3aeb5e8db 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppRoles.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/Guards/GuardAppRoles.cs @@ -13,7 +13,7 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Translations; using Squidex.Infrastructure.Validation; -namespace Squidex.Domain.Apps.Entities.Apps.Guards +namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards { public static class GuardAppRoles { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppWorkflows.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/Guards/GuardAppWorkflows.cs similarity index 98% rename from backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppWorkflows.cs rename to backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/Guards/GuardAppWorkflows.cs index 2eec80367..ec02d4ef9 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppWorkflows.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/Guards/GuardAppWorkflows.cs @@ -11,7 +11,7 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Translations; using Squidex.Infrastructure.Validation; -namespace Squidex.Domain.Apps.Entities.Apps.Guards +namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards { public static class GuardAppWorkflows { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/IAppGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/IAppGrain.cs similarity index 91% rename from backend/src/Squidex.Domain.Apps.Entities/Apps/IAppGrain.cs rename to backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/IAppGrain.cs index d98dd68b8..49c81b351 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/IAppGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/DomainObject/IAppGrain.cs @@ -9,7 +9,7 @@ using System.Threading.Tasks; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Orleans; -namespace Squidex.Domain.Apps.Entities.Apps +namespace Squidex.Domain.Apps.Entities.Apps.DomainObject { public interface IAppGrain : IDomainObjectGrain { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Indexes/AppsIndex.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/Indexes/AppsIndex.cs index 9369b78f2..211ba1577 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Indexes/AppsIndex.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/Indexes/AppsIndex.cs @@ -12,6 +12,7 @@ using System.Threading.Tasks; using Orleans; using Squidex.Caching; using Squidex.Domain.Apps.Entities.Apps.Commands; +using Squidex.Domain.Apps.Entities.Apps.DomainObject; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Orleans; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/State/AppState.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/State/AppState.cs deleted file mode 100644 index 75ca0c034..000000000 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/State/AppState.cs +++ /dev/null @@ -1,228 +0,0 @@ -// ========================================================================== -// Squidex Headless CMS -// ========================================================================== -// Copyright (c) Squidex UG (haftungsbeschränkt) -// All rights reserved. Licensed under the MIT license. -// ========================================================================== - -using System; -using System.Runtime.Serialization; -using Squidex.Domain.Apps.Core.Apps; -using Squidex.Domain.Apps.Core.Contents; -using Squidex.Domain.Apps.Events.Apps; -using Squidex.Infrastructure; -using Squidex.Infrastructure.Commands; -using Squidex.Infrastructure.EventSourcing; -using Squidex.Infrastructure.Reflection; -using Squidex.Infrastructure.States; - -namespace Squidex.Domain.Apps.Entities.Apps.State -{ - [CollectionName("Apps")] - public class AppState : DomainObjectState, IAppEntity - { - public string Name { get; set; } - - public string Label { get; set; } - - public string Description { get; set; } - - public Roles Roles { get; set; } = Roles.Empty; - - public AppImage? Image { get; set; } - - public AppPlan? Plan { get; set; } - - public AppClients Clients { get; set; } = AppClients.Empty; - - public AppPatterns Patterns { get; set; } = AppPatterns.Empty; - - public AppContributors Contributors { get; set; } = AppContributors.Empty; - - public LanguagesConfig Languages { get; set; } = LanguagesConfig.English; - - public Workflows Workflows { get; set; } = Workflows.Empty; - - public bool IsArchived { get; set; } - - [IgnoreDataMember] - public DomainId UniqueId - { - get { return Id; } - } - - public override bool ApplyEvent(IEvent @event) - { - switch (@event) - { - case AppCreated e: - { - Id = e.AppId.Id; - - SimpleMapper.Map(e, this); - - return true; - } - - case AppUpdated e when Is.Change(Label, e.Label) || Is.Change(Description, e.Description): - { - SimpleMapper.Map(e, this); - - return true; - } - - case AppImageUploaded e: - return UpdateImage(e, ev => ev.Image); - - case AppImageRemoved e when Image != null: - return UpdateImage(e, ev => null); - - case AppPlanChanged e when Is.Change(Plan?.PlanId, e.PlanId): - return UpdatePlan(e, ev => ev.ToAppPlan()); - - case AppPlanReset e when Plan != null: - return UpdatePlan(e, ev => null); - - case AppContributorAssigned e: - return UpdateContributors(e, (ev, c) => c.Assign(ev.ContributorId, ev.Role)); - - case AppContributorRemoved e: - return UpdateContributors(e, (ev, c) => c.Remove(ev.ContributorId)); - - case AppClientAttached e: - return UpdateClients(e, (ev, c) => c.Add(ev.Id, ev.Secret)); - - case AppClientUpdated e: - return UpdateClients(e, (ev, c) => c.Update(ev.Id, ev.Name, ev.Role, ev.ApiCallsLimit, ev.ApiTrafficLimit, ev.AllowAnonymous)); - - case AppClientRevoked e: - return UpdateClients(e, (ev, c) => c.Revoke(ev.Id)); - - case AppWorkflowAdded e: - return UpdateWorkflows(e, (ev, w) => w.Add(ev.WorkflowId, ev.Name)); - - case AppWorkflowUpdated e: - return UpdateWorkflows(e, (ev, w) => w.Update(ev.WorkflowId, ev.Workflow)); - - case AppWorkflowDeleted e: - return UpdateWorkflows(e, (ev, w) => w.Remove(ev.WorkflowId)); - - case AppPatternAdded e: - return UpdatePatterns(e, (ev, p) => p.Add(ev.PatternId, ev.Name, ev.Pattern, ev.Message)); - - case AppPatternDeleted e: - return UpdatePatterns(e, (ev, p) => p.Remove(ev.PatternId)); - - case AppPatternUpdated e: - return UpdatePatterns(e, (ev, p) => p.Update(ev.PatternId, ev.Name, ev.Pattern, ev.Message)); - - case AppRoleAdded e: - return UpdateRoles(e, (ev, r) => r.Add(ev.Name)); - - case AppRoleUpdated e: - return UpdateRoles(e, (ev, r) => r.Update(ev.Name, ev.ToPermissions(), ev.Properties)); - - case AppRoleDeleted e: - return UpdateRoles(e, (ev, r) => r.Remove(ev.Name)); - - case AppLanguageAdded e: - return UpdateLanguages(e, (ev, l) => l.Set(ev.Language)); - - case AppLanguageRemoved e: - return UpdateLanguages(e, (ev, l) => l.Remove(ev.Language)); - - case AppLanguageUpdated e: - return UpdateLanguages(e, (ev, l) => - { - l = l.Set(ev.Language, ev.IsOptional, ev.Fallback); - - if (ev.IsMaster) - { - l = Languages.MakeMaster(ev.Language); - } - - return l; - }); - - case AppArchived _: - { - Plan = null; - - IsArchived = true; - - return true; - } - } - - return false; - } - - private bool UpdateContributors(T @event, Func update) - { - var previous = Contributors; - - Contributors = update(@event, previous); - - return !ReferenceEquals(previous, Contributors); - } - - private bool UpdateClients(T @event, Func update) - { - var previous = Clients; - - Clients = update(@event, previous); - - return !ReferenceEquals(previous, Clients); - } - - private bool UpdateLanguages(T @event, Func update) - { - var previous = Languages; - - Languages = update(@event, previous); - - return !ReferenceEquals(previous, Languages); - } - - private bool UpdatePatterns(T @event, Func update) - { - var previous = Patterns; - - Patterns = update(@event, previous); - - return !ReferenceEquals(previous, Patterns); - } - - private bool UpdateRoles(T @event, Func update) - { - var previous = Roles; - - Roles = update(@event, previous); - - return !ReferenceEquals(previous, Roles); - } - - private bool UpdateWorkflows(T @event, Func update) - { - var previous = Workflows; - - Workflows = update(@event, previous); - - return !ReferenceEquals(previous, Workflows); - } - - private bool UpdateImage(T @event, Func update) - { - Image = update(@event); - - return true; - } - - private bool UpdatePlan(T @event, Func update) - { - Plan = update(@event); - - return true; - } - } -} diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/BackupAssets.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/BackupAssets.cs index 61fce33fb..7084a18ed 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/BackupAssets.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/BackupAssets.cs @@ -10,7 +10,7 @@ using System.IO; using System.Threading.Tasks; using Squidex.Assets; using Squidex.Domain.Apps.Core.Tags; -using Squidex.Domain.Apps.Entities.Assets.State; +using Squidex.Domain.Apps.Entities.Assets.DomainObject; using Squidex.Domain.Apps.Entities.Backup; using Squidex.Domain.Apps.Events.Assets; using Squidex.Infrastructure; @@ -101,12 +101,12 @@ namespace Squidex.Domain.Apps.Entities.Assets if (assetIds.Count > 0) { - await rebuilder.InsertManyAsync(assetIds); + await rebuilder.InsertManyAsync(assetIds); } if (assetFolderIds.Count > 0) { - await rebuilder.InsertManyAsync(assetFolderIds); + await rebuilder.InsertManyAsync(assetFolderIds); } } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetCommandMiddleware.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetCommandMiddleware.cs similarity index 99% rename from backend/src/Squidex.Domain.Apps.Entities/Assets/AssetCommandMiddleware.cs rename to backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetCommandMiddleware.cs index 713695800..b65d9d890 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetCommandMiddleware.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetCommandMiddleware.cs @@ -14,7 +14,7 @@ using Squidex.Domain.Apps.Entities.Assets.Commands; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; -namespace Squidex.Domain.Apps.Entities.Assets +namespace Squidex.Domain.Apps.Entities.Assets.DomainObject { public sealed class AssetCommandMiddleware : GrainCommandMiddleware { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetDomainObject.State.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetDomainObject.State.cs new file mode 100644 index 000000000..bab7a66cf --- /dev/null +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetDomainObject.State.cs @@ -0,0 +1,178 @@ +// ========================================================================== +// Squidex Headless CMS +// ========================================================================== +// Copyright (c) Squidex UG (haftungsbeschränkt) +// All rights reserved. Licensed under the MIT license. +// ========================================================================== + +using System.Collections.Generic; +using System.Runtime.Serialization; +using Squidex.Domain.Apps.Core.Assets; +using Squidex.Domain.Apps.Events.Assets; +using Squidex.Infrastructure; +using Squidex.Infrastructure.Commands; +using Squidex.Infrastructure.EventSourcing; +using Squidex.Infrastructure.Reflection; + +namespace Squidex.Domain.Apps.Entities.Assets.DomainObject +{ + public sealed partial class AssetDomainObject + { + public sealed class State : DomainObjectState, IAssetEntity + { + public NamedId AppId { get; set; } + + public DomainId ParentId { get; set; } + + public string FileName { get; set; } + + public string FileHash { get; set; } + + public string MimeType { get; set; } + + public string Slug { get; set; } + + public long FileVersion { get; set; } + + public long FileSize { get; set; } + + public long TotalSize { get; set; } + + public bool IsProtected { get; set; } + + public HashSet Tags { get; set; } + + public AssetMetadata Metadata { get; set; } + + public AssetType Type { get; set; } + + [IgnoreDataMember] + public DomainId AssetId + { + get { return Id; } + } + + [IgnoreDataMember] + public DomainId UniqueId + { + get { return DomainId.Combine(AppId, Id); } + } + + public override bool ApplyEvent(IEvent @event) + { + switch (@event) + { + case AssetCreated e: + { + Id = e.AssetId; + + SimpleMapper.Map(e, this); + + FileName = e.FileName; + + if (string.IsNullOrWhiteSpace(e.Slug)) + { + Slug = e.FileName.ToAssetSlug(); + } + else + { + Slug = e.Slug; + } + + TotalSize += e.FileSize; + + EnsureProperties(); + + return true; + } + + case AssetUpdated e: + { + SimpleMapper.Map(e, this); + + TotalSize += e.FileSize; + + EnsureProperties(); + + return true; + } + + case AssetAnnotated e: + { + var hasChanged = false; + + if (Is.OptionalChange(FileName, e.FileName)) + { + FileName = e.FileName; + + hasChanged = true; + } + + if (Is.OptionalChange(Slug, e.Slug)) + { + Slug = e.Slug; + + hasChanged = true; + } + + if (Is.OptionalChange(IsProtected, e.IsProtected)) + { + IsProtected = e.IsProtected.Value; + + hasChanged = true; + } + + if (Is.OptionalChange(Tags, e.Tags)) + { + Tags = e.Tags; + + hasChanged = true; + } + + if (Is.OptionalChange(Metadata, e.Metadata)) + { + Metadata = e.Metadata; + + hasChanged = true; + } + + EnsureProperties(); + + return hasChanged; + } + + case AssetMoved e when e.ParentId != ParentId: + { + ParentId = e.ParentId; + + EnsureProperties(); + + return true; + } + + case AssetDeleted _: + { + IsDeleted = true; + + return true; + } + } + + return false; + } + + private void EnsureProperties() + { + if (Tags == null) + { + Tags = new HashSet(); + } + + if (Metadata == null) + { + Metadata = new AssetMetadata(); + } + } + } + } +} diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetDomainObject.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetDomainObject.cs similarity index 96% rename from backend/src/Squidex.Domain.Apps.Entities/Assets/AssetDomainObject.cs rename to backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetDomainObject.cs index e9314c967..b48b3bf68 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetDomainObject.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetDomainObject.cs @@ -10,8 +10,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using Squidex.Domain.Apps.Core.Tags; using Squidex.Domain.Apps.Entities.Assets.Commands; -using Squidex.Domain.Apps.Entities.Assets.Guards; -using Squidex.Domain.Apps.Entities.Assets.State; +using Squidex.Domain.Apps.Entities.Assets.DomainObject.Guards; using Squidex.Domain.Apps.Entities.Contents.Repositories; using Squidex.Domain.Apps.Events; using Squidex.Domain.Apps.Events.Assets; @@ -23,9 +22,9 @@ using Squidex.Infrastructure.States; using Squidex.Log; using IAssetTagService = Squidex.Domain.Apps.Core.Tags.ITagService; -namespace Squidex.Domain.Apps.Entities.Assets +namespace Squidex.Domain.Apps.Entities.Assets.DomainObject { - public class AssetDomainObject : LogSnapshotDomainObject + public sealed partial class AssetDomainObject : LogSnapshotDomainObject { private readonly IContentRepository contentRepository; private readonly IAssetTagService assetTags; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetDomainObjectGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetDomainObjectGrain.cs similarity index 89% rename from backend/src/Squidex.Domain.Apps.Entities/Assets/AssetDomainObjectGrain.cs rename to backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetDomainObjectGrain.cs index bdbc4ab77..4ae2cc811 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetDomainObjectGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetDomainObjectGrain.cs @@ -7,14 +7,13 @@ using System; using System.Threading.Tasks; -using Squidex.Domain.Apps.Entities.Assets.State; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Orleans; -namespace Squidex.Domain.Apps.Entities.Assets +namespace Squidex.Domain.Apps.Entities.Assets.DomainObject { - public sealed class AssetDomainObjectGrain : DomainObjectGrain, IAssetGrain + public sealed class AssetDomainObjectGrain : DomainObjectGrain, IAssetGrain { private static readonly TimeSpan Lifetime = TimeSpan.FromMinutes(5); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetFolderDomainObject.State.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetFolderDomainObject.State.cs new file mode 100644 index 000000000..27fc84666 --- /dev/null +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetFolderDomainObject.State.cs @@ -0,0 +1,72 @@ +// ========================================================================== +// Squidex Headless CMS +// ========================================================================== +// Copyright (c) Squidex UG (haftungsbeschränkt) +// All rights reserved. Licensed under the MIT license. +// ========================================================================== + +using System.Runtime.Serialization; +using Squidex.Domain.Apps.Events.Assets; +using Squidex.Infrastructure; +using Squidex.Infrastructure.Commands; +using Squidex.Infrastructure.EventSourcing; +using Squidex.Infrastructure.Reflection; + +namespace Squidex.Domain.Apps.Entities.Assets.DomainObject +{ + public sealed partial class AssetFolderDomainObject + { + public sealed class State : DomainObjectState, IAssetFolderEntity + { + public NamedId AppId { get; set; } + + public string FolderName { get; set; } + + public DomainId ParentId { get; set; } + + [IgnoreDataMember] + public DomainId UniqueId + { + get { return DomainId.Combine(AppId, Id); } + } + + public override bool ApplyEvent(IEvent @event) + { + switch (@event) + { + case AssetFolderCreated e: + { + Id = e.AssetFolderId; + + SimpleMapper.Map(e, this); + + return true; + } + + case AssetFolderRenamed e when Is.OptionalChange(FolderName, e.FolderName): + { + FolderName = e.FolderName; + + return true; + } + + case AssetFolderMoved e when Is.Change(ParentId, e.ParentId): + { + ParentId = e.ParentId; + + return true; + } + + case AssetFolderDeleted _: + { + IsDeleted = true; + + return true; + } + } + + return false; + } + } + } +} diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetFolderDomainObject.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetFolderDomainObject.cs similarity index 94% rename from backend/src/Squidex.Domain.Apps.Entities/Assets/AssetFolderDomainObject.cs rename to backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetFolderDomainObject.cs index c58784a3d..bb1bd00e3 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetFolderDomainObject.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetFolderDomainObject.cs @@ -8,8 +8,7 @@ using System; using System.Threading.Tasks; using Squidex.Domain.Apps.Entities.Assets.Commands; -using Squidex.Domain.Apps.Entities.Assets.Guards; -using Squidex.Domain.Apps.Entities.Assets.State; +using Squidex.Domain.Apps.Entities.Assets.DomainObject.Guards; using Squidex.Domain.Apps.Events; using Squidex.Domain.Apps.Events.Assets; using Squidex.Infrastructure; @@ -19,9 +18,9 @@ using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.States; using Squidex.Log; -namespace Squidex.Domain.Apps.Entities.Assets +namespace Squidex.Domain.Apps.Entities.Assets.DomainObject { - public class AssetFolderDomainObject : DomainObject + public sealed partial class AssetFolderDomainObject : DomainObject { private readonly IAssetQueryService assetQuery; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetFolderDomainObjectGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetFolderDomainObjectGrain.cs similarity index 87% rename from backend/src/Squidex.Domain.Apps.Entities/Assets/AssetFolderDomainObjectGrain.cs rename to backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetFolderDomainObjectGrain.cs index 2381a40a3..bafa3d984 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetFolderDomainObjectGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetFolderDomainObjectGrain.cs @@ -7,13 +7,12 @@ using System; using System.Threading.Tasks; -using Squidex.Domain.Apps.Entities.Assets.State; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Orleans; -namespace Squidex.Domain.Apps.Entities.Assets +namespace Squidex.Domain.Apps.Entities.Assets.DomainObject { - public sealed class AssetFolderDomainObjectGrain : DomainObjectGrain, IAssetFolderGrain + public sealed class AssetFolderDomainObjectGrain : DomainObjectGrain, IAssetFolderGrain { private static readonly TimeSpan Lifetime = TimeSpan.FromMinutes(5); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/Guards/GuardAsset.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/Guards/GuardAsset.cs similarity index 97% rename from backend/src/Squidex.Domain.Apps.Entities/Assets/Guards/GuardAsset.cs rename to backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/Guards/GuardAsset.cs index 86b104577..5b3d387e6 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/Guards/GuardAsset.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/Guards/GuardAsset.cs @@ -13,7 +13,7 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Translations; using Squidex.Infrastructure.Validation; -namespace Squidex.Domain.Apps.Entities.Assets.Guards +namespace Squidex.Domain.Apps.Entities.Assets.DomainObject.Guards { public static class GuardAsset { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/Guards/GuardAssetFolder.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/Guards/GuardAssetFolder.cs similarity index 97% rename from backend/src/Squidex.Domain.Apps.Entities/Assets/Guards/GuardAssetFolder.cs rename to backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/Guards/GuardAssetFolder.cs index 36197dd60..78f23c7cd 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/Guards/GuardAssetFolder.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/Guards/GuardAssetFolder.cs @@ -11,7 +11,7 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Translations; using Squidex.Infrastructure.Validation; -namespace Squidex.Domain.Apps.Entities.Assets.Guards +namespace Squidex.Domain.Apps.Entities.Assets.DomainObject.Guards { public static class GuardAssetFolder { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/IAssetFolderGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/IAssetFolderGrain.cs similarity index 89% rename from backend/src/Squidex.Domain.Apps.Entities/Assets/IAssetFolderGrain.cs rename to backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/IAssetFolderGrain.cs index 924c52ae2..0dd310ab6 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/IAssetFolderGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/IAssetFolderGrain.cs @@ -7,7 +7,7 @@ using Squidex.Infrastructure.Commands; -namespace Squidex.Domain.Apps.Entities.Assets +namespace Squidex.Domain.Apps.Entities.Assets.DomainObject { public interface IAssetFolderGrain : IDomainObjectGrain { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/IAssetGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/IAssetGrain.cs similarity index 91% rename from backend/src/Squidex.Domain.Apps.Entities/Assets/IAssetGrain.cs rename to backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/IAssetGrain.cs index 4018d7e3d..d1ff58e2c 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/IAssetGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/IAssetGrain.cs @@ -10,7 +10,7 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Orleans; -namespace Squidex.Domain.Apps.Entities.Assets +namespace Squidex.Domain.Apps.Entities.Assets.DomainObject { public interface IAssetGrain : IDomainObjectGrain { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/AssetLoader.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/AssetLoader.cs index e0a112657..f6aec087f 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/AssetLoader.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/AssetLoader.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using Orleans; +using Squidex.Domain.Apps.Entities.Assets.DomainObject; using Squidex.Infrastructure; using Squidex.Log; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/State/AssetFolderState.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/State/AssetFolderState.cs deleted file mode 100644 index 15548dd74..000000000 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/State/AssetFolderState.cs +++ /dev/null @@ -1,69 +0,0 @@ -// ========================================================================== -// Squidex Headless CMS -// ========================================================================== -// Copyright (c) Squidex UG (haftungsbeschränkt) -// All rights reserved. Licensed under the MIT license. -// ========================================================================== - -using System.Runtime.Serialization; -using Squidex.Domain.Apps.Events.Assets; -using Squidex.Infrastructure; -using Squidex.Infrastructure.Commands; -using Squidex.Infrastructure.EventSourcing; -using Squidex.Infrastructure.Reflection; - -namespace Squidex.Domain.Apps.Entities.Assets.State -{ - public sealed class AssetFolderState : DomainObjectState, IAssetFolderEntity - { - public NamedId AppId { get; set; } - - public string FolderName { get; set; } - - public DomainId ParentId { get; set; } - - [IgnoreDataMember] - public DomainId UniqueId - { - get { return DomainId.Combine(AppId, Id); } - } - - public override bool ApplyEvent(IEvent @event) - { - switch (@event) - { - case AssetFolderCreated e: - { - Id = e.AssetFolderId; - - SimpleMapper.Map(e, this); - - return true; - } - - case AssetFolderRenamed e when Is.OptionalChange(FolderName, e.FolderName): - { - FolderName = e.FolderName; - - return true; - } - - case AssetFolderMoved e when Is.Change(ParentId, e.ParentId): - { - ParentId = e.ParentId; - - return true; - } - - case AssetFolderDeleted _: - { - IsDeleted = true; - - return true; - } - } - - return false; - } - } -} diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/State/AssetState.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/State/AssetState.cs deleted file mode 100644 index ecdef63da..000000000 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/State/AssetState.cs +++ /dev/null @@ -1,175 +0,0 @@ -// ========================================================================== -// Squidex Headless CMS -// ========================================================================== -// Copyright (c) Squidex UG (haftungsbeschränkt) -// All rights reserved. Licensed under the MIT license. -// ========================================================================== - -using System.Collections.Generic; -using System.Runtime.Serialization; -using Squidex.Domain.Apps.Core.Assets; -using Squidex.Domain.Apps.Events.Assets; -using Squidex.Infrastructure; -using Squidex.Infrastructure.Commands; -using Squidex.Infrastructure.EventSourcing; -using Squidex.Infrastructure.Reflection; - -namespace Squidex.Domain.Apps.Entities.Assets.State -{ - public class AssetState : DomainObjectState, IAssetEntity - { - public NamedId AppId { get; set; } - - public DomainId ParentId { get; set; } - - public string FileName { get; set; } - - public string FileHash { get; set; } - - public string MimeType { get; set; } - - public string Slug { get; set; } - - public long FileVersion { get; set; } - - public long FileSize { get; set; } - - public long TotalSize { get; set; } - - public bool IsProtected { get; set; } - - public HashSet Tags { get; set; } - - public AssetMetadata Metadata { get; set; } - - public AssetType Type { get; set; } - - [IgnoreDataMember] - public DomainId AssetId - { - get { return Id; } - } - - [IgnoreDataMember] - public DomainId UniqueId - { - get { return DomainId.Combine(AppId, Id); } - } - - public override bool ApplyEvent(IEvent @event) - { - switch (@event) - { - case AssetCreated e: - { - Id = e.AssetId; - - SimpleMapper.Map(e, this); - - FileName = e.FileName; - - if (string.IsNullOrWhiteSpace(e.Slug)) - { - Slug = e.FileName.ToAssetSlug(); - } - else - { - Slug = e.Slug; - } - - TotalSize += e.FileSize; - - EnsureProperties(); - - return true; - } - - case AssetUpdated e: - { - SimpleMapper.Map(e, this); - - TotalSize += e.FileSize; - - EnsureProperties(); - - return true; - } - - case AssetAnnotated e: - { - var hasChanged = false; - - if (Is.OptionalChange(FileName, e.FileName)) - { - FileName = e.FileName; - - hasChanged = true; - } - - if (Is.OptionalChange(Slug, e.Slug)) - { - Slug = e.Slug; - - hasChanged = true; - } - - if (Is.OptionalChange(IsProtected, e.IsProtected)) - { - IsProtected = e.IsProtected.Value; - - hasChanged = true; - } - - if (Is.OptionalChange(Tags, e.Tags)) - { - Tags = e.Tags; - - hasChanged = true; - } - - if (Is.OptionalChange(Metadata, e.Metadata)) - { - Metadata = e.Metadata; - - hasChanged = true; - } - - EnsureProperties(); - - return hasChanged; - } - - case AssetMoved e when e.ParentId != ParentId: - { - ParentId = e.ParentId; - - EnsureProperties(); - - return true; - } - - case AssetDeleted _: - { - IsDeleted = true; - - return true; - } - } - - return false; - } - - private void EnsureProperties() - { - if (Tags == null) - { - Tags = new HashSet(); - } - - if (Metadata == null) - { - Metadata = new AssetMetadata(); - } - } - } -} diff --git a/backend/src/Squidex.Domain.Apps.Entities/Comments/CommentsLoader.cs b/backend/src/Squidex.Domain.Apps.Entities/Comments/CommentsLoader.cs index a0f55d7cb..131b573e3 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Comments/CommentsLoader.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Comments/CommentsLoader.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using Orleans; +using Squidex.Domain.Apps.Entities.Comments.DomainObject; using Squidex.Infrastructure; namespace Squidex.Domain.Apps.Entities.Comments diff --git a/backend/src/Squidex.Domain.Apps.Entities/Comments/CommentsCommandMiddleware.cs b/backend/src/Squidex.Domain.Apps.Entities/Comments/DomainObject/CommentsCommandMiddleware.cs similarity index 98% rename from backend/src/Squidex.Domain.Apps.Entities/Comments/CommentsCommandMiddleware.cs rename to backend/src/Squidex.Domain.Apps.Entities/Comments/DomainObject/CommentsCommandMiddleware.cs index 30ec2a721..77998a5a8 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Comments/CommentsCommandMiddleware.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Comments/DomainObject/CommentsCommandMiddleware.cs @@ -17,7 +17,7 @@ using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Orleans; using Squidex.Shared.Users; -namespace Squidex.Domain.Apps.Entities.Comments +namespace Squidex.Domain.Apps.Entities.Comments.DomainObject { public sealed class CommentsCommandMiddleware : ICommandMiddleware { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Comments/CommentsGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Comments/DomainObject/CommentsGrain.cs similarity index 97% rename from backend/src/Squidex.Domain.Apps.Entities/Comments/CommentsGrain.cs rename to backend/src/Squidex.Domain.Apps.Entities/Comments/DomainObject/CommentsGrain.cs index 13a702239..9d25e9ae0 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Comments/CommentsGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Comments/DomainObject/CommentsGrain.cs @@ -10,7 +10,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Squidex.Domain.Apps.Entities.Comments.Commands; -using Squidex.Domain.Apps.Entities.Comments.Guards; +using Squidex.Domain.Apps.Entities.Comments.DomainObject.Guards; using Squidex.Domain.Apps.Events.Comments; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; @@ -18,7 +18,7 @@ using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.Orleans; using Squidex.Infrastructure.Reflection; -namespace Squidex.Domain.Apps.Entities.Comments +namespace Squidex.Domain.Apps.Entities.Comments.DomainObject { public sealed class CommentsGrain : GrainOfString, ICommentsGrain { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Comments/Guards/GuardComments.cs b/backend/src/Squidex.Domain.Apps.Entities/Comments/DomainObject/Guards/GuardComments.cs similarity index 97% rename from backend/src/Squidex.Domain.Apps.Entities/Comments/Guards/GuardComments.cs rename to backend/src/Squidex.Domain.Apps.Entities/Comments/DomainObject/Guards/GuardComments.cs index f357faf23..e6e865a62 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Comments/Guards/GuardComments.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Comments/DomainObject/Guards/GuardComments.cs @@ -13,7 +13,7 @@ using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.Translations; using Squidex.Infrastructure.Validation; -namespace Squidex.Domain.Apps.Entities.Comments.Guards +namespace Squidex.Domain.Apps.Entities.Comments.DomainObject.Guards { public static class GuardComments { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Comments/ICommentsGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Comments/DomainObject/ICommentsGrain.cs similarity index 92% rename from backend/src/Squidex.Domain.Apps.Entities/Comments/ICommentsGrain.cs rename to backend/src/Squidex.Domain.Apps.Entities/Comments/DomainObject/ICommentsGrain.cs index 98bb933bb..ce395707e 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Comments/ICommentsGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Comments/DomainObject/ICommentsGrain.cs @@ -11,7 +11,7 @@ using Squidex.Domain.Apps.Entities.Comments.Commands; using Squidex.Infrastructure; using Squidex.Infrastructure.Orleans; -namespace Squidex.Domain.Apps.Entities.Comments +namespace Squidex.Domain.Apps.Entities.Comments.DomainObject { public interface ICommentsGrain : IGrainWithStringKey { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/BackupContents.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/BackupContents.cs index f0c97bd1e..a3512a0fe 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/BackupContents.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/BackupContents.cs @@ -11,7 +11,7 @@ using System.Threading.Tasks; using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Entities.Backup; -using Squidex.Domain.Apps.Entities.Contents.State; +using Squidex.Domain.Apps.Entities.Contents.DomainObject; using Squidex.Domain.Apps.Events.Apps; using Squidex.Domain.Apps.Events.Contents; using Squidex.Domain.Apps.Events.Schemas; @@ -216,7 +216,7 @@ namespace Squidex.Domain.Apps.Entities.Contents if (ids.Any()) { - await rebuilder.InsertManyAsync(ids); + await rebuilder.InsertManyAsync(ids); } } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/BulkUpdateCommandMiddleware.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/BulkUpdateCommandMiddleware.cs index 673cf6c62..d141cb273 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/BulkUpdateCommandMiddleware.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/BulkUpdateCommandMiddleware.cs @@ -14,7 +14,6 @@ using Squidex.Domain.Apps.Entities.Schemas; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Reflection; -using Squidex.Infrastructure.Security; using Squidex.Infrastructure.Translations; using Squidex.Shared; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentCommandMiddleware.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/ContentCommandMiddleware.cs similarity index 96% rename from backend/src/Squidex.Domain.Apps.Entities/Contents/ContentCommandMiddleware.cs rename to backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/ContentCommandMiddleware.cs index d5d343745..1c74539d5 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentCommandMiddleware.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/ContentCommandMiddleware.cs @@ -12,7 +12,7 @@ using Squidex.Domain.Apps.Entities.Contents.Queries; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; -namespace Squidex.Domain.Apps.Entities.Contents +namespace Squidex.Domain.Apps.Entities.Contents.DomainObject { public sealed class ContentCommandMiddleware : GrainCommandMiddleware { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/ContentDomainObject.State.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/ContentDomainObject.State.cs new file mode 100644 index 000000000..1d3f28511 --- /dev/null +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/ContentDomainObject.State.cs @@ -0,0 +1,159 @@ +// ========================================================================== +// Squidex Headless CMS +// ========================================================================== +// Copyright (c) Squidex UG (haftungsbeschränkt) +// All rights reserved. Licensed under the MIT license. +// ========================================================================== + +using System.Runtime.Serialization; +using Squidex.Domain.Apps.Core.Contents; +using Squidex.Domain.Apps.Events.Contents; +using Squidex.Infrastructure; +using Squidex.Infrastructure.EventSourcing; +using Squidex.Infrastructure.Reflection; + +namespace Squidex.Domain.Apps.Entities.Contents.DomainObject +{ + public sealed partial class ContentDomainObject + { + public sealed class State : DomainObjectState, IContentEntity + { + public NamedId AppId { get; set; } + + public NamedId SchemaId { get; set; } + + public ContentVersion? NewVersion { get; set; } + + public ContentVersion CurrentVersion { get; set; } + + public ScheduleJob? ScheduleJob { get; set; } + + [IgnoreDataMember] + public DomainId UniqueId + { + get { return DomainId.Combine(AppId, Id); } + } + + [IgnoreDataMember] + public NamedContentData Data + { + get { return NewVersion?.Data ?? CurrentVersion.Data; } + } + + [IgnoreDataMember] + public Status EditingStatus + { + get { return NewStatus ?? Status; } + } + + [IgnoreDataMember] + public Status Status + { + get { return CurrentVersion.Status; } + } + + [IgnoreDataMember] + public Status? NewStatus + { + get { return NewVersion?.Status; } + } + + public override bool ApplyEvent(IEvent @event, EnvelopeHeaders headers) + { + switch (@event) + { + case ContentCreated e: + { + Id = e.ContentId; + + SimpleMapper.Map(e, this); + + CurrentVersion = new ContentVersion(e.Status, e.Data); + + break; + } + + case ContentDraftCreated e: + { + NewVersion = new ContentVersion(e.Status, e.MigratedData ?? CurrentVersion.Data); + + ScheduleJob = null; + + break; + } + + case ContentDraftDeleted _: + { + NewVersion = null; + + ScheduleJob = null; + + break; + } + + case ContentStatusChanged e: + { + ScheduleJob = null; + + if (NewVersion != null) + { + if (e.Status == Status.Published) + { + CurrentVersion = new ContentVersion(e.Status, NewVersion.Data); + + NewVersion = null; + } + else + { + NewVersion = NewVersion.WithStatus(e.Status); + } + } + else + { + CurrentVersion = CurrentVersion.WithStatus(e.Status); + } + + break; + } + + case ContentSchedulingCancelled _: + { + ScheduleJob = null; + + break; + } + + case ContentStatusScheduled e: + { + ScheduleJob = ScheduleJob.Build(e.Status, e.Actor, e.DueTime); + + break; + } + + case ContentUpdated e: + { + if (NewVersion != null) + { + NewVersion = NewVersion.WithData(e.Data); + } + else + { + CurrentVersion = CurrentVersion.WithData(e.Data); + } + + break; + } + + case ContentDeleted _: + { + IsDeleted = true; + + break; + } + } + + return true; + } + } + } +} diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentDomainObject.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/ContentDomainObject.cs similarity index 97% rename from backend/src/Squidex.Domain.Apps.Entities/Contents/ContentDomainObject.cs rename to backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/ContentDomainObject.cs index 25d49bb5c..5fd279f54 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentDomainObject.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/ContentDomainObject.cs @@ -6,15 +6,12 @@ // ========================================================================== using System; -using System.Linq; using System.Threading.Tasks; using NodaTime; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.Scripting; using Squidex.Domain.Apps.Entities.Contents.Commands; -using Squidex.Domain.Apps.Entities.Contents.Guards; -using Squidex.Domain.Apps.Entities.Contents.Operations; -using Squidex.Domain.Apps.Entities.Contents.State; +using Squidex.Domain.Apps.Entities.Contents.DomainObject.Guards; using Squidex.Domain.Apps.Events; using Squidex.Domain.Apps.Events.Contents; using Squidex.Infrastructure; @@ -24,9 +21,9 @@ using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.States; using Squidex.Log; -namespace Squidex.Domain.Apps.Entities.Contents +namespace Squidex.Domain.Apps.Entities.Contents.DomainObject { - public class ContentDomainObject : LogSnapshotDomainObject + public sealed partial class ContentDomainObject : LogSnapshotDomainObject { private readonly ContentOperationContext context; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentDomainObjectGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/ContentDomainObjectGrain.cs similarity index 87% rename from backend/src/Squidex.Domain.Apps.Entities/Contents/ContentDomainObjectGrain.cs rename to backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/ContentDomainObjectGrain.cs index af3ee8651..8881522a4 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentDomainObjectGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/ContentDomainObjectGrain.cs @@ -7,13 +7,12 @@ using System; using System.Threading.Tasks; -using Squidex.Domain.Apps.Entities.Contents.State; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Orleans; -namespace Squidex.Domain.Apps.Entities.Contents +namespace Squidex.Domain.Apps.Entities.Contents.DomainObject { - public sealed class ContentDomainObjectGrain : DomainObjectGrain, IContentGrain + public sealed class ContentDomainObjectGrain : DomainObjectGrain, IContentGrain { private static readonly TimeSpan Lifetime = TimeSpan.FromMinutes(5); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Operations/ContentOperationContext.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/ContentOperationContext.cs similarity index 99% rename from backend/src/Squidex.Domain.Apps.Entities/Contents/Operations/ContentOperationContext.cs rename to backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/ContentOperationContext.cs index 452e786fb..9f488d048 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Operations/ContentOperationContext.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/ContentOperationContext.cs @@ -23,7 +23,7 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Validation; using Squidex.Log; -namespace Squidex.Domain.Apps.Entities.Contents.Operations +namespace Squidex.Domain.Apps.Entities.Contents.DomainObject { public sealed class ContentOperationContext { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/State/ContentVersion.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/ContentVersion.cs similarity index 94% rename from backend/src/Squidex.Domain.Apps.Entities/Contents/State/ContentVersion.cs rename to backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/ContentVersion.cs index f0955a28e..3a7f3e0c9 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/State/ContentVersion.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/ContentVersion.cs @@ -8,7 +8,7 @@ using Squidex.Domain.Apps.Core.Contents; using Squidex.Infrastructure; -namespace Squidex.Domain.Apps.Entities.Contents.State +namespace Squidex.Domain.Apps.Entities.Contents.DomainObject { public sealed class ContentVersion { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Guards/GuardContent.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/Guards/GuardContent.cs similarity index 98% rename from backend/src/Squidex.Domain.Apps.Entities/Contents/Guards/GuardContent.cs rename to backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/Guards/GuardContent.cs index 411422417..b160876b3 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Guards/GuardContent.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/Guards/GuardContent.cs @@ -16,7 +16,7 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Translations; using Squidex.Infrastructure.Validation; -namespace Squidex.Domain.Apps.Entities.Contents.Guards +namespace Squidex.Domain.Apps.Entities.Contents.DomainObject.Guards { public static class GuardContent { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/IContentGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/IContentGrain.cs similarity index 91% rename from backend/src/Squidex.Domain.Apps.Entities/Contents/IContentGrain.cs rename to backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/IContentGrain.cs index 429a27746..0fc20049d 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/IContentGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/DomainObject/IContentGrain.cs @@ -10,7 +10,7 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Orleans; -namespace Squidex.Domain.Apps.Entities.Contents +namespace Squidex.Domain.Apps.Entities.Contents.DomainObject { public interface IContentGrain : IDomainObjectGrain { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/IContentQueryService.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/IContentQueryService.cs index d488707b2..5bc49bff4 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/IContentQueryService.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/IContentQueryService.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using System.Collections.Generic; using System.Threading.Tasks; using Squidex.Domain.Apps.Entities.Schemas; using Squidex.Infrastructure; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentLoader.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentLoader.cs index 47cd9664c..d9370d53d 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentLoader.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentLoader.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using Orleans; +using Squidex.Domain.Apps.Entities.Contents.DomainObject; using Squidex.Infrastructure; using Squidex.Log; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/State/ContentState.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/State/ContentState.cs deleted file mode 100644 index 884c7ca62..000000000 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/State/ContentState.cs +++ /dev/null @@ -1,156 +0,0 @@ -// ========================================================================== -// Squidex Headless CMS -// ========================================================================== -// Copyright (c) Squidex UG (haftungsbeschränkt) -// All rights reserved. Licensed under the MIT license. -// ========================================================================== - -using System.Runtime.Serialization; -using Squidex.Domain.Apps.Core.Contents; -using Squidex.Domain.Apps.Events.Contents; -using Squidex.Infrastructure; -using Squidex.Infrastructure.EventSourcing; -using Squidex.Infrastructure.Reflection; - -namespace Squidex.Domain.Apps.Entities.Contents.State -{ - public sealed class ContentState : DomainObjectState, IContentEntity - { - public NamedId AppId { get; set; } - - public NamedId SchemaId { get; set; } - - public ContentVersion? NewVersion { get; set; } - - public ContentVersion CurrentVersion { get; set; } - - public ScheduleJob? ScheduleJob { get; set; } - - [IgnoreDataMember] - public DomainId UniqueId - { - get { return DomainId.Combine(AppId, Id); } - } - - [IgnoreDataMember] - public NamedContentData Data - { - get { return NewVersion?.Data ?? CurrentVersion.Data; } - } - - [IgnoreDataMember] - public Status EditingStatus - { - get { return NewStatus ?? Status; } - } - - [IgnoreDataMember] - public Status Status - { - get { return CurrentVersion.Status; } - } - - [IgnoreDataMember] - public Status? NewStatus - { - get { return NewVersion?.Status; } - } - - public override bool ApplyEvent(IEvent @event, EnvelopeHeaders headers) - { - switch (@event) - { - case ContentCreated e: - { - Id = e.ContentId; - - SimpleMapper.Map(e, this); - - CurrentVersion = new ContentVersion(e.Status, e.Data); - - break; - } - - case ContentDraftCreated e: - { - NewVersion = new ContentVersion(e.Status, e.MigratedData ?? CurrentVersion.Data); - - ScheduleJob = null; - - break; - } - - case ContentDraftDeleted _: - { - NewVersion = null; - - ScheduleJob = null; - - break; - } - - case ContentStatusChanged e: - { - ScheduleJob = null; - - if (NewVersion != null) - { - if (e.Status == Status.Published) - { - CurrentVersion = new ContentVersion(e.Status, NewVersion.Data); - - NewVersion = null; - } - else - { - NewVersion = NewVersion.WithStatus(e.Status); - } - } - else - { - CurrentVersion = CurrentVersion.WithStatus(e.Status); - } - - break; - } - - case ContentSchedulingCancelled _: - { - ScheduleJob = null; - - break; - } - - case ContentStatusScheduled e: - { - ScheduleJob = ScheduleJob.Build(e.Status, e.Actor, e.DueTime); - - break; - } - - case ContentUpdated e: - { - if (NewVersion != null) - { - NewVersion = NewVersion.WithData(e.Data); - } - else - { - CurrentVersion = CurrentVersion.WithData(e.Data); - } - - break; - } - - case ContentDeleted _: - { - IsDeleted = true; - - break; - } - } - - return true; - } - } -} diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/Guards/GuardRule.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/DomainObject/Guards/GuardRule.cs similarity index 97% rename from backend/src/Squidex.Domain.Apps.Entities/Rules/Guards/GuardRule.cs rename to backend/src/Squidex.Domain.Apps.Entities/Rules/DomainObject/Guards/GuardRule.cs index 64e8f2f54..e48edd9f9 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Rules/Guards/GuardRule.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Rules/DomainObject/Guards/GuardRule.cs @@ -10,7 +10,7 @@ using Squidex.Domain.Apps.Entities.Rules.Commands; using Squidex.Infrastructure; using Squidex.Infrastructure.Validation; -namespace Squidex.Domain.Apps.Entities.Rules.Guards +namespace Squidex.Domain.Apps.Entities.Rules.DomainObject.Guards { public static class GuardRule { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/Guards/RuleTriggerValidator.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/DomainObject/Guards/RuleTriggerValidator.cs similarity index 98% rename from backend/src/Squidex.Domain.Apps.Entities/Rules/Guards/RuleTriggerValidator.cs rename to backend/src/Squidex.Domain.Apps.Entities/Rules/DomainObject/Guards/RuleTriggerValidator.cs index 904032e31..842e33a56 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Rules/Guards/RuleTriggerValidator.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Rules/DomainObject/Guards/RuleTriggerValidator.cs @@ -16,7 +16,7 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Translations; using Squidex.Infrastructure.Validation; -namespace Squidex.Domain.Apps.Entities.Rules.Guards +namespace Squidex.Domain.Apps.Entities.Rules.DomainObject.Guards { public sealed class RuleTriggerValidator : IRuleTriggerVisitor>> { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/IRuleGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/DomainObject/IRuleGrain.cs similarity index 91% rename from backend/src/Squidex.Domain.Apps.Entities/Rules/IRuleGrain.cs rename to backend/src/Squidex.Domain.Apps.Entities/Rules/DomainObject/IRuleGrain.cs index 4ba5432c2..28bea32f5 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Rules/IRuleGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Rules/DomainObject/IRuleGrain.cs @@ -9,7 +9,7 @@ using System.Threading.Tasks; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Orleans; -namespace Squidex.Domain.Apps.Entities.Rules +namespace Squidex.Domain.Apps.Entities.Rules.DomainObject { public interface IRuleGrain : IDomainObjectGrain { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/DomainObject/RuleDomainObject.State.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/DomainObject/RuleDomainObject.State.cs new file mode 100644 index 000000000..c745dfc01 --- /dev/null +++ b/backend/src/Squidex.Domain.Apps.Entities/Rules/DomainObject/RuleDomainObject.State.cs @@ -0,0 +1,96 @@ +// ========================================================================== +// Squidex Headless CMS +// ========================================================================== +// Copyright (c) Squidex UG (haftungsbeschränkt) +// All rights reserved. Licensed under the MIT license. +// ========================================================================== + +using System.Runtime.Serialization; +using Squidex.Domain.Apps.Core.Rules; +using Squidex.Domain.Apps.Events.Rules; +using Squidex.Infrastructure; +using Squidex.Infrastructure.EventSourcing; +using Squidex.Infrastructure.States; + +namespace Squidex.Domain.Apps.Entities.Rules.DomainObject +{ + public sealed partial class RuleDomainObject + { + [CollectionName("Rules")] + public sealed class State : DomainObjectState, IRuleEntity + { + public NamedId AppId { get; set; } + + public Rule RuleDef { get; set; } + + [IgnoreDataMember] + public DomainId UniqueId + { + get { return DomainId.Combine(AppId, Id); } + } + + public override bool ApplyEvent(IEvent @event) + { + var previousRule = RuleDef; + + switch (@event) + { + case RuleCreated e: + { + Id = e.RuleId; + + RuleDef = new Rule(e.Trigger, e.Action); + RuleDef = RuleDef.Rename(e.Name); + + AppId = e.AppId; + + return true; + } + + case RuleUpdated e: + { + if (e.Trigger != null) + { + RuleDef = RuleDef.Update(e.Trigger); + } + + if (e.Action != null) + { + RuleDef = RuleDef.Update(e.Action); + } + + if (e.Name != null) + { + RuleDef = RuleDef.Rename(e.Name); + } + + break; + } + + case RuleEnabled _: + { + RuleDef = RuleDef.Enable(); + + break; + } + + case RuleDisabled _: + { + RuleDef = RuleDef.Disable(); + + break; + } + + case RuleDeleted _: + { + IsDeleted = true; + + return true; + } + } + + return !ReferenceEquals(previousRule, RuleDef); + } + } + } +} diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleDomainObject.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/DomainObject/RuleDomainObject.cs similarity index 95% rename from backend/src/Squidex.Domain.Apps.Entities/Rules/RuleDomainObject.cs rename to backend/src/Squidex.Domain.Apps.Entities/Rules/DomainObject/RuleDomainObject.cs index 6a5f76722..88992f6d7 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleDomainObject.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Rules/DomainObject/RuleDomainObject.cs @@ -8,8 +8,7 @@ using System; using System.Threading.Tasks; using Squidex.Domain.Apps.Entities.Rules.Commands; -using Squidex.Domain.Apps.Entities.Rules.Guards; -using Squidex.Domain.Apps.Entities.Rules.State; +using Squidex.Domain.Apps.Entities.Rules.DomainObject.Guards; using Squidex.Domain.Apps.Events; using Squidex.Domain.Apps.Events.Rules; using Squidex.Infrastructure; @@ -19,9 +18,9 @@ using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.States; using Squidex.Log; -namespace Squidex.Domain.Apps.Entities.Rules +namespace Squidex.Domain.Apps.Entities.Rules.DomainObject { - public class RuleDomainObject : DomainObject + public sealed partial class RuleDomainObject : DomainObject { private readonly IAppProvider appProvider; private readonly IRuleEnqueuer ruleEnqueuer; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleDomainObjectGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/DomainObject/RuleDomainObjectGrain.cs similarity index 86% rename from backend/src/Squidex.Domain.Apps.Entities/Rules/RuleDomainObjectGrain.cs rename to backend/src/Squidex.Domain.Apps.Entities/Rules/DomainObject/RuleDomainObjectGrain.cs index e542628a0..b62c34edc 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleDomainObjectGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Rules/DomainObject/RuleDomainObjectGrain.cs @@ -7,13 +7,12 @@ using System; using System.Threading.Tasks; -using Squidex.Domain.Apps.Entities.Rules.State; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Orleans; -namespace Squidex.Domain.Apps.Entities.Rules +namespace Squidex.Domain.Apps.Entities.Rules.DomainObject { - public sealed class RuleDomainObjectGrain : DomainObjectGrain, IRuleGrain + public sealed class RuleDomainObjectGrain : DomainObjectGrain, IRuleGrain { public RuleDomainObjectGrain(IServiceProvider serviceProvider) : base(serviceProvider) diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/Indexes/RulesIndex.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/Indexes/RulesIndex.cs index 7bae563e1..2f0d40fd9 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Rules/Indexes/RulesIndex.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Rules/Indexes/RulesIndex.cs @@ -10,6 +10,7 @@ using System.Linq; using System.Threading.Tasks; using Orleans; using Squidex.Domain.Apps.Entities.Rules.Commands; +using Squidex.Domain.Apps.Entities.Rules.DomainObject; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Log; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleCommandMiddleware.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleCommandMiddleware.cs index 4c8541c15..4b917fb1c 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleCommandMiddleware.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleCommandMiddleware.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using Orleans; using Squidex.Domain.Apps.Entities.Rules.Commands; +using Squidex.Domain.Apps.Entities.Rules.DomainObject; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/State/RuleState.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/State/RuleState.cs deleted file mode 100644 index ce9cf43e8..000000000 --- a/backend/src/Squidex.Domain.Apps.Entities/Rules/State/RuleState.cs +++ /dev/null @@ -1,93 +0,0 @@ -// ========================================================================== -// Squidex Headless CMS -// ========================================================================== -// Copyright (c) Squidex UG (haftungsbeschränkt) -// All rights reserved. Licensed under the MIT license. -// ========================================================================== - -using System.Runtime.Serialization; -using Squidex.Domain.Apps.Core.Rules; -using Squidex.Domain.Apps.Events.Rules; -using Squidex.Infrastructure; -using Squidex.Infrastructure.EventSourcing; -using Squidex.Infrastructure.States; - -namespace Squidex.Domain.Apps.Entities.Rules.State -{ - [CollectionName("Rules")] - public sealed class RuleState : DomainObjectState, IRuleEntity - { - public NamedId AppId { get; set; } - - public Rule RuleDef { get; set; } - - [IgnoreDataMember] - public DomainId UniqueId - { - get { return DomainId.Combine(AppId, Id); } - } - - public override bool ApplyEvent(IEvent @event) - { - var previousRule = RuleDef; - - switch (@event) - { - case RuleCreated e: - { - Id = e.RuleId; - - RuleDef = new Rule(e.Trigger, e.Action); - RuleDef = RuleDef.Rename(e.Name); - - AppId = e.AppId; - - return true; - } - - case RuleUpdated e: - { - if (e.Trigger != null) - { - RuleDef = RuleDef.Update(e.Trigger); - } - - if (e.Action != null) - { - RuleDef = RuleDef.Update(e.Action); - } - - if (e.Name != null) - { - RuleDef = RuleDef.Rename(e.Name); - } - - break; - } - - case RuleEnabled _: - { - RuleDef = RuleDef.Enable(); - - break; - } - - case RuleDisabled _: - { - RuleDef = RuleDef.Disable(); - - break; - } - - case RuleDeleted _: - { - IsDeleted = true; - - return true; - } - } - - return !ReferenceEquals(previousRule, RuleDef); - } - } -} diff --git a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Guards/FieldPropertiesValidator.cs b/backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/Guards/FieldPropertiesValidator.cs similarity index 99% rename from backend/src/Squidex.Domain.Apps.Entities/Schemas/Guards/FieldPropertiesValidator.cs rename to backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/Guards/FieldPropertiesValidator.cs index 4b8328ba1..6e215d20f 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Guards/FieldPropertiesValidator.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/Guards/FieldPropertiesValidator.cs @@ -12,7 +12,7 @@ using Squidex.Domain.Apps.Core.Schemas; using Squidex.Infrastructure.Translations; using Squidex.Infrastructure.Validation; -namespace Squidex.Domain.Apps.Entities.Schemas.Guards +namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards { public sealed class FieldPropertiesValidator : IFieldPropertiesVisitor> { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardHelper.cs b/backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/Guards/GuardHelper.cs similarity index 96% rename from backend/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardHelper.cs rename to backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/Guards/GuardHelper.cs index 1073fbf20..e57228ce6 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardHelper.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/Guards/GuardHelper.cs @@ -9,7 +9,7 @@ using Squidex.Domain.Apps.Core.Schemas; using Squidex.Infrastructure; using Squidex.Infrastructure.Translations; -namespace Squidex.Domain.Apps.Entities.Schemas.Guards +namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards { public static class GuardHelper { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchema.cs b/backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/Guards/GuardSchema.cs similarity index 99% rename from backend/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchema.cs rename to backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/Guards/GuardSchema.cs index 945242bc0..f83a2a6d7 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchema.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/Guards/GuardSchema.cs @@ -16,7 +16,7 @@ using Squidex.Infrastructure.Translations; using Squidex.Infrastructure.Validation; using Squidex.Text; -namespace Squidex.Domain.Apps.Entities.Schemas.Guards +namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards { public static class GuardSchema { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchemaField.cs b/backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/Guards/GuardSchemaField.cs similarity index 98% rename from backend/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchemaField.cs rename to backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/Guards/GuardSchemaField.cs index c307c7651..01049dbe7 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchemaField.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/Guards/GuardSchemaField.cs @@ -12,7 +12,7 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Translations; using Squidex.Infrastructure.Validation; -namespace Squidex.Domain.Apps.Entities.Schemas.Guards +namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards { public static class GuardSchemaField { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Schemas/ISchemaGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/ISchemaGrain.cs similarity index 90% rename from backend/src/Squidex.Domain.Apps.Entities/Schemas/ISchemaGrain.cs rename to backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/ISchemaGrain.cs index ab41ae13e..96da03161 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Schemas/ISchemaGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/ISchemaGrain.cs @@ -9,7 +9,7 @@ using System.Threading.Tasks; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Orleans; -namespace Squidex.Domain.Apps.Entities.Schemas +namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject { public interface ISchemaGrain : IDomainObjectGrain { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/SchemaDomainObject.State.cs b/backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/SchemaDomainObject.State.cs new file mode 100644 index 000000000..663689318 --- /dev/null +++ b/backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/SchemaDomainObject.State.cs @@ -0,0 +1,210 @@ +// ========================================================================== +// Squidex Headless CMS +// ========================================================================== +// Copyright (c) Squidex UG (haftungsbeschränkt) +// All rights reserved. Licensed under the MIT license. +// ========================================================================== + +using System; +using System.Linq; +using System.Runtime.Serialization; +using Squidex.Domain.Apps.Core; +using Squidex.Domain.Apps.Core.Schemas; +using Squidex.Domain.Apps.Events.Schemas; +using Squidex.Infrastructure; +using Squidex.Infrastructure.EventSourcing; +using Squidex.Infrastructure.States; + +namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject +{ + public sealed partial class SchemaDomainObject + { + [CollectionName("Schemas")] + public sealed class State : DomainObjectState, ISchemaEntity + { + public NamedId AppId { get; set; } + + public Schema SchemaDef { get; set; } + + public long SchemaFieldsTotal { get; set; } + + [IgnoreDataMember] + public DomainId UniqueId + { + get { return DomainId.Combine(AppId, Id); } + } + + public override bool ApplyEvent(IEvent @event) + { + var previousSchema = SchemaDef; + + switch (@event) + { + case SchemaCreated e: + { + Id = e.SchemaId.Id; + + SchemaDef = e.Schema; + SchemaFieldsTotal = e.Schema.MaxId(); + + AppId = e.AppId; + + return true; + } + + case FieldAdded e: + { + if (e.ParentFieldId != null) + { + var field = e.Properties.CreateNestedField(e.FieldId.Id, e.Name); + + SchemaDef = SchemaDef.UpdateField(e.ParentFieldId.Id, x => ((ArrayField)x).AddField(field)); + } + else + { + var partitioning = Partitioning.FromString(e.Partitioning); + + var field = e.Properties.CreateRootField(e.FieldId.Id, e.Name, partitioning); + + SchemaDef = SchemaDef.DeleteField(e.FieldId.Id); + SchemaDef = SchemaDef.AddField(field); + } + + SchemaFieldsTotal = Math.Max(SchemaFieldsTotal, e.FieldId.Id); + + break; + } + + case SchemaUIFieldsConfigured e: + { + if (e.FieldsInLists != null) + { + SchemaDef = SchemaDef.SetFieldsInLists(e.FieldsInLists); + } + + if (e.FieldsInReferences != null) + { + SchemaDef = SchemaDef.SetFieldsInReferences(e.FieldsInReferences); + } + + break; + } + + case SchemaCategoryChanged e: + { + SchemaDef = SchemaDef.ChangeCategory(e.Name); + + break; + } + + case SchemaPreviewUrlsConfigured e: + { + SchemaDef = SchemaDef.SetPreviewUrls(e.PreviewUrls); + + break; + } + + case SchemaScriptsConfigured e: + { + SchemaDef = SchemaDef.SetScripts(e.Scripts); + + break; + } + + case SchemaFieldRulesConfigured e: + { + SchemaDef = SchemaDef.SetFieldRules(e.FieldRules); + + break; + } + + case SchemaPublished _: + { + SchemaDef = SchemaDef.Publish(); + + break; + } + + case SchemaUnpublished _: + { + SchemaDef = SchemaDef.Unpublish(); + + break; + } + + case SchemaUpdated e: + { + SchemaDef = SchemaDef.Update(e.Properties); + + break; + } + + case SchemaFieldsReordered e: + { + SchemaDef = SchemaDef.ReorderFields(e.FieldIds.ToList(), e.ParentFieldId?.Id); + + break; + } + + case FieldUpdated e: + { + SchemaDef = SchemaDef.UpdateField(e.FieldId.Id, e.Properties, e.ParentFieldId?.Id); + + break; + } + + case FieldLocked e: + { + SchemaDef = SchemaDef.LockField(e.FieldId.Id, e.ParentFieldId?.Id); + + break; + } + + case FieldDisabled e: + { + SchemaDef = SchemaDef.DisableField(e.FieldId.Id, e.ParentFieldId?.Id); + + break; + } + + case FieldEnabled e: + { + SchemaDef = SchemaDef.EnableField(e.FieldId.Id, e.ParentFieldId?.Id); + + break; + } + + case FieldHidden e: + { + SchemaDef = SchemaDef.HideField(e.FieldId.Id, e.ParentFieldId?.Id); + + break; + } + + case FieldShown e: + { + SchemaDef = SchemaDef.ShowField(e.FieldId.Id, e.ParentFieldId?.Id); + + break; + } + + case FieldDeleted e: + { + SchemaDef = SchemaDef.DeleteField(e.FieldId.Id, e.ParentFieldId?.Id); + + break; + } + + case SchemaDeleted _: + { + IsDeleted = true; + + return true; + } + } + + return !ReferenceEquals(previousSchema, SchemaDef); + } + } + } +} diff --git a/backend/src/Squidex.Domain.Apps.Entities/Schemas/SchemaDomainObject.cs b/backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/SchemaDomainObject.cs similarity index 98% rename from backend/src/Squidex.Domain.Apps.Entities/Schemas/SchemaDomainObject.cs rename to backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/SchemaDomainObject.cs index 46e033ada..80e9f283b 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Schemas/SchemaDomainObject.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/SchemaDomainObject.cs @@ -10,8 +10,7 @@ using System.Threading.Tasks; using Squidex.Domain.Apps.Core.EventSynchronization; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Entities.Schemas.Commands; -using Squidex.Domain.Apps.Entities.Schemas.Guards; -using Squidex.Domain.Apps.Entities.Schemas.State; +using Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards; using Squidex.Domain.Apps.Events; using Squidex.Domain.Apps.Events.Schemas; using Squidex.Infrastructure; @@ -22,9 +21,9 @@ using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.States; using Squidex.Log; -namespace Squidex.Domain.Apps.Entities.Schemas +namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject { - public class SchemaDomainObject : DomainObject + public sealed partial class SchemaDomainObject : DomainObject { public SchemaDomainObject(IStore store, ISemanticLog log) : base(store, log) diff --git a/backend/src/Squidex.Domain.Apps.Entities/Schemas/SchemaDomainObjectGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/SchemaDomainObjectGrain.cs similarity index 85% rename from backend/src/Squidex.Domain.Apps.Entities/Schemas/SchemaDomainObjectGrain.cs rename to backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/SchemaDomainObjectGrain.cs index 3f2762bb7..0163d02d6 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Schemas/SchemaDomainObjectGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Schemas/DomainObject/SchemaDomainObjectGrain.cs @@ -7,13 +7,12 @@ using System; using System.Threading.Tasks; -using Squidex.Domain.Apps.Entities.Schemas.State; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Orleans; -namespace Squidex.Domain.Apps.Entities.Schemas +namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject { - public sealed class SchemaDomainObjectGrain : DomainObjectGrain, ISchemaGrain + public sealed class SchemaDomainObjectGrain : DomainObjectGrain, ISchemaGrain { public SchemaDomainObjectGrain(IServiceProvider serviceProvider) : base(serviceProvider) diff --git a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Indexes/SchemasIndex.cs b/backend/src/Squidex.Domain.Apps.Entities/Schemas/Indexes/SchemasIndex.cs index a6b5b1545..81be73024 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Indexes/SchemasIndex.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Schemas/Indexes/SchemasIndex.cs @@ -12,6 +12,7 @@ using System.Threading.Tasks; using Orleans; using Squidex.Caching; using Squidex.Domain.Apps.Entities.Schemas.Commands; +using Squidex.Domain.Apps.Entities.Schemas.DomainObject; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Translations; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Schemas/State/SchemaState.cs b/backend/src/Squidex.Domain.Apps.Entities/Schemas/State/SchemaState.cs deleted file mode 100644 index 902dd9e8a..000000000 --- a/backend/src/Squidex.Domain.Apps.Entities/Schemas/State/SchemaState.cs +++ /dev/null @@ -1,207 +0,0 @@ -// ========================================================================== -// Squidex Headless CMS -// ========================================================================== -// Copyright (c) Squidex UG (haftungsbeschränkt) -// All rights reserved. Licensed under the MIT license. -// ========================================================================== - -using System; -using System.Linq; -using System.Runtime.Serialization; -using Squidex.Domain.Apps.Core; -using Squidex.Domain.Apps.Core.Schemas; -using Squidex.Domain.Apps.Events.Schemas; -using Squidex.Infrastructure; -using Squidex.Infrastructure.EventSourcing; -using Squidex.Infrastructure.States; - -namespace Squidex.Domain.Apps.Entities.Schemas.State -{ - [CollectionName("Schemas")] - public sealed class SchemaState : DomainObjectState, ISchemaEntity - { - public NamedId AppId { get; set; } - - public Schema SchemaDef { get; set; } - - public long SchemaFieldsTotal { get; set; } - - [IgnoreDataMember] - public DomainId UniqueId - { - get { return DomainId.Combine(AppId, Id); } - } - - public override bool ApplyEvent(IEvent @event) - { - var previousSchema = SchemaDef; - - switch (@event) - { - case SchemaCreated e: - { - Id = e.SchemaId.Id; - - SchemaDef = e.Schema; - SchemaFieldsTotal = e.Schema.MaxId(); - - AppId = e.AppId; - - return true; - } - - case FieldAdded e: - { - if (e.ParentFieldId != null) - { - var field = e.Properties.CreateNestedField(e.FieldId.Id, e.Name); - - SchemaDef = SchemaDef.UpdateField(e.ParentFieldId.Id, x => ((ArrayField)x).AddField(field)); - } - else - { - var partitioning = Partitioning.FromString(e.Partitioning); - - var field = e.Properties.CreateRootField(e.FieldId.Id, e.Name, partitioning); - - SchemaDef = SchemaDef.DeleteField(e.FieldId.Id); - SchemaDef = SchemaDef.AddField(field); - } - - SchemaFieldsTotal = Math.Max(SchemaFieldsTotal, e.FieldId.Id); - - break; - } - - case SchemaUIFieldsConfigured e: - { - if (e.FieldsInLists != null) - { - SchemaDef = SchemaDef.SetFieldsInLists(e.FieldsInLists); - } - - if (e.FieldsInReferences != null) - { - SchemaDef = SchemaDef.SetFieldsInReferences(e.FieldsInReferences); - } - - break; - } - - case SchemaCategoryChanged e: - { - SchemaDef = SchemaDef.ChangeCategory(e.Name); - - break; - } - - case SchemaPreviewUrlsConfigured e: - { - SchemaDef = SchemaDef.SetPreviewUrls(e.PreviewUrls); - - break; - } - - case SchemaScriptsConfigured e: - { - SchemaDef = SchemaDef.SetScripts(e.Scripts); - - break; - } - - case SchemaFieldRulesConfigured e: - { - SchemaDef = SchemaDef.SetFieldRules(e.FieldRules); - - break; - } - - case SchemaPublished _: - { - SchemaDef = SchemaDef.Publish(); - - break; - } - - case SchemaUnpublished _: - { - SchemaDef = SchemaDef.Unpublish(); - - break; - } - - case SchemaUpdated e: - { - SchemaDef = SchemaDef.Update(e.Properties); - - break; - } - - case SchemaFieldsReordered e: - { - SchemaDef = SchemaDef.ReorderFields(e.FieldIds.ToList(), e.ParentFieldId?.Id); - - break; - } - - case FieldUpdated e: - { - SchemaDef = SchemaDef.UpdateField(e.FieldId.Id, e.Properties, e.ParentFieldId?.Id); - - break; - } - - case FieldLocked e: - { - SchemaDef = SchemaDef.LockField(e.FieldId.Id, e.ParentFieldId?.Id); - - break; - } - - case FieldDisabled e: - { - SchemaDef = SchemaDef.DisableField(e.FieldId.Id, e.ParentFieldId?.Id); - - break; - } - - case FieldEnabled e: - { - SchemaDef = SchemaDef.EnableField(e.FieldId.Id, e.ParentFieldId?.Id); - - break; - } - - case FieldHidden e: - { - SchemaDef = SchemaDef.HideField(e.FieldId.Id, e.ParentFieldId?.Id); - - break; - } - - case FieldShown e: - { - SchemaDef = SchemaDef.ShowField(e.FieldId.Id, e.ParentFieldId?.Id); - - break; - } - - case FieldDeleted e: - { - SchemaDef = SchemaDef.DeleteField(e.FieldId.Id, e.ParentFieldId?.Id); - - break; - } - - case SchemaDeleted _: - { - IsDeleted = true; - - return true; - } - } - - return !ReferenceEquals(previousSchema, SchemaDef); - } - } -} diff --git a/backend/src/Squidex/Config/Domain/AppsServices.cs b/backend/src/Squidex/Config/Domain/AppsServices.cs index 0f15f2582..c22cfe991 100644 --- a/backend/src/Squidex/Config/Domain/AppsServices.cs +++ b/backend/src/Squidex/Config/Domain/AppsServices.cs @@ -11,6 +11,7 @@ using Squidex.Areas.Api.Controllers.UI; using Squidex.Domain.Apps.Core.Apps; using Squidex.Domain.Apps.Entities; using Squidex.Domain.Apps.Entities.Apps; +using Squidex.Domain.Apps.Entities.Apps.DomainObject; using Squidex.Domain.Apps.Entities.History; using Squidex.Domain.Apps.Entities.Search; using Squidex.Infrastructure; diff --git a/backend/src/Squidex/Config/Domain/AssetServices.cs b/backend/src/Squidex/Config/Domain/AssetServices.cs index af9edcdae..8da5af9bc 100644 --- a/backend/src/Squidex/Config/Domain/AssetServices.cs +++ b/backend/src/Squidex/Config/Domain/AssetServices.cs @@ -15,6 +15,7 @@ using MongoDB.Driver.GridFS; using Squidex.Assets; using Squidex.Assets.ImageSharp; using Squidex.Domain.Apps.Entities.Assets; +using Squidex.Domain.Apps.Entities.Assets.DomainObject; using Squidex.Domain.Apps.Entities.Assets.Queries; using Squidex.Domain.Apps.Entities.History; using Squidex.Domain.Apps.Entities.Search; diff --git a/backend/src/Squidex/Config/Domain/CommandsServices.cs b/backend/src/Squidex/Config/Domain/CommandsServices.cs index 54fb16e2b..84cec98f4 100644 --- a/backend/src/Squidex/Config/Domain/CommandsServices.cs +++ b/backend/src/Squidex/Config/Domain/CommandsServices.cs @@ -7,19 +7,20 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Squidex.Domain.Apps.Entities.Apps; +using Squidex.Domain.Apps.Entities.Apps.DomainObject; using Squidex.Domain.Apps.Entities.Apps.Indexes; using Squidex.Domain.Apps.Entities.Apps.Invitation; using Squidex.Domain.Apps.Entities.Apps.Templates; -using Squidex.Domain.Apps.Entities.Assets; using Squidex.Domain.Apps.Entities.Assets.Commands; -using Squidex.Domain.Apps.Entities.Comments; +using Squidex.Domain.Apps.Entities.Assets.DomainObject; +using Squidex.Domain.Apps.Entities.Comments.DomainObject; using Squidex.Domain.Apps.Entities.Contents; +using Squidex.Domain.Apps.Entities.Contents.DomainObject; using Squidex.Domain.Apps.Entities.Rules; using Squidex.Domain.Apps.Entities.Rules.Indexes; using Squidex.Domain.Apps.Entities.Rules.UsageTracking; -using Squidex.Domain.Apps.Entities.Schemas; using Squidex.Domain.Apps.Entities.Schemas.Commands; +using Squidex.Domain.Apps.Entities.Schemas.DomainObject; using Squidex.Domain.Apps.Entities.Schemas.Indexes; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.EventSourcing; diff --git a/backend/src/Squidex/Config/Domain/ContentsServices.cs b/backend/src/Squidex/Config/Domain/ContentsServices.cs index c1e32be9f..7ae9d556c 100644 --- a/backend/src/Squidex/Config/Domain/ContentsServices.cs +++ b/backend/src/Squidex/Config/Domain/ContentsServices.cs @@ -10,7 +10,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Squidex.Domain.Apps.Core.ValidateContent; using Squidex.Domain.Apps.Entities.Contents; -using Squidex.Domain.Apps.Entities.Contents.Operations; +using Squidex.Domain.Apps.Entities.Contents.DomainObject; using Squidex.Domain.Apps.Entities.Contents.Queries; using Squidex.Domain.Apps.Entities.Contents.Queries.Steps; using Squidex.Domain.Apps.Entities.Contents.Text; diff --git a/backend/src/Squidex/Config/Domain/RuleServices.cs b/backend/src/Squidex/Config/Domain/RuleServices.cs index 120d8653f..b8b79d60b 100644 --- a/backend/src/Squidex/Config/Domain/RuleServices.cs +++ b/backend/src/Squidex/Config/Domain/RuleServices.cs @@ -15,6 +15,7 @@ using Squidex.Domain.Apps.Entities.Assets; using Squidex.Domain.Apps.Entities.Comments; using Squidex.Domain.Apps.Entities.Contents; using Squidex.Domain.Apps.Entities.Rules; +using Squidex.Domain.Apps.Entities.Rules.DomainObject; using Squidex.Domain.Apps.Entities.Rules.Queries; using Squidex.Domain.Apps.Entities.Rules.Runner; using Squidex.Domain.Apps.Entities.Rules.UsageTracking; diff --git a/backend/src/Squidex/Config/Domain/SchemasServices.cs b/backend/src/Squidex/Config/Domain/SchemasServices.cs index 740197e93..48fc6289c 100644 --- a/backend/src/Squidex/Config/Domain/SchemasServices.cs +++ b/backend/src/Squidex/Config/Domain/SchemasServices.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.DependencyInjection; using Squidex.Domain.Apps.Entities.History; using Squidex.Domain.Apps.Entities.Schemas; +using Squidex.Domain.Apps.Entities.Schemas.DomainObject; using Squidex.Domain.Apps.Entities.Search; namespace Squidex.Config.Domain diff --git a/backend/src/Squidex/Config/Domain/StoreServices.cs b/backend/src/Squidex/Config/Domain/StoreServices.cs index ac989f42f..793398b3e 100644 --- a/backend/src/Squidex/Config/Domain/StoreServices.cs +++ b/backend/src/Squidex/Config/Domain/StoreServices.cs @@ -13,10 +13,10 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Migrations.Migrations.MongoDb; using MongoDB.Driver; +using Squidex.Domain.Apps.Entities.Assets.DomainObject; using Squidex.Domain.Apps.Entities.Assets.Repositories; -using Squidex.Domain.Apps.Entities.Assets.State; +using Squidex.Domain.Apps.Entities.Contents.DomainObject; using Squidex.Domain.Apps.Entities.Contents.Repositories; -using Squidex.Domain.Apps.Entities.Contents.State; using Squidex.Domain.Apps.Entities.Contents.Text; using Squidex.Domain.Apps.Entities.Contents.Text.State; using Squidex.Domain.Apps.Entities.History.Repositories; @@ -107,13 +107,13 @@ namespace Squidex.Config.Domain .As>().As(); services.AddSingletonAs() - .As().As>(); + .As().As>(); services.AddSingletonAs() - .As().As>(); + .As().As>(); services.AddSingletonAs(c => ActivatorUtilities.CreateInstance(c, GetDatabase(c, mongoContentDatabaseName))) - .As().As>(); + .As().As>(); services.AddSingletonAs() .AsOptional(); diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppCommandMiddlewareTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/AppCommandMiddlewareTests.cs similarity index 97% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppCommandMiddlewareTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/AppCommandMiddlewareTests.cs index 68909cabe..7e2f678ee 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/AppCommandMiddlewareTests.cs @@ -12,16 +12,15 @@ using FakeItEasy; using Orleans; using Squidex.Assets; using Squidex.Domain.Apps.Entities.Apps.Commands; -using Squidex.Domain.Apps.Entities.Apps.State; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Validation; using Xunit; -namespace Squidex.Domain.Apps.Entities.Apps +namespace Squidex.Domain.Apps.Entities.Apps.DomainObject { - public class AppCommandMiddlewareTests : HandlerTestBase + public class AppCommandMiddlewareTests : HandlerTestBase { private readonly IContextProvider contextProvider = A.Fake(); private readonly IAppImageStore appImageStore = A.Fake(); diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppDomainObjectTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/AppDomainObjectTests.cs similarity index 99% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppDomainObjectTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/AppDomainObjectTests.cs index c4581a711..5bbb5b715 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppDomainObjectTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/AppDomainObjectTests.cs @@ -12,7 +12,6 @@ using Squidex.Domain.Apps.Core.Apps; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Entities.Apps.Commands; using Squidex.Domain.Apps.Entities.Apps.Plans; -using Squidex.Domain.Apps.Entities.Apps.State; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Domain.Apps.Events.Apps; using Squidex.Infrastructure; @@ -22,9 +21,9 @@ using Squidex.Log; using Squidex.Shared.Users; using Xunit; -namespace Squidex.Domain.Apps.Entities.Apps +namespace Squidex.Domain.Apps.Entities.Apps.DomainObject { - public class AppDomainObjectTests : HandlerTestBase + public class AppDomainObjectTests : HandlerTestBase { private readonly IAppPlansProvider appPlansProvider = A.Fake(); private readonly IAppPlanBillingManager appPlansBillingManager = A.Fake(); diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Guards/GuardAppClientsTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppClientsTests.cs similarity index 98% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Guards/GuardAppClientsTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppClientsTests.cs index eb7e3b06a..0752c721e 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Guards/GuardAppClientsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppClientsTests.cs @@ -16,7 +16,7 @@ using Xunit; #pragma warning disable SA1310 // Field names must not contain underscore -namespace Squidex.Domain.Apps.Entities.Apps.Guards +namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards { public class GuardAppClientsTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Guards/GuardAppContributorsTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppContributorsTests.cs similarity index 99% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Guards/GuardAppContributorsTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppContributorsTests.cs index 7cf3a8d42..69a84293e 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Guards/GuardAppContributorsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppContributorsTests.cs @@ -19,7 +19,7 @@ using Xunit; #pragma warning disable SA1310 // Field names must not contain underscore -namespace Squidex.Domain.Apps.Entities.Apps.Guards +namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards { public class GuardAppContributorsTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Guards/GuardAppLanguagesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppLanguagesTests.cs similarity index 98% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Guards/GuardAppLanguagesTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppLanguagesTests.cs index 9961e6cab..ac08c9f28 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Guards/GuardAppLanguagesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppLanguagesTests.cs @@ -14,7 +14,7 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Validation; using Xunit; -namespace Squidex.Domain.Apps.Entities.Apps.Guards +namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards { public class GuardAppLanguagesTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Guards/GuardAppPatternsTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppPatternsTests.cs similarity index 99% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Guards/GuardAppPatternsTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppPatternsTests.cs index 1f6501111..5e8cba2b1 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Guards/GuardAppPatternsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppPatternsTests.cs @@ -16,7 +16,7 @@ using Xunit; #pragma warning disable SA1310 // Field names must not contain underscore -namespace Squidex.Domain.Apps.Entities.Apps.Guards +namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards { public class GuardAppPatternsTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Guards/GuardAppRolesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppRolesTests.cs similarity index 99% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Guards/GuardAppRolesTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppRolesTests.cs index 048d369e9..09c8a48aa 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Guards/GuardAppRolesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppRolesTests.cs @@ -16,7 +16,7 @@ using Xunit; #pragma warning disable SA1310 // Field names must not contain underscore -namespace Squidex.Domain.Apps.Entities.Apps.Guards +namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards { public class GuardAppRolesTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Guards/GuardAppTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppTests.cs similarity index 98% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Guards/GuardAppTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppTests.cs index 71bb145d9..d469be806 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Guards/GuardAppTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppTests.cs @@ -16,7 +16,7 @@ using Squidex.Infrastructure.Validation; using Squidex.Shared.Users; using Xunit; -namespace Squidex.Domain.Apps.Entities.Apps.Guards +namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards { public class GuardAppTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Guards/GuardAppWorkflowTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppWorkflowTests.cs similarity index 99% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Guards/GuardAppWorkflowTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppWorkflowTests.cs index db6a23043..22946e760 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Guards/GuardAppWorkflowTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppWorkflowTests.cs @@ -15,7 +15,7 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Validation; using Xunit; -namespace Squidex.Domain.Apps.Entities.Apps.Guards +namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards { public class GuardAppWorkflowTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Indexes/AppsIndexTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Indexes/AppsIndexTests.cs index 53f76579f..d4f9346b9 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Indexes/AppsIndexTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Indexes/AppsIndexTests.cs @@ -15,6 +15,7 @@ using Orleans; using Squidex.Caching; using Squidex.Domain.Apps.Core.Apps; using Squidex.Domain.Apps.Entities.Apps.Commands; +using Squidex.Domain.Apps.Entities.Apps.DomainObject; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Orleans; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/BackupAssetsTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/BackupAssetsTests.cs index 56ba78c29..9fd737756 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/BackupAssetsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/BackupAssetsTests.cs @@ -13,7 +13,7 @@ using System.Threading.Tasks; using FakeItEasy; using Squidex.Assets; using Squidex.Domain.Apps.Core.Tags; -using Squidex.Domain.Apps.Entities.Assets.State; +using Squidex.Domain.Apps.Entities.Assets.DomainObject; using Squidex.Domain.Apps.Entities.Backup; using Squidex.Domain.Apps.Events.Assets; using Squidex.Infrastructure; @@ -228,7 +228,7 @@ namespace Squidex.Domain.Apps.Entities.Assets var rebuildAssets = new HashSet(); - A.CallTo(() => rebuilder.InsertManyAsync(A>._, A._)) + A.CallTo(() => rebuilder.InsertManyAsync(A>._, A._)) .Invokes((IEnumerable source, CancellationToken _) => rebuildAssets.AddRange(source)); await sut.RestoreAsync(context); @@ -265,7 +265,7 @@ namespace Squidex.Domain.Apps.Entities.Assets var rebuildAssetFolders = new HashSet(); - A.CallTo(() => rebuilder.InsertManyAsync(A>._, A._)) + A.CallTo(() => rebuilder.InsertManyAsync(A>._, A._)) .Invokes((IEnumerable source, CancellationToken _) => rebuildAssetFolders.AddRange(source)); await sut.RestoreAsync(context); diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetCommandMiddlewareTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetCommandMiddlewareTests.cs similarity index 99% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetCommandMiddlewareTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetCommandMiddlewareTests.cs index d1e7b0b19..39e7f3bdb 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetCommandMiddlewareTests.cs @@ -15,7 +15,6 @@ using Orleans; using Squidex.Assets; using Squidex.Domain.Apps.Core.Tags; using Squidex.Domain.Apps.Entities.Assets.Commands; -using Squidex.Domain.Apps.Entities.Assets.State; using Squidex.Domain.Apps.Entities.Contents.Repositories; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; @@ -24,9 +23,9 @@ using Squidex.Infrastructure.Reflection; using Squidex.Log; using Xunit; -namespace Squidex.Domain.Apps.Entities.Assets +namespace Squidex.Domain.Apps.Entities.Assets.DomainObject { - public class AssetCommandMiddlewareTests : HandlerTestBase + public class AssetCommandMiddlewareTests : HandlerTestBase { private readonly IAssetEnricher assetEnricher = A.Fake(); private readonly IAssetFileStore assetFileStore = A.Fake(); diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetDomainObjectGrainTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetDomainObjectGrainTests.cs similarity index 95% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetDomainObjectGrainTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetDomainObjectGrainTests.cs index 2706855b2..4311e5a17 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetDomainObjectGrainTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetDomainObjectGrainTests.cs @@ -13,7 +13,7 @@ using Xunit; #pragma warning disable RECS0026 // Possible unassigned object created by 'new' #pragma warning disable CA1806 // Do not ignore method results -namespace Squidex.Domain.Apps.Entities.Assets +namespace Squidex.Domain.Apps.Entities.Assets.DomainObject { public class AssetDomainObjectGrainTests { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetDomainObjectTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetDomainObjectTests.cs similarity index 98% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetDomainObjectTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetDomainObjectTests.cs index d671c4714..dc558757d 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetDomainObjectTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetDomainObjectTests.cs @@ -13,7 +13,6 @@ using Squidex.Assets; using Squidex.Domain.Apps.Core.Assets; using Squidex.Domain.Apps.Core.Tags; using Squidex.Domain.Apps.Entities.Assets.Commands; -using Squidex.Domain.Apps.Entities.Assets.State; using Squidex.Domain.Apps.Entities.Contents; using Squidex.Domain.Apps.Entities.Contents.Repositories; using Squidex.Domain.Apps.Entities.TestHelpers; @@ -23,9 +22,9 @@ using Squidex.Infrastructure.Commands; using Squidex.Log; using Xunit; -namespace Squidex.Domain.Apps.Entities.Assets +namespace Squidex.Domain.Apps.Entities.Assets.DomainObject { - public class AssetDomainObjectTests : HandlerTestBase + public class AssetDomainObjectTests : HandlerTestBase { private readonly IContentRepository contentRepository = A.Fake(); private readonly ITagService tagService = A.Fake(); diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetFolderDomainObjectGrainTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetFolderDomainObjectGrainTests.cs similarity index 95% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetFolderDomainObjectGrainTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetFolderDomainObjectGrainTests.cs index 43c3bd68d..badc29dc4 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetFolderDomainObjectGrainTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetFolderDomainObjectGrainTests.cs @@ -13,7 +13,7 @@ using Xunit; #pragma warning disable RECS0026 // Possible unassigned object created by 'new' #pragma warning disable CA1806 // Do not ignore method results -namespace Squidex.Domain.Apps.Entities.Assets +namespace Squidex.Domain.Apps.Entities.Assets.DomainObject { public class AssetFolderDomainObjectGrainTests { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetFolderDomainObjectTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetFolderDomainObjectTests.cs similarity index 98% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetFolderDomainObjectTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetFolderDomainObjectTests.cs index 4f1e5f48b..d0e049e70 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetFolderDomainObjectTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetFolderDomainObjectTests.cs @@ -9,7 +9,6 @@ using System.Collections.Generic; using System.Threading.Tasks; using FakeItEasy; using Squidex.Domain.Apps.Entities.Assets.Commands; -using Squidex.Domain.Apps.Entities.Assets.State; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Domain.Apps.Events.Assets; using Squidex.Infrastructure; @@ -17,9 +16,9 @@ using Squidex.Infrastructure.Commands; using Squidex.Log; using Xunit; -namespace Squidex.Domain.Apps.Entities.Assets +namespace Squidex.Domain.Apps.Entities.Assets.DomainObject { - public class AssetFolderDomainObjectTests : HandlerTestBase + public class AssetFolderDomainObjectTests : HandlerTestBase { private readonly IAssetQueryService assetQuery = A.Fake(); private readonly DomainId parentId = DomainId.NewGuid(); diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Guards/GuardAssetFolderTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/Guards/GuardAssetFolderTests.cs similarity index 98% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Guards/GuardAssetFolderTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/Guards/GuardAssetFolderTests.cs index 316b1da90..0075ec83b 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Guards/GuardAssetFolderTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/Guards/GuardAssetFolderTests.cs @@ -15,7 +15,7 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Validation; using Xunit; -namespace Squidex.Domain.Apps.Entities.Assets.Guards +namespace Squidex.Domain.Apps.Entities.Assets.DomainObject.Guards { public class GuardAssetFolderTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Guards/GuardAssetTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/Guards/GuardAssetTests.cs similarity index 98% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Guards/GuardAssetTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/Guards/GuardAssetTests.cs index 10708c108..3a8aa2c60 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Guards/GuardAssetTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/Guards/GuardAssetTests.cs @@ -17,7 +17,7 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Validation; using Xunit; -namespace Squidex.Domain.Apps.Entities.Assets.Guards +namespace Squidex.Domain.Apps.Entities.Assets.DomainObject.Guards { public class GuardAssetTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetLoaderTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetLoaderTests.cs index 2a769a1f9..390d32ff2 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetLoaderTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetLoaderTests.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using FakeItEasy; using Orleans; +using Squidex.Domain.Apps.Entities.Assets.DomainObject; using Squidex.Infrastructure; using Squidex.Infrastructure.Orleans; using Xunit; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetQueryParserTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetQueryParserTests.cs index 1348fe148..5ac172da2 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetQueryParserTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetQueryParserTests.cs @@ -12,7 +12,6 @@ using Microsoft.Extensions.Options; using Squidex.Domain.Apps.Core.Tags; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; -using Squidex.Infrastructure.Queries; using Squidex.Infrastructure.Validation; using Xunit; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/CommentsLoaderTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/CommentsLoaderTests.cs index 69c2624b4..5d13bafec 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/CommentsLoaderTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/CommentsLoaderTests.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using FakeItEasy; using Orleans; +using Squidex.Domain.Apps.Entities.Comments.DomainObject; using Squidex.Infrastructure; using Xunit; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/CommentsCommandMiddlewareTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/DomainObject/CommentsCommandMiddlewareTests.cs similarity index 98% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/CommentsCommandMiddlewareTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/DomainObject/CommentsCommandMiddlewareTests.cs index 91e0187e0..976b437b7 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/CommentsCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/DomainObject/CommentsCommandMiddlewareTests.cs @@ -15,7 +15,7 @@ using Squidex.Infrastructure.Orleans; using Squidex.Shared.Users; using Xunit; -namespace Squidex.Domain.Apps.Entities.Comments +namespace Squidex.Domain.Apps.Entities.Comments.DomainObject { public class CommentsCommandMiddlewareTests { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/CommentsGrainTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/DomainObject/CommentsGrainTests.cs similarity index 99% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/CommentsGrainTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/DomainObject/CommentsGrainTests.cs index 3c5cc5997..3f3f722c8 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/CommentsGrainTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/DomainObject/CommentsGrainTests.cs @@ -21,7 +21,7 @@ using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.EventSourcing; using Xunit; -namespace Squidex.Domain.Apps.Entities.Comments +namespace Squidex.Domain.Apps.Entities.Comments.DomainObject { public class CommentsGrainTests { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/Guards/GuardCommentsTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/DomainObject/Guards/GuardCommentsTests.cs similarity index 99% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/Guards/GuardCommentsTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/DomainObject/Guards/GuardCommentsTests.cs index 249362b5e..dc4cf98f6 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/Guards/GuardCommentsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/DomainObject/Guards/GuardCommentsTests.cs @@ -15,7 +15,7 @@ using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.Validation; using Xunit; -namespace Squidex.Domain.Apps.Entities.Comments.Guards +namespace Squidex.Domain.Apps.Entities.Comments.DomainObject.Guards { public class GuardCommentsTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/BackupContentsTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/BackupContentsTests.cs index 5e76dfa59..5b8e233e9 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/BackupContentsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/BackupContentsTests.cs @@ -12,7 +12,7 @@ using FakeItEasy; using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Entities.Backup; -using Squidex.Domain.Apps.Entities.Contents.State; +using Squidex.Domain.Apps.Entities.Contents.DomainObject; using Squidex.Domain.Apps.Events.Apps; using Squidex.Domain.Apps.Events.Contents; using Squidex.Domain.Apps.Events.Schemas; @@ -192,7 +192,7 @@ namespace Squidex.Domain.Apps.Entities.Contents var rebuildContents = new HashSet(); - A.CallTo(() => rebuilder.InsertManyAsync(A>._, A._)) + A.CallTo(() => rebuilder.InsertManyAsync(A>._, A._)) .Invokes((IEnumerable source, CancellationToken _) => rebuildContents.AddRange(source)); await sut.RestoreAsync(context); diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/BulkUpdateCommandMiddlewareTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/BulkUpdateCommandMiddlewareTests.cs index 181450dde..902741892 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/BulkUpdateCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/BulkUpdateCommandMiddlewareTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System; -using System.Linq; using System.Security.Claims; using System.Threading.Tasks; using FakeItEasy; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentCommandMiddlewareTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/ContentCommandMiddlewareTests.cs similarity index 96% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentCommandMiddlewareTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/ContentCommandMiddlewareTests.cs index d83c513fc..2092d87cb 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/ContentCommandMiddlewareTests.cs @@ -9,15 +9,14 @@ using System.Threading.Tasks; using FakeItEasy; using Orleans; using Squidex.Domain.Apps.Entities.Contents.Queries; -using Squidex.Domain.Apps.Entities.Contents.State; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Xunit; -namespace Squidex.Domain.Apps.Entities.Contents +namespace Squidex.Domain.Apps.Entities.Contents.DomainObject { - public sealed class ContentCommandMiddlewareTests : HandlerTestBase + public sealed class ContentCommandMiddlewareTests : HandlerTestBase { private readonly IContentEnricher contentEnricher = A.Fake(); private readonly IContextProvider contextProvider = A.Fake(); diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentDomainObjectGrainTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/ContentDomainObjectGrainTests.cs similarity index 95% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentDomainObjectGrainTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/ContentDomainObjectGrainTests.cs index 523c0c5b7..b0645752a 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentDomainObjectGrainTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/ContentDomainObjectGrainTests.cs @@ -13,7 +13,7 @@ using Xunit; #pragma warning disable RECS0026 // Possible unassigned object created by 'new' #pragma warning disable CA1806 // Do not ignore method results -namespace Squidex.Domain.Apps.Entities.Contents +namespace Squidex.Domain.Apps.Entities.Contents.DomainObject { public class ContentDomainObjectGrainTests { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentDomainObjectTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/ContentDomainObjectTests.cs similarity index 99% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentDomainObjectTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/ContentDomainObjectTests.cs index 808319b47..5cac56b0c 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentDomainObjectTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/ContentDomainObjectTests.cs @@ -16,9 +16,7 @@ using Squidex.Domain.Apps.Core.Scripting; using Squidex.Domain.Apps.Core.ValidateContent; using Squidex.Domain.Apps.Entities.Apps; using Squidex.Domain.Apps.Entities.Contents.Commands; -using Squidex.Domain.Apps.Entities.Contents.Operations; using Squidex.Domain.Apps.Entities.Contents.Repositories; -using Squidex.Domain.Apps.Entities.Contents.State; using Squidex.Domain.Apps.Entities.Schemas; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Domain.Apps.Events.Contents; @@ -28,9 +26,9 @@ using Squidex.Infrastructure.Validation; using Squidex.Log; using Xunit; -namespace Squidex.Domain.Apps.Entities.Contents +namespace Squidex.Domain.Apps.Entities.Contents.DomainObject { - public class ContentDomainObjectTests : HandlerTestBase + public class ContentDomainObjectTests : HandlerTestBase { private readonly DomainId contentId = DomainId.NewGuid(); private readonly IAppEntity app; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Guard/GuardContentTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/Guards/GuardContentTests.cs similarity index 99% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Guard/GuardContentTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/Guards/GuardContentTests.cs index ec757a1aa..d02dc567d 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Guard/GuardContentTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/Guards/GuardContentTests.cs @@ -13,7 +13,6 @@ using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Entities.Contents.Commands; -using Squidex.Domain.Apps.Entities.Contents.Guards; using Squidex.Domain.Apps.Entities.Contents.Repositories; using Squidex.Domain.Apps.Entities.Schemas; using Squidex.Domain.Apps.Entities.TestHelpers; @@ -21,7 +20,7 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Validation; using Xunit; -namespace Squidex.Domain.Apps.Entities.Contents.Guard +namespace Squidex.Domain.Apps.Entities.Contents.DomainObject.Guards { public class GuardContentTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLQueriesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLQueriesTests.cs index 36065195d..7a0943606 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLQueriesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLQueriesTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using System.Collections.Generic; using System.Threading.Tasks; using FakeItEasy; using Squidex.Domain.Apps.Core.Contents; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ContentLoaderTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ContentLoaderTests.cs index 8e59d9636..874c441ad 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ContentLoaderTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ContentLoaderTests.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using FakeItEasy; using Orleans; +using Squidex.Domain.Apps.Entities.Contents.DomainObject; using Squidex.Infrastructure; using Squidex.Infrastructure.Orleans; using Xunit; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ResolveReferencesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ResolveReferencesTests.cs index 2c7d11cea..ec1b0bb07 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ResolveReferencesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ResolveReferencesTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using FakeItEasy; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ReferenceFluidExtensionTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ReferenceFluidExtensionTests.cs index 9cb9102c7..86fdb27cb 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ReferenceFluidExtensionTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ReferenceFluidExtensionTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using System.Collections.Generic; using System.Threading.Tasks; using FakeItEasy; using Squidex.Domain.Apps.Core.Contents; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Guards/GuardRuleTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/GuardRuleTests.cs similarity index 98% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Guards/GuardRuleTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/GuardRuleTests.cs index 926a4158d..8e385d7f3 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Guards/GuardRuleTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/GuardRuleTests.cs @@ -18,7 +18,7 @@ using Squidex.Infrastructure.Collections; using Squidex.Infrastructure.Validation; using Xunit; -namespace Squidex.Domain.Apps.Entities.Rules.Guards +namespace Squidex.Domain.Apps.Entities.Rules.DomainObject.Guards { public class GuardRuleTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Guards/Triggers/ContentChangedTriggerTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/Triggers/ContentChangedTriggerTests.cs similarity index 98% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Guards/Triggers/ContentChangedTriggerTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/Triggers/ContentChangedTriggerTests.cs index 070c5389e..3ea9398e9 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Guards/Triggers/ContentChangedTriggerTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/Triggers/ContentChangedTriggerTests.cs @@ -18,7 +18,7 @@ using Squidex.Infrastructure.Collections; using Squidex.Infrastructure.Validation; using Xunit; -namespace Squidex.Domain.Apps.Entities.Rules.Guards.Triggers +namespace Squidex.Domain.Apps.Entities.Rules.DomainObject.Guards.Triggers { public class ContentChangedTriggerTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Guards/Triggers/UsageTriggerValidationTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/Triggers/UsageTriggerValidationTests.cs similarity index 97% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Guards/Triggers/UsageTriggerValidationTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/Triggers/UsageTriggerValidationTests.cs index 17c06ec43..0b21226c4 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Guards/Triggers/UsageTriggerValidationTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/Triggers/UsageTriggerValidationTests.cs @@ -15,7 +15,7 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Validation; using Xunit; -namespace Squidex.Domain.Apps.Entities.Rules.Guards.Triggers +namespace Squidex.Domain.Apps.Entities.Rules.DomainObject.Guards.Triggers { public class UsageTriggerValidationTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/RuleCommandMiddlewareTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/RuleCommandMiddlewareTests.cs similarity index 96% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/RuleCommandMiddlewareTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/RuleCommandMiddlewareTests.cs index 818824110..f1902e232 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/RuleCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/RuleCommandMiddlewareTests.cs @@ -8,15 +8,14 @@ using System.Threading.Tasks; using FakeItEasy; using Orleans; -using Squidex.Domain.Apps.Entities.Rules.State; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Xunit; -namespace Squidex.Domain.Apps.Entities.Rules +namespace Squidex.Domain.Apps.Entities.Rules.DomainObject { - public sealed class RuleCommandMiddlewareTests : HandlerTestBase + public sealed class RuleCommandMiddlewareTests : HandlerTestBase { private readonly IRuleEnricher ruleEnricher = A.Fake(); private readonly IContextProvider contextProvider = A.Fake(); diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/RuleDomainObjectTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/RuleDomainObjectTests.cs similarity index 97% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/RuleDomainObjectTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/RuleDomainObjectTests.cs index f1124daeb..b3c88b2f4 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/RuleDomainObjectTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/RuleDomainObjectTests.cs @@ -10,7 +10,6 @@ using FakeItEasy; using Squidex.Domain.Apps.Core.Rules; using Squidex.Domain.Apps.Core.Rules.Triggers; using Squidex.Domain.Apps.Entities.Rules.Commands; -using Squidex.Domain.Apps.Entities.Rules.State; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Domain.Apps.Events.Rules; using Squidex.Infrastructure; @@ -19,9 +18,9 @@ using Squidex.Infrastructure.EventSourcing; using Squidex.Log; using Xunit; -namespace Squidex.Domain.Apps.Entities.Rules +namespace Squidex.Domain.Apps.Entities.Rules.DomainObject { - public class RuleDomainObjectTests : HandlerTestBase + public class RuleDomainObjectTests : HandlerTestBase { private readonly IAppProvider appProvider = A.Fake(); private readonly IRuleEnqueuer ruleEnqueuer = A.Fake(); diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Indexes/RulesIndexTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Indexes/RulesIndexTests.cs index 8ad63027f..7ecff6886 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Indexes/RulesIndexTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Indexes/RulesIndexTests.cs @@ -10,6 +10,7 @@ using System.Threading.Tasks; using FakeItEasy; using Orleans; using Squidex.Domain.Apps.Entities.Rules.Commands; +using Squidex.Domain.Apps.Entities.Rules.DomainObject; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Orleans; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/ArrayFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/ArrayFieldPropertiesTests.cs similarity index 94% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/ArrayFieldPropertiesTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/ArrayFieldPropertiesTests.cs index 84a7faa7c..9b9be8f95 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/ArrayFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/ArrayFieldPropertiesTests.cs @@ -13,7 +13,7 @@ using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Validation; using Xunit; -namespace Squidex.Domain.Apps.Entities.Schemas.Guards.FieldProperties +namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperties { public class ArrayFieldPropertiesTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/AssetsFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/AssetsFieldPropertiesTests.cs similarity index 98% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/AssetsFieldPropertiesTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/AssetsFieldPropertiesTests.cs index abe1aad7b..c514cef86 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/AssetsFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/AssetsFieldPropertiesTests.cs @@ -13,7 +13,7 @@ using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Validation; using Xunit; -namespace Squidex.Domain.Apps.Entities.Schemas.Guards.FieldProperties +namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperties { public class AssetsFieldPropertiesTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/BooleanFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/BooleanFieldPropertiesTests.cs similarity index 93% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/BooleanFieldPropertiesTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/BooleanFieldPropertiesTests.cs index d0d6dbab0..885148c34 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/BooleanFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/BooleanFieldPropertiesTests.cs @@ -13,7 +13,7 @@ using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Validation; using Xunit; -namespace Squidex.Domain.Apps.Entities.Schemas.Guards.FieldProperties +namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperties { public class BooleanFieldPropertiesTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/DateTimeFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/DateTimeFieldPropertiesTests.cs similarity index 97% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/DateTimeFieldPropertiesTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/DateTimeFieldPropertiesTests.cs index f9d8f5e97..8f891c5bf 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/DateTimeFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/DateTimeFieldPropertiesTests.cs @@ -15,7 +15,7 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Validation; using Xunit; -namespace Squidex.Domain.Apps.Entities.Schemas.Guards.FieldProperties +namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperties { public class DateTimeFieldPropertiesTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/GeolocationFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/GeolocationFieldPropertiesTests.cs similarity index 93% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/GeolocationFieldPropertiesTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/GeolocationFieldPropertiesTests.cs index 364bc4855..988cdae90 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/GeolocationFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/GeolocationFieldPropertiesTests.cs @@ -13,7 +13,7 @@ using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Validation; using Xunit; -namespace Squidex.Domain.Apps.Entities.Schemas.Guards.FieldProperties +namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperties { public class GeolocationFieldPropertiesTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/JsonFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/JsonFieldPropertiesTests.cs similarity index 90% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/JsonFieldPropertiesTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/JsonFieldPropertiesTests.cs index a6d43633c..3c5b35826 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/JsonFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/JsonFieldPropertiesTests.cs @@ -10,7 +10,7 @@ using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Xunit; -namespace Squidex.Domain.Apps.Entities.Schemas.Guards.FieldProperties +namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperties { public class JsonFieldPropertiesTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/NumberFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/NumberFieldPropertiesTests.cs similarity index 97% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/NumberFieldPropertiesTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/NumberFieldPropertiesTests.cs index 11be9d4f0..7100ff4f1 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/NumberFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/NumberFieldPropertiesTests.cs @@ -14,7 +14,7 @@ using Squidex.Infrastructure.Collections; using Squidex.Infrastructure.Validation; using Xunit; -namespace Squidex.Domain.Apps.Entities.Schemas.Guards.FieldProperties +namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperties { public class NumberFieldPropertiesTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/ReferencesFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/ReferencesFieldPropertiesTests.cs similarity index 96% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/ReferencesFieldPropertiesTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/ReferencesFieldPropertiesTests.cs index ec50abd7d..daa74b224 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/ReferencesFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/ReferencesFieldPropertiesTests.cs @@ -13,7 +13,7 @@ using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Validation; using Xunit; -namespace Squidex.Domain.Apps.Entities.Schemas.Guards.FieldProperties +namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperties { public class ReferencesFieldPropertiesTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/StringFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/StringFieldPropertiesTests.cs similarity index 98% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/StringFieldPropertiesTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/StringFieldPropertiesTests.cs index 6ffb7b7ce..19742f8f5 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/StringFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/StringFieldPropertiesTests.cs @@ -14,7 +14,7 @@ using Squidex.Infrastructure.Collections; using Squidex.Infrastructure.Validation; using Xunit; -namespace Squidex.Domain.Apps.Entities.Schemas.Guards.FieldProperties +namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperties { public class StringFieldPropertiesTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/TagsFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/TagsFieldPropertiesTests.cs similarity index 96% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/TagsFieldPropertiesTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/TagsFieldPropertiesTests.cs index 246b55ca0..d602c990f 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/TagsFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/TagsFieldPropertiesTests.cs @@ -13,7 +13,7 @@ using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Validation; using Xunit; -namespace Squidex.Domain.Apps.Entities.Schemas.Guards.FieldProperties +namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperties { public class TagsFieldPropertiesTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/UIFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/UIFieldPropertiesTests.cs similarity index 94% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/UIFieldPropertiesTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/UIFieldPropertiesTests.cs index b08da7b38..326a43e88 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/FieldProperties/UIFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/UIFieldPropertiesTests.cs @@ -13,7 +13,7 @@ using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Validation; using Xunit; -namespace Squidex.Domain.Apps.Entities.Schemas.Guards.FieldProperties +namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperties { public class UIFieldPropertiesTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/GuardSchemaFieldTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/GuardSchemaFieldTests.cs similarity index 99% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/GuardSchemaFieldTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/GuardSchemaFieldTests.cs index 89223a084..64abef770 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/GuardSchemaFieldTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/GuardSchemaFieldTests.cs @@ -18,7 +18,7 @@ using Xunit; #pragma warning disable SA1310 // Field names must not contain underscore -namespace Squidex.Domain.Apps.Entities.Schemas.Guards +namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards { public class GuardSchemaFieldTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/GuardSchemaTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/GuardSchemaTests.cs similarity index 99% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/GuardSchemaTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/GuardSchemaTests.cs index c950361fd..268acc0c2 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/GuardSchemaTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/GuardSchemaTests.cs @@ -17,7 +17,7 @@ using Xunit; #pragma warning disable SA1310 // Field names must not contain underscore -namespace Squidex.Domain.Apps.Entities.Schemas.Guards +namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards { public class GuardSchemaTests : IClassFixture { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemaDomainObjectTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/SchemaDomainObjectTests.cs similarity index 99% rename from backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemaDomainObjectTests.cs rename to backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/SchemaDomainObjectTests.cs index 9973d94cf..1cf80eb57 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemaDomainObjectTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/SchemaDomainObjectTests.cs @@ -12,7 +12,6 @@ using FakeItEasy; using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Entities.Schemas.Commands; -using Squidex.Domain.Apps.Entities.Schemas.State; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Domain.Apps.Events.Schemas; using Squidex.Infrastructure; @@ -20,9 +19,9 @@ using Squidex.Infrastructure.Commands; using Squidex.Log; using Xunit; -namespace Squidex.Domain.Apps.Entities.Schemas +namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject { - public class SchemaDomainObjectTests : HandlerTestBase + public class SchemaDomainObjectTests : HandlerTestBase { private readonly string fieldName = "age"; private readonly string arrayName = "array"; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Indexes/SchemasIndexTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Indexes/SchemasIndexTests.cs index 4910a936f..af0fbdc01 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Indexes/SchemasIndexTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Indexes/SchemasIndexTests.cs @@ -15,6 +15,7 @@ using Orleans; using Squidex.Caching; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Entities.Schemas.Commands; +using Squidex.Domain.Apps.Entities.Schemas.DomainObject; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Orleans; diff --git a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/MongoParallelInsertTests.cs b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/MongoParallelInsertTests.cs index f342bba19..6bbd9420a 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/MongoParallelInsertTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/MongoParallelInsertTests.cs @@ -125,7 +125,7 @@ namespace Squidex.Infrastructure.EventSourcing protected sealed override IEnumerable GetScheduledTasks() { - bool lockTaken = false; + var lockTaken = false; try { Monitor.TryEnter(tasks, ref lockTaken);