From 920371bd9cf35e628b4f1b74d93c62ee604b4b07 Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Tue, 19 Nov 2024 08:35:10 +0100 Subject: [PATCH] UI fixes (#1142) * Simplified editors. * Primary ctor. * Move inheritance to new line * Formatting fixes. * Fix registration. --- backend/.editorconfig | 3 - .../ApplicationInsightsPlugin.cs | 9 +- .../Squidex.Extensions/APM/Otlp/OtlpPlugin.cs | 9 +- .../StackdriverExceptionHandler.cs | 12 +- .../APM/Stackdriver/StackdriverPlugin.cs | 9 +- .../APM/Zipkin/ZipkinPlugin.cs | 9 +- .../Actions/Algolia/AlgoliaActionHandler.cs | 15 +- .../AzureQueue/AzureQueueActionHandler.cs | 10 +- .../Actions/Comment/CommentActionHandler.cs | 9 +- .../CreateContentActionHandler.cs | 13 +- .../DeepDetect/DeepDetectActionHandler.cs | 32 +-- .../Discourse/DiscourseActionHandler.cs | 10 +- .../ElasticSearchActionHandler.cs | 15 +- .../Actions/Email/EmailActionHandler.cs | 7 +- .../Actions/Fastly/FastlyActionHandler.cs | 10 +- .../Actions/Kafka/KafkaActionHandler.cs | 9 +- .../Actions/Medium/MediumActionHandler.cs | 13 +- .../Notification/NotificationActionHandler.cs | 11 +- .../OpenSearch/OpenSearchActionHandler.cs | 15 +- .../Prerender/PrerenderActionHandler.cs | 10 +- .../Actions/Script/ScriptActionHandler.cs | 10 +- .../Actions/SignalR/SignalRActionHandler.cs | 10 +- .../Actions/Slack/SlackActionHandler.cs | 10 +- .../Actions/Twitter/TweetActionHandler.cs | 10 +- .../Typesense/TypesenseActionHandler.cs | 14 +- .../Actions/Webhook/WebhookActionHandler.cs | 10 +- .../Samples/Controllers/PluginController.cs | 7 +- .../DoubleLinkedContentMiddleware.cs | 9 +- .../Squidex.Extensions.csproj | 16 +- .../ElasticSearch/ElasticSearchTextIndex.cs | 14 +- .../Validation/CompositeUniqueValidator.cs | 11 +- .../CompositeUniqueValidatorFactory.cs | 8 +- backend/i18n/frontend_en.json | 7 +- backend/i18n/frontend_fr.json | 1 + backend/i18n/frontend_it.json | 1 + backend/i18n/frontend_nl.json | 1 + backend/i18n/frontend_pt.json | 1 + backend/i18n/frontend_zh.json | 1 + backend/i18n/source/frontend_en.json | 7 +- .../Processes/CheckBackend.cs | 12 +- .../Processes/CheckFrontend.cs | 12 +- .../Processes/GenerateBackendResources.cs | 12 +- .../Processes/GenerateFrontendResources.cs | 12 +- .../Processes/GenerateKeys.cs | 13 +- .../Processes/TranslateBackend.cs | 12 +- .../Processes/TranslateTemplates.cs | 13 +- .../Processes/TranslateTypescript.cs | 12 +- backend/src/Migrations/MigrationPath.cs | 8 +- backend/src/Migrations/Migrations.csproj | 2 +- .../Migrations/Backup/BackupState.cs | 2 +- .../Migrations/Backup/ConvertBackup.cs | 16 +- .../src/Migrations/Migrations/ClearRules.cs | 9 +- .../src/Migrations/Migrations/ClearSchemas.cs | 9 +- .../Migrations/ConvertEventStore.cs | 9 +- .../Migrations/ConvertEventStoreAppId.cs | 9 +- .../Migrations/Migrations/CreateAssetSlugs.cs | 9 +- .../MongoDb/AddAppIdToEventStream.cs | 9 +- .../Migrations/MongoDb/ConvertDocumentIds.cs | 10 +- .../MongoDb/ConvertOldSnapshotStores.cs | 9 +- .../MongoDb/ConvertRuleEventsJson.cs | 9 +- .../Migrations/MongoDb/CopyRuleStatistics.cs | 11 +- .../MongoDb/DeleteContentCollections.cs | 9 +- .../Migrations/MongoDb/RenameAssetMetadata.cs | 9 +- .../MongoDb/RenameAssetSlugField.cs | 9 +- .../MongoDb/RestructureContentCollection.cs | 9 +- .../src/Migrations/Migrations/RebuildApps.cs | 15 +- .../Migrations/RebuildAssetFolders.cs | 15 +- .../Migrations/Migrations/RebuildAssets.cs | 15 +- .../Migrations/Migrations/RebuildContents.cs | 15 +- .../src/Migrations/Migrations/RebuildRules.cs | 15 +- .../Migrations/Migrations/RebuildSchemas.cs | 15 +- .../Migrations/Migrations/RebuildSnapshots.cs | 15 +- .../Migrations/OldEvents/AppClientUpdated.cs | 2 +- backend/src/Migrations/RebuildRunner.cs | 19 +- .../Contents/Status.cs | 9 +- .../FieldDescriptionAttribute.cs | 9 +- .../EnrichedEvents/EnrichedAssetEventType.cs | 2 +- .../EnrichedEvents/EnrichedSchemaEventType.cs | 2 +- .../Schemas/FieldRuleAction.cs | 2 +- .../Schemas/Fields.cs | 2 +- .../Squidex.Domain.Apps.Core.Model.csproj | 4 +- .../ConvertContent/AddDefaultValues.cs | 12 +- .../ConvertContent/AddSchemaNames.cs | 9 +- .../ConvertContent/ContentConverter.cs | 10 +- .../ConvertContent/ExcludeChangedTypes.cs | 9 +- .../ResolveFromPreviousPartitioning.cs | 9 +- .../ConvertContent/UpdateValues.cs | 12 +- .../ValueReferencesConverter.cs | 9 +- .../HandleRules/EditorAttribute.cs | 9 +- .../HandleRules/EventEnricher.cs | 10 +- .../Extensions/EventFluidExtensions.cs | 9 +- .../Extensions/EventJintExtension.cs | 8 +- .../HandleRules/IRuleEventFormatter.cs | 2 +- .../HandleRules/RuleActionHandler.cs | 9 +- .../HandleRules/RuleEventFormatter.cs | 14 +- .../HandleRules/RuleService.cs | 38 +--- .../ContentWrapper/ContentDataObject.cs | 9 +- .../ContentWrapper/ContentFieldProperty.cs | 10 +- .../Scripting/Extensions/HttpJintExtension.cs | 8 +- .../Extensions/StringAsyncJintExtension.cs | 10 +- .../Scripting/Internal/CacheParser.cs | 9 +- .../Scripting/Internal/CustomClrConverter.cs | 7 +- .../Scripting/Internal/JsonMapper.cs | 6 +- .../Scripting/JintScriptEngine.cs | 20 +- .../Scripting/ScriptExecutionContext.cs | 9 +- .../Scripting/ScriptingCompleter.cs | 18 +- ...Squidex.Domain.Apps.Core.Operations.csproj | 12 +- .../Subscriptions/EventMessageWrapper.cs | 13 +- .../Subscriptions/SubscriptionPublisher.cs | 15 +- .../Extensions/JsonArrayFluidValue.cs | 11 +- .../Templates/TemplateParseException.cs | 10 +- .../ValidateContent/JsonError.cs | 9 +- .../ValidateContent/RootContext.cs | 22 +- .../Validators/AggregateValidator.cs | 9 +- .../Validators/ComponentValidator.cs | 9 +- .../Validators/ObjectValidator.cs | 12 +- .../Validators/RequiredStringValidator.cs | 9 +- .../Validators/UniqueObjectValuesValidator.cs | 9 +- .../Validators/UniqueValidator.cs | 9 +- .../Apps/MongoAppRepository.cs | 7 +- .../Assets/MongoAssetFolderRepository.cs | 7 +- .../Assets/MongoShardedAssetRepository.cs | 7 +- .../Contents/MongoContentCollection.cs | 1 - .../Contents/MongoContentRepository.cs | 36 ++- .../Contents/MongoShardedContentRepository.cs | 8 +- .../Contents/Operations/QueryByQuery.cs | 9 +- .../Operations/QueryInDedicatedCollection.cs | 14 +- .../Contents/Operations/QueryReferences.cs | 9 +- .../History/MongoHistoryEventRepository.cs | 7 +- .../MongoCountCollection.cs | 13 +- .../Rules/MongoRuleEventRepository.cs | 7 +- .../Rules/MongoRuleRepository.cs | 7 +- .../Schemas/MongoSchemaRepository.cs | 7 +- .../Schemas/MongoSchemasHash.cs | 7 +- .../ShardedSnapshotStore.cs | 10 +- ...quidex.Domain.Apps.Entities.MongoDb.csproj | 4 +- .../Teams/MongoTeamRepository.cs | 7 +- .../Text/AtlasTextIndex.cs | 12 +- .../Text/CommandFactory.cs | 9 +- .../Text/LuceneQueryVisitor.cs | 9 +- .../Text/LuceneSearchDefinitionExtensions.cs | 26 +-- .../Text/MongoShardedTextIndex.cs | 7 +- .../Text/MongoTextIndex.cs | 7 +- .../Text/MongoTextIndexBase.cs | 12 +- .../Text/MongoTextIndexerState.cs | 13 +- .../AppProvider.cs | 24 +- .../Apps/AppChatTools.cs | 11 +- .../Apps/AppEventDeleter.cs | 9 +- .../Apps/AppPermanentDeleter.cs | 20 +- .../Apps/AppSettingsSearchSource.cs | 8 +- .../Apps/AppUISettings.cs | 9 +- .../Apps/AppUsageDeleter.cs | 9 +- .../Apps/BackupApps.cs | 27 +-- .../Apps/Commands/RemoveContributor.cs | 2 +- .../Apps/DefaultAppImageStore.cs | 16 +- .../Apps/DefaultAppLogStore.cs | 9 +- .../Apps/DomainObject/AppCommandMiddleware.cs | 20 +- .../Apps/DomainObject/AppDomainObject.cs | 16 +- .../Apps/Indexes/AppsIndex.cs | 24 +- .../Plans/RestrictAppsCommandMiddleware.cs | 11 +- .../Templates/TemplateCommandMiddleware.cs | 22 +- .../Apps/Templates/TemplatesClient.cs | 11 +- .../Assets/AssetCache.cs | 6 +- .../Assets/AssetChangedTriggerHandler.cs | 20 +- .../Assets/AssetCleanupProcess.cs | 8 +- .../Assets/AssetHistoryEventsCreator.cs | 2 +- .../Assets/AssetPermanentDeleter.cs | 17 +- .../Assets/AssetTagsDeleter.cs | 9 +- .../Assets/AssetsFluidExtension.cs | 9 +- .../Assets/AssetsJintExtension.cs | 8 +- .../Assets/AssetsSearchSource.cs | 12 +- .../Assets/BackupAssets.cs | 12 +- .../Assets/Commands/IMoveAssetCommand.cs | 2 +- .../Assets/DefaultAssetFileStore.cs | 21 +- .../DomainObject/AssetCommandMiddleware.cs | 33 +-- .../Assets/DomainObject/AssetDomainObject.cs | 16 +- .../DomainObject/AssetFolderDomainObject.cs | 16 +- .../AssetsBulkUpdateCommandMiddleware.cs | 9 +- .../Assets/FileTagAssetMetadataSource.cs | 9 +- .../Assets/ImageAssetMetadataSource.cs | 9 +- .../Assets/Queries/AssetEnricher.cs | 9 +- .../Assets/Queries/AssetLoader.cs | 11 +- .../Assets/Queries/AssetQueryService.cs | 32 +-- .../Assets/Queries/Steps/CalculateTokens.cs | 11 +- .../Assets/Queries/Steps/ConvertTags.cs | 9 +- .../Assets/Queries/Steps/EnrichForCaching.cs | 9 +- .../Queries/Steps/EnrichWithMetadataText.cs | 9 +- .../Assets/Queries/Steps/ScriptAsset.cs | 9 +- .../Assets/RebuildFiles.cs | 18 +- .../Assets/RecursiveDeleter.cs | 35 +-- .../Backup/BackupJob.cs | 32 +-- .../Backup/BackupRestoreException.cs | 6 +- .../Backup/DefaultBackupArchiveStore.cs | 9 +- .../Backup/DefaultBackupHandlerFactory.cs | 9 +- .../Backup/IUserMapping.cs | 2 +- .../Backup/RestoreJob.cs | 40 +--- .../Backup/TempFolderBackupArchiveLocation.cs | 11 +- .../Billing/UsageGate.cs | 27 +-- .../CommentCollaborationHandler.cs | 31 +-- .../Collaboration/CommentTriggerHandler.cs | 11 +- .../Collaboration/EmailUserNotifications.cs | 22 +- .../Contents/BackupContents.cs | 10 +- .../Contents/Commands/UpsertContent.cs | 2 +- .../Contents/ContentCache.cs | 6 +- .../Contents/ContentChangedTriggerHandler.cs | 20 +- .../Contents/ContentHistoryEventsCreator.cs | 2 +- .../Contents/ContentSchedulerProcess.cs | 19 +- .../Contents/ContentsJintExtension.cs | 9 +- .../Contents/ContentsSearchSource.cs | 24 +- .../Contents/Counter/CounterJintExtension.cs | 8 +- .../Contents/Counter/CounterService.cs | 9 +- .../Contents/DefaultWorkflowsValidator.cs | 9 +- .../DomainObject/ContentCommandMiddleware.cs | 21 +- .../DomainObject/ContentDomainObject.cs | 16 +- .../Contents/DomainObject/ContentOperation.cs | 7 +- .../ContentsBulkUpdateCommandMiddleware.cs | 16 +- .../Contents/DynamicContentWorkflow.cs | 12 +- .../GraphQL/Cache/CachingBatchLoader.cs | 18 +- .../GraphQL/Cache/NonCachingBatchLoader.cs | 10 +- .../GraphQL/CachingGraphQLResolver.cs | 21 +- .../Types/Contents/ContentGraphType.cs | 10 +- .../Types/Contents/FieldInputVisitor.cs | 9 +- .../GraphQL/Types/Contents/FieldVisitor.cs | 9 +- .../Types/Dynamic/DynamicSchemaBuilder.cs | 4 +- .../GraphQL/Types/Primitives/JsonValueNode.cs | 9 +- .../GraphQL/Types/SharedExtensions.cs | 10 +- .../Contents/Indexes/CreateIndexJob.cs | 8 +- .../Contents/Indexes/DropIndexJob.cs | 8 +- .../Contents/Queries/ContentEnricher.cs | 12 +- .../Contents/Queries/ContentLoader.cs | 11 +- .../Contents/Queries/ContentQueryParser.cs | 25 +-- .../Contents/Queries/ContentQueryService.cs | 32 +-- .../Contents/Queries/Steps/CalculateTokens.cs | 11 +- .../Contents/Queries/Steps/ConvertData.cs | 22 +- .../Queries/Steps/EnrichForCaching.cs | 9 +- .../Queries/Steps/EnrichWithWorkflows.cs | 9 +- .../Contents/Queries/Steps/ResolveAssets.cs | 13 +- .../Queries/Steps/ResolveReferences.cs | 10 +- .../Contents/Queries/Steps/ScriptContent.cs | 9 +- .../Contents/ReferencesFluidExtension.cs | 9 +- .../Contents/ReferencesJintExtension.cs | 8 +- .../Contents/Text/QueryParser.cs | 9 +- .../Contents/Text/TextIndexingProcess.cs | 47 ++-- .../Validation/DependencyValidatorsFactory.cs | 11 +- .../Squidex.Domain.Apps.Entities/Context.cs | 8 +- .../History/ParsedHistoryEvent.cs | 42 ++-- .../Invitation/InvitationEventConsumer.cs | 23 +- .../Invitation/InviteUserCommandMiddleware.cs | 9 +- .../Jobs/DefaultJobService.cs | 12 +- .../Rules/BackupRules.cs | 8 +- .../Guards/RuleTriggerValidator.cs | 9 +- .../Rules/DomainObject/RuleDomainObject.cs | 16 +- .../Rules/IRuleEventEntity.cs | 2 +- .../Rules/Indexes/RulesIndex.cs | 9 +- .../Rules/Queries/RuleEnricher.cs | 11 +- .../Rules/Queries/RuleQueryService.cs | 10 +- .../Rules/RuleCommandMiddleware.cs | 17 +- .../Rules/RuleEnqueuer.cs | 41 +--- .../Rules/RuleQueueWriter.cs | 12 +- .../Rules/Runner/DefaultRuleRunnerService.cs | 23 +- .../Rules/Runner/RuleRunnerJob.cs | 36 +-- .../UsageTrackerCommandMiddleware.cs | 9 +- .../Schemas/BackupSchemas.cs | 8 +- .../Schemas/Commands/AddField.cs | 2 +- .../Schemas/Commands/DeleteField.cs | 4 +- .../Schemas/Commands/DeleteSchema.cs | 2 +- .../Schemas/Commands/UpdateField.cs | 2 +- .../Schemas/Commands/UpdateSchema.cs | 2 +- .../DomainObject/Guards/GuardHelper.cs | 2 +- .../DomainObject/Guards/GuardSchemaField.cs | 2 +- .../DomainObject/SchemaDomainObject.cs | 7 +- .../Schemas/Indexes/SchemasIndex.cs | 22 +- .../Schemas/SchemaChangedTriggerHandler.cs | 9 +- .../Schemas/SchemaHistoryEventsCreator.cs | 4 +- .../Schemas/SchemasChatTool.cs | 13 +- .../Schemas/SchemasSearchSource.cs | 11 +- .../Search/SearchManager.cs | 11 +- .../Search/SearchResult.cs | 2 +- .../Squidex.Domain.Apps.Entities.csproj | 10 +- .../Tags/TagService.cs | 11 +- .../Teams/DomainObject/TeamDomainObject.cs | 16 +- .../Teams/Indexes/TeamsIndex.cs | 9 +- .../Rules/RuleCreated.cs | 2 +- .../Schemas/FieldAdded.cs | 2 +- .../Schemas/SchemaCreated.cs | 2 +- .../Squidex.Domain.Apps.Events.csproj | 2 +- .../MongoRoleStore.cs | 7 +- .../MongoUserStore.cs | 9 +- .../Squidex.Domain.Users.MongoDb.csproj | 4 +- .../Squidex.Domain.Users/DefaultKeyStore.cs | 9 +- .../DefaultUserPictureStore.cs | 9 +- .../DefaultUserResolver.cs | 9 +- .../DefaultUserService.cs | 22 +- .../DefaultXmlRepository.cs | 9 +- .../InMemory/ImmutableApplication.cs | 51 ++--- .../InMemory/ImmutableScope.cs | 30 +-- .../Squidex.Domain.Users.csproj | 4 +- .../UserClaimsPrincipalFactoryWithEmail.cs | 7 +- .../Squidex.Domain.Users/UserWithClaims.cs | 19 +- .../Diagnostics/GetEventStoreHealthCheck.cs | 9 +- .../EventStoreProjectionClient.cs | 12 +- .../EventSourcing/GetEventStore.cs | 16 +- ...quidex.Infrastructure.GetEventStore.csproj | 10 +- .../Caching/MongoDistributedCache.cs | 7 +- .../Diagnostics/MongoHealthCheck.cs | 9 +- .../EventSourcing/MongoEventStore.cs | 7 +- .../Migrations/MongoMigrationStatus.cs | 7 +- .../MongoDb/MongoClientFactory.cs | 2 + .../MongoDb/MongoExtensions.cs | 6 - .../MongoDb/ProfilerCollection.cs | 9 +- .../Squidex.Infrastructure.MongoDb.csproj | 6 +- .../States/MongoSnapshotStore.cs | 6 +- .../States/MongoSnapshotStoreBase.cs | 7 +- .../UsageTracking/MongoUsageRepository.cs | 7 +- .../Caching/QueryCache.cs | 11 +- .../Commands/AggregateCommandMiddleware.cs | 9 +- .../Commands/CachingDomainObjectMiddleware.cs | 10 +- .../Commands/CommandContext.cs | 2 +- .../Commands/CommandRequest.cs | 16 +- .../Commands/CustomCommandMiddlewareRunner.cs | 9 +- .../Commands/DefaultDomainObjectFactory.cs | 9 +- .../src/Squidex.Infrastructure/Commands/Is.cs | 2 +- .../Commands/LogCommandMiddleware.cs | 9 +- .../Commands/ReadonlyCommandMiddleware.cs | 9 +- .../Commands/Rebuilder.cs | 27 +-- .../Diagnostics/Diagnoser.cs | 11 +- .../Diagnostics/GCHealthCheck.cs | 9 +- .../DomainForbiddenException.cs | 7 +- .../DomainObjectConflictException.cs | 7 +- .../DomainObjectDeletedException.cs | 7 +- .../DomainObjectNotFoundException.cs | 7 +- .../DomainObjectVersionException.cs | 13 +- .../Email/SmtpEmailSender.cs | 13 +- .../Consume/EventConsumerManager.cs | 18 +- .../Consume/EventConsumersHealthCheck.cs | 9 +- .../EventSourcing/DefaultEventFormatter.cs | 11 +- .../EventSourcing/EventData.cs | 2 +- .../EventSourcing/EventTypeAttribute.cs | 7 +- .../EventSourcing/RetrySubscription.cs | 9 +- .../WrongEventVersionException.cs | 13 +- .../Migrations/MigrationFailedException.cs | 10 +- .../Migrations/Migrator.cs | 18 +- .../Queries/CompareFilter.cs | 2 +- .../Queries/LogicalFilterType.cs | 2 +- .../Queries/SortOrder.cs | 2 +- .../Reflection/SimpleMapper.cs | 63 ++---- .../Reflection/TypeNameAttribute.cs | 11 +- .../src/Squidex.Infrastructure/ResultList.cs | 10 +- .../src/Squidex.Infrastructure/RetryWindow.cs | 16 +- .../Security/Permission.Part.cs | 13 +- .../Squidex.Infrastructure.csproj | 22 +- .../States/CollectionNameAttribute.cs | 9 +- .../States/InconsistentStateException.cs | 13 +- .../States/Persistence.cs | 41 +--- .../States/ShardedService.cs | 10 +- .../Squidex.Infrastructure/States/Sharding.cs | 9 +- .../Squidex.Infrastructure/States/Store.cs | 24 +- .../Squidex.Infrastructure/Tasks/AsyncLock.cs | 9 +- .../Tasks/ReentrantScheduler.cs | 9 +- .../Translations/ResourcesLocalizer.cs | 9 +- .../UsageTracking/ApiUsageTracker.cs | 8 +- .../UsageTracking/CachingUsageTracker.cs | 10 +- .../UsageTracking/UsageUpdate.cs | 18 +- .../Validation/LocalizedCompareAttribute.cs | 7 +- .../LocalizedRegularExpressionAttribute.cs | 7 +- .../LocalizedStringLengthAttribute.cs | 7 +- .../Validation/ValidationException.cs | 10 +- .../Squidex.Infrastructure/ValueStopwatch.cs | 9 +- .../src/Squidex.Shared/Squidex.Shared.csproj | 2 +- backend/src/Squidex.Web/ApiCostsAttribute.cs | 10 +- .../src/Squidex.Web/ApiExceptionConverter.cs | 1 - .../ApiModelValidationAttribute.cs | 8 +- .../ApiPermissionOrAnonymousAttribute.cs | 6 +- .../ETagCommandMiddleware.cs | 9 +- .../EnrichWithActorCommandMiddleware.cs | 9 +- .../EnrichWithAppIdCommandMiddleware.cs | 9 +- .../EnrichWithSchemaIdCommandMiddleware.cs | 9 +- .../EnrichWithTeamIdCommandMiddleware.cs | 9 +- backend/src/Squidex.Web/ContextProvider.cs | 8 +- backend/src/Squidex.Web/IApiCostsFeature.cs | 2 +- .../Pipeline/AccessTokenQueryMiddleware.cs | 9 +- .../Pipeline/ActionContextLogAppender.cs | 11 +- .../Squidex.Web/Pipeline/ApiCostsFilter.cs | 9 +- .../src/Squidex.Web/Pipeline/AppResolver.cs | 9 +- .../src/Squidex.Web/Pipeline/CachingFilter.cs | 9 +- .../Pipeline/CachingKeysMiddleware.cs | 13 +- .../Squidex.Web/Pipeline/CachingManager.cs | 8 +- .../Pipeline/FileCallbackResultExecutor.cs | 7 +- .../Squidex.Web/Pipeline/JsonStreamResult.cs | 9 +- .../Pipeline/LocalCacheMiddleware.cs | 9 +- .../Pipeline/RequestExceptionMiddleware.cs | 8 +- .../RequestLogPerformanceMiddleware.cs | 9 +- .../Squidex.Web/Pipeline/SetupMiddleware.cs | 8 +- .../src/Squidex.Web/Pipeline/TeamResolver.cs | 9 +- .../Squidex.Web/Pipeline/UsageMiddleware.cs | 11 +- .../Squidex.Web/Pipeline/UsagePipeWriter.cs | 8 +- .../Pipeline/UsageResponseBodyFeature.cs | 15 +- .../src/Squidex.Web/Pipeline/UsageStream.cs | 8 +- backend/src/Squidex.Web/Resources.cs | 12 +- .../Scripting/HttpRequestJintExtension.cs | 8 +- .../src/Squidex.Web/Services/UrlGenerator.cs | 23 +- backend/src/Squidex.Web/Squidex.Web.csproj | 8 +- .../Areas/Api/Config/AssetFileResolver.cs | 13 +- .../Areas/Api/Config/OpenApi/AcceptHeader.cs | 7 +- .../Config/OpenApi/AcceptQueryAttribute.cs | 7 +- .../Config/OpenApi/DiscriminatorProcessor.cs | 9 +- .../Api/Config/OpenApi/SecurityProcessor.cs | 7 +- .../Controllers/Apps/AppAssetsController.cs | 7 +- .../Controllers/Apps/AppClientsController.cs | 7 +- .../Apps/AppContributorsController.cs | 12 +- .../Controllers/Apps/AppImageController.cs | 22 +- .../Apps/AppLanguagesController.cs | 7 +- .../Controllers/Apps/AppRolesController.cs | 10 +- .../Controllers/Apps/AppSettingsController.cs | 7 +- .../Apps/AppWorkflowsController.cs | 10 +- .../Api/Controllers/Apps/AppsController.cs | 10 +- .../Assets/AssetContentController.cs | 31 +-- .../Assets/AssetFoldersController.cs | 10 +- .../Controllers/Assets/AssetsController.cs | 27 +-- .../Assets/Models/AssetContentQueryDto.cs | 18 ++ .../Backups/BackupContentController.cs | 14 +- .../Controllers/Backups/BackupsController.cs | 10 +- .../Controllers/Backups/RestoreController.cs | 10 +- .../Comments/CommentsController.cs | 10 +- .../Contents/ContentOpenApiController.cs | 17 +- .../Contents/ContentsController.cs | 24 +- .../Contents/ContentsSharedController.cs | 18 +- .../Contents/Generator/OperationBuilder.cs | 11 +- .../Generator/SchemasOpenApiGenerator.cs | 27 +-- .../Diagnostics/DiagnosticsController.cs | 10 +- .../Api/Controllers/Docs/DocsController.cs | 7 +- .../EventConsumersController.cs | 10 +- .../Controllers/History/HistoryController.cs | 10 +- .../Controllers/Jobs/JobsContentController.cs | 14 +- .../Api/Controllers/Jobs/JobsController.cs | 10 +- .../Languages/LanguagesController.cs | 7 +- .../Api/Controllers/News/NewsController.cs | 10 +- .../Api/Controllers/Ping/PingController.cs | 10 +- .../Controllers/Plans/AppPlansController.cs | 22 +- .../Controllers/Plans/TeamPlansController.cs | 22 +- .../Api/Controllers/Rules/RulesController.cs | 34 +-- .../Schemas/Models/QueryModelDto.cs | 1 - .../Schemas/SchemaFieldsController.cs | 7 +- .../Schemas/SchemaIndexesController.cs | 14 +- .../Controllers/Schemas/SchemasController.cs | 12 +- .../Controllers/Search/SearchController.cs | 10 +- .../Statistics/UsagesController.cs | 36 +-- .../Teams/TeamContributorsController.cs | 10 +- .../Api/Controllers/Teams/TeamsController.cs | 10 +- .../Templates/TemplatesController.cs | 10 +- .../Translations/TranslationsController.cs | 13 +- .../Areas/Api/Controllers/UI/UIController.cs | 12 +- .../Users/UserManagementController.cs | 10 +- .../Api/Controllers/Users/UsersController.cs | 30 +-- .../Frontend/Middlewares/EmbedMiddleware.cs | 9 +- .../Frontend/Middlewares/NotifoMiddleware.cs | 12 +- .../Config/ApplicationManager.cs | 16 +- .../Config/CreateAdminInitializer.cs | 9 +- .../Dynamic/DynamicOpenIdConnectHandler.cs | 6 +- .../Config/Dynamic/DynamicSchemeProvider.cs | 31 +-- .../Config/DynamicApplicationStore.cs | 10 +- .../Config/TokenStoreInitializer.cs | 11 +- .../Controllers/Account/AccountController.cs | 20 +- .../Connect/AuthorizationController.cs | 20 +- .../Controllers/ExternalProvider.cs | 15 +- .../Profile/ChangePasswordModel.cs | 2 +- .../Controllers/Profile/ProfileController.cs | 24 +- .../Controllers/Profile/RemoveLoginModel.cs | 2 +- .../Controllers/Profile/SetPasswordModel.cs | 2 +- .../Controllers/Setup/SetupController.cs | 29 +-- .../Controllers/Test/TestController.cs | 9 +- .../UserInfo/UserInfoController.cs | 9 +- .../Views/ValidationPageHelper.cs | 9 +- .../Config/Authentication/OidcHandler.cs | 9 +- .../Squidex/Config/Domain/HistoryServices.cs | 4 +- .../Squidex/Config/Domain/ResizeServices.cs | 27 ++- .../Config/Startup/LogConfigurationHost.cs | 12 +- .../Config/Startup/MigrationRebuilderHost.cs | 9 +- .../Squidex/Config/Startup/MigratorHost.cs | 9 +- .../Pipeline/Robots/RobotsTxtMiddleware.cs | 9 +- .../Squidex/Pipeline/Squid/SquidMiddleware.cs | 6 +- backend/src/Squidex/Squidex.csproj | 54 ++--- backend/src/Squidex/Startup.cs | 9 +- .../HandleRules/ExpressionsAttribute.cs | 17 +- .../HandleRules/RuleTypeProviderTests.cs | 6 +- .../Operations/Scripting/MockupHttpHandler.cs | 8 +- .../ValidateContent/ReferencesFieldTests.cs | 9 +- .../ValidationTestExtensions.cs | 10 +- .../Validators/AllowedValuesValidatorTests.cs | 4 +- .../Squidex.Domain.Apps.Core.Tests.csproj | 12 +- .../Apps/AppPermanentDeleterTests.cs | 3 +- .../Apps/DomainObject/AppDomainObjectTests.cs | 6 +- .../Assets/MongoDb/AssetQueryTests.cs | 11 +- .../Billing/UsageGateTests.cs | 3 +- .../Contents/Indexes/CreateIndexJobTests.cs | 5 - .../Contents/Indexes/DropIndexJobTests.cs | 5 - .../Contents/MongoDb/ContentQueryTests.cs | 15 +- .../ContentsQueryDedicatedIntegrationTests.cs | 6 +- .../MongoDb/ContentsQueryIntegrationTests.cs | 6 +- .../MongoDb/ContentsQueryTestsBase.cs | 9 +- .../Contents/MongoDb/ExtensionsTests.cs | 5 +- .../Contents/Text/AtlasTextIndexTests.cs | 9 +- .../Contents/Text/AzureTextIndexTests.cs | 9 +- .../Text/ElasticSearchTextIndexTests.cs | 9 +- .../Contents/Text/MongoTextIndexTests.cs | 9 +- .../Text/MongoTextIndexerStateTests.cs | 9 +- .../Contents/Text/OpenSearchTextIndexTests.cs | 9 +- .../ArrayFieldPropertiesTests.cs | 2 +- .../DateTimeFieldPropertiesTests.cs | 2 +- .../Schemas/MongoDb/SchemasHashTests.cs | 9 +- .../Squidex.Domain.Apps.Entities.Tests.csproj | 16 +- .../TestHelpers/NoopAssetFile.cs | 6 +- .../TestHelpers/VerifySettings.cs | 9 +- .../Squidex.Domain.Users.Tests.csproj | 8 +- .../Collections/ReadonlyDictionaryTests.cs | 6 +- .../Collections/ReadonlyListTests.cs | 6 +- .../CustomCommandMiddlewareRunnerTests.cs | 9 +- .../Consume/EventConsumerProcessorTests.cs | 18 +- ...onsumerProcessorIntegrationTests_Direct.cs | 9 +- .../EventSourcing/GetEventStoreTests.cs | 9 +- .../EventSourcing/MongoEventStoreTests.cs | 21 +- .../EventSourcing/MongoParallelInsertTests.cs | 8 +- .../GravatarHelperTests.cs | 2 +- .../GuardTests.cs | 2 +- .../Http/DumpFormatterTests.cs | 2 +- .../MongoDb/MongoQueryTests.cs | 12 +- .../Squidex.Infrastructure.Tests.csproj | 12 +- .../States/ShardedServiceTests.cs | 7 +- .../TestHelpers/MyDomainObject.cs | 7 +- .../TestHelpers/MyEvent.cs | 2 +- .../ValidationExtensionsTests.cs | 2 +- .../IgnoreHashFileProviderTests.cs | 7 +- .../Squidex.Web.Tests.csproj | 8 +- .../shared/forms/assets-editor.component.html | 206 +++++++++--------- .../shared/forms/assets-editor.component.scss | 40 +--- .../shared/forms/assets-editor.component.ts | 4 +- .../shared/forms/field-editor.component.html | 2 +- .../references-editor.component.html | 89 ++++---- .../references-editor.component.scss | 27 +-- .../forms/editors/toggle.component.scss | 8 +- frontend/src/app/theme/_bootstrap.scss | 11 + tools/.editorconfig | 3 - .../TestSuite.ApiTests/AdminUsersTests.cs | 9 +- .../TestSuite.ApiTests/AnonymousTests.cs | 9 +- .../TestSuite.ApiTests/AppClientsTests.cs | 9 +- .../AppContributorsTests.cs | 9 +- .../TestSuite.ApiTests/AppCreationTests.cs | 9 +- .../TestSuite.ApiTests/AppLanguagesTests.cs | 9 +- .../TestSuite.ApiTests/AppRolesTests.cs | 9 +- .../TestSuite/TestSuite.ApiTests/AppTests.cs | 9 +- .../TestSuite.ApiTests/AppWorkflowsTests.cs | 9 +- .../TestSuite.ApiTests/AssetFoldersTests.cs | 9 +- .../TestSuite.ApiTests/AssetFormatTests.cs | 9 +- .../TestSuite.ApiTests/AssetScriptingTests.cs | 9 +- .../TestSuite.ApiTests/AssetTests.cs | 9 +- .../TestSuite.ApiTests/BackupTests.cs | 9 +- .../TestSuite/TestSuite.ApiTests/CDNTests.cs | 9 +- .../TestSuite.ApiTests/ContentCleanupTests.cs | 9 +- .../ContentCollationTests.cs | 9 +- .../ContentLanguageTests.cs | 9 +- .../TestSuite.ApiTests/ContentQueryTests.cs | 17 +- .../ContentReferencesTests.cs | 9 +- .../ContentScriptingTests.cs | 9 +- .../TestSuite.ApiTests/ContentUpdateTests.cs | 9 +- .../TestSuite.ApiTests/DiagnosticsTests.cs | 9 +- .../GraphQLSubscriptionTests.cs | 9 +- .../TestSuite.ApiTests/GraphQLTests.cs | 9 +- .../TestSuite.ApiTests/HistoryTests.cs | 9 +- .../TestSuite.ApiTests/LanguagesTests.cs | 9 +- .../TestSuite.ApiTests/OpenApiTests.cs | 9 +- .../TestSuite/TestSuite.ApiTests/PingTests.cs | 9 +- .../TestSuite.ApiTests/PlansTests.cs | 9 +- .../TestSuite.ApiTests/RuleEventsTests.cs | 9 +- .../TestSuite.ApiTests/RuleRunnerTests.cs | 13 +- .../TestSuite/TestSuite.ApiTests/RuleTests.cs | 9 +- .../TestSuite.ApiTests/SchemaTests.cs | 9 +- .../TestSuite.ApiTests/SearchTests.cs | 9 +- .../TestSuite.ApiTests/StatisticsTests.cs | 9 +- .../TeamContributorTests.cs | 9 +- .../TestSuite.ApiTests/TeamCreationTests.cs | 9 +- .../TestSuite.ApiTests/TeamStatisticsTests.cs | 9 +- .../TestSuite/TestSuite.ApiTests/TeamTests.cs | 9 +- .../TestSuite.LoadTests/ReadingBenchmarks.cs | 1 - .../Fixtures/TestSchemaFixtureBase.cs | 9 +- .../TestSchemaWithReferencesFixtureBase.cs | 9 +- .../TestSuite.Shared/Utils/PauseStream.cs | 14 +- 586 files changed, 1617 insertions(+), 5214 deletions(-) diff --git a/backend/.editorconfig b/backend/.editorconfig index facac6742b..bc6c6973b4 100644 --- a/backend/.editorconfig +++ b/backend/.editorconfig @@ -21,9 +21,6 @@ dotnet_diagnostic.RECS0117.severity = none dotnet_diagnostic.SA0001.severity = none dotnet_diagnostic.SA1649.severity = none -# IDE0290: Use primary constructor -dotnet_diagnostic.IDE0290.severity = none - # IDE0305: Simplify collection initialization dotnet_diagnostic.IDE0305.severity = none diff --git a/backend/extensions/Squidex.Extensions/APM/ApplicationInsights/ApplicationInsightsPlugin.cs b/backend/extensions/Squidex.Extensions/APM/ApplicationInsights/ApplicationInsightsPlugin.cs index 566faa477a..8ba2ebdb81 100644 --- a/backend/extensions/Squidex.Extensions/APM/ApplicationInsights/ApplicationInsightsPlugin.cs +++ b/backend/extensions/Squidex.Extensions/APM/ApplicationInsights/ApplicationInsightsPlugin.cs @@ -16,15 +16,8 @@ namespace Squidex.Extensions.APM.ApplicationInsights; public sealed class ApplicationInsightsPlugin : IPlugin { - private sealed class Configurator : ITelemetryConfigurator + private sealed class Configurator(IConfiguration config) : ITelemetryConfigurator { - private readonly IConfiguration config; - - public Configurator(IConfiguration config) - { - this.config = config; - } - public void Configure(TracerProviderBuilder builder) { builder.AddAzureMonitorTraceExporter(options => diff --git a/backend/extensions/Squidex.Extensions/APM/Otlp/OtlpPlugin.cs b/backend/extensions/Squidex.Extensions/APM/Otlp/OtlpPlugin.cs index b400aa9997..d0b9f951da 100644 --- a/backend/extensions/Squidex.Extensions/APM/Otlp/OtlpPlugin.cs +++ b/backend/extensions/Squidex.Extensions/APM/Otlp/OtlpPlugin.cs @@ -17,15 +17,8 @@ namespace Squidex.Extensions.APM.Otlp; public sealed class OtlpPlugin : IPlugin { - private sealed class Configurator : ITelemetryConfigurator + private sealed class Configurator(IConfiguration config) : ITelemetryConfigurator { - private readonly IConfiguration config; - - public Configurator(IConfiguration config) - { - this.config = config; - } - public void Configure(TracerProviderBuilder builder) { builder.AddOtlpExporter(options => diff --git a/backend/extensions/Squidex.Extensions/APM/Stackdriver/StackdriverExceptionHandler.cs b/backend/extensions/Squidex.Extensions/APM/Stackdriver/StackdriverExceptionHandler.cs index 237f601ab2..d237d593a6 100644 --- a/backend/extensions/Squidex.Extensions/APM/Stackdriver/StackdriverExceptionHandler.cs +++ b/backend/extensions/Squidex.Extensions/APM/Stackdriver/StackdriverExceptionHandler.cs @@ -13,10 +13,9 @@ namespace Squidex.Extensions.APM.Stackdriver; -internal sealed class StackdriverExceptionHandler : ILogAppender +internal sealed class StackdriverExceptionHandler(IContextExceptionLogger logger, IHttpContextAccessor httpContextAccessor) : ILogAppender { - private readonly IContextExceptionLogger logger; - private readonly HttpContextWrapper httpContextWrapper; + private readonly HttpContextWrapper httpContextWrapper = new HttpContextWrapper(httpContextAccessor); public sealed class HttpContextWrapper : IContextWrapper { @@ -43,13 +42,6 @@ public string GetUserAgent() } } - public StackdriverExceptionHandler(IContextExceptionLogger logger, IHttpContextAccessor httpContextAccessor) - { - this.logger = logger; - - httpContextWrapper = new HttpContextWrapper(httpContextAccessor); - } - public void Append(IObjectWriter writer, SemanticLogLevel logLevel, Exception? exception) { try diff --git a/backend/extensions/Squidex.Extensions/APM/Stackdriver/StackdriverPlugin.cs b/backend/extensions/Squidex.Extensions/APM/Stackdriver/StackdriverPlugin.cs index c12e1d1cfa..956f993ab2 100644 --- a/backend/extensions/Squidex.Extensions/APM/Stackdriver/StackdriverPlugin.cs +++ b/backend/extensions/Squidex.Extensions/APM/Stackdriver/StackdriverPlugin.cs @@ -18,15 +18,8 @@ namespace Squidex.Extensions.APM.Stackdriver; public sealed class StackdriverPlugin : IPlugin { - private sealed class Configurator : ITelemetryConfigurator + private sealed class Configurator(string projectId) : ITelemetryConfigurator { - private readonly string projectId; - - public Configurator(string projectId) - { - this.projectId = projectId; - } - public void Configure(TracerProviderBuilder builder) { builder.UseStackdriverExporter(projectId); diff --git a/backend/extensions/Squidex.Extensions/APM/Zipkin/ZipkinPlugin.cs b/backend/extensions/Squidex.Extensions/APM/Zipkin/ZipkinPlugin.cs index e94073116d..a63fce9d46 100644 --- a/backend/extensions/Squidex.Extensions/APM/Zipkin/ZipkinPlugin.cs +++ b/backend/extensions/Squidex.Extensions/APM/Zipkin/ZipkinPlugin.cs @@ -15,15 +15,8 @@ namespace Squidex.Extensions.APM.Zipkin; public sealed class ZipkinPlugin : IPlugin { - private sealed class Configurator : ITelemetryConfigurator + private sealed class Configurator(IConfiguration config) : ITelemetryConfigurator { - private readonly IConfiguration config; - - public Configurator(IConfiguration config) - { - this.config = config; - } - public void Configure(TracerProviderBuilder builder) { builder.AddZipkinExporter(options => diff --git a/backend/extensions/Squidex.Extensions/Actions/Algolia/AlgoliaActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/Algolia/AlgoliaActionHandler.cs index cdc921c18d..7cd9c61113 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Algolia/AlgoliaActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Algolia/AlgoliaActionHandler.cs @@ -18,26 +18,15 @@ namespace Squidex.Extensions.Actions.Algolia; -public sealed class AlgoliaActionHandler : RuleActionHandler +public sealed class AlgoliaActionHandler(RuleEventFormatter formatter, IScriptEngine scriptEngine, IJsonSerializer serializer) : RuleActionHandler(formatter) { - private readonly ClientPool<(string AppId, string ApiKey, string IndexName), ISearchIndex> clients; - private readonly IScriptEngine scriptEngine; - private readonly IJsonSerializer serializer; - - public AlgoliaActionHandler(RuleEventFormatter formatter, IScriptEngine scriptEngine, IJsonSerializer serializer) - : base(formatter) - { - clients = new ClientPool<(string AppId, string ApiKey, string IndexName), ISearchIndex>(key => + private readonly ClientPool<(string AppId, string ApiKey, string IndexName), ISearchIndex> clients = new ClientPool<(string AppId, string ApiKey, string IndexName), ISearchIndex>(key => { var client = new SearchClient(key.AppId, key.ApiKey); return client.InitIndex(key.IndexName); }); - this.scriptEngine = scriptEngine; - this.serializer = serializer; - } - protected override async Task<(string Description, AlgoliaJob Data)> CreateJobAsync(EnrichedEvent @event, AlgoliaAction action) { if (@event is not IEnrichedEntityEvent entityEvent) diff --git a/backend/extensions/Squidex.Extensions/Actions/AzureQueue/AzureQueueActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/AzureQueue/AzureQueueActionHandler.cs index 1db8b7f28b..a25304ff0a 100644 --- a/backend/extensions/Squidex.Extensions/Actions/AzureQueue/AzureQueueActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/AzureQueue/AzureQueueActionHandler.cs @@ -14,14 +14,9 @@ namespace Squidex.Extensions.Actions.AzureQueue; -public sealed class AzureQueueActionHandler : RuleActionHandler +public sealed class AzureQueueActionHandler(RuleEventFormatter formatter) : RuleActionHandler(formatter) { - private readonly ClientPool<(string ConnectionString, string QueueName), CloudQueue> clients; - - public AzureQueueActionHandler(RuleEventFormatter formatter) - : base(formatter) - { - clients = new ClientPool<(string ConnectionString, string QueueName), CloudQueue>(key => + private readonly ClientPool<(string ConnectionString, string QueueName), CloudQueue> clients = new ClientPool<(string ConnectionString, string QueueName), CloudQueue>(key => { var storageAccount = CloudStorageAccount.Parse(key.ConnectionString); @@ -30,7 +25,6 @@ public AzureQueueActionHandler(RuleEventFormatter formatter) return queueRef; }); - } protected override async Task<(string Description, AzureQueueJob Data)> CreateJobAsync(EnrichedEvent @event, AzureQueueAction action) { diff --git a/backend/extensions/Squidex.Extensions/Actions/Comment/CommentActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/Comment/CommentActionHandler.cs index 8e785b1349..76b40369b5 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Comment/CommentActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Comment/CommentActionHandler.cs @@ -13,16 +13,9 @@ namespace Squidex.Extensions.Actions.Comment; -public sealed class CommentActionHandler : RuleActionHandler +public sealed class CommentActionHandler(RuleEventFormatter formatter, ICollaborationService collaboration) : RuleActionHandler(formatter) { private const string Description = "Send a Comment"; - private readonly ICollaborationService collaboration; - - public CommentActionHandler(RuleEventFormatter formatter, ICollaborationService collaboration) - : base(formatter) - { - this.collaboration = collaboration; - } protected override async Task<(string Description, CommentCreated Data)> CreateJobAsync(EnrichedEvent @event, CommentAction action) { diff --git a/backend/extensions/Squidex.Extensions/Actions/CreateContent/CreateContentActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/CreateContent/CreateContentActionHandler.cs index da138cf5bc..58e9fcc4aa 100644 --- a/backend/extensions/Squidex.Extensions/Actions/CreateContent/CreateContentActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/CreateContent/CreateContentActionHandler.cs @@ -17,20 +17,9 @@ namespace Squidex.Extensions.Actions.CreateContent; -public sealed class CreateContentActionHandler : RuleActionHandler +public sealed class CreateContentActionHandler(RuleEventFormatter formatter, IAppProvider appProvider, ICommandBus commandBus, IJsonSerializer jsonSerializer) : RuleActionHandler(formatter) { private const string Description = "Create a content"; - private readonly ICommandBus commandBus; - private readonly IAppProvider appProvider; - private readonly IJsonSerializer jsonSerializer; - - public CreateContentActionHandler(RuleEventFormatter formatter, IAppProvider appProvider, ICommandBus commandBus, IJsonSerializer jsonSerializer) - : base(formatter) - { - this.appProvider = appProvider; - this.commandBus = commandBus; - this.jsonSerializer = jsonSerializer; - } protected override async Task<(string Description, Command Data)> CreateJobAsync(EnrichedEvent @event, CreateContentAction action) { diff --git a/backend/extensions/Squidex.Extensions/Actions/DeepDetect/DeepDetectActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/DeepDetect/DeepDetectActionHandler.cs index 812fc4ee0b..dafbb4427e 100644 --- a/backend/extensions/Squidex.Extensions/Actions/DeepDetect/DeepDetectActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/DeepDetect/DeepDetectActionHandler.cs @@ -23,31 +23,17 @@ namespace Squidex.Extensions.Actions.DeepDetect; #pragma warning disable MA0048 // File name must match type name -internal sealed partial class DeepDetectActionHandler : RuleActionHandler +internal sealed partial class DeepDetectActionHandler( + RuleEventFormatter formatter, + IHttpClientFactory httpClientFactory, + IJsonSerializer jsonSerializer, + IAppProvider appProvider, + IAssetQueryService assetQuery, + ICommandBus commandBus, + IUrlGenerator urlGenerator) + : RuleActionHandler(formatter) { private const string Description = "Analyze Image"; - private readonly IHttpClientFactory httpClientFactory; - private readonly IJsonSerializer jsonSerializer; - private readonly IAppProvider appProvider; - private readonly IAssetQueryService assetQuery; - private readonly ICommandBus commandBus; - private readonly IUrlGenerator urlGenerator; - - public DeepDetectActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory, - IJsonSerializer jsonSerializer, - IAppProvider appProvider, - IAssetQueryService assetQuery, - ICommandBus commandBus, - IUrlGenerator urlGenerator) - : base(formatter) - { - this.httpClientFactory = httpClientFactory; - this.jsonSerializer = jsonSerializer; - this.appProvider = appProvider; - this.assetQuery = assetQuery; - this.commandBus = commandBus; - this.urlGenerator = urlGenerator; - } protected override Task<(string Description, DeepDetectJob Data)> CreateJobAsync(EnrichedEvent @event, DeepDetectAction action) { diff --git a/backend/extensions/Squidex.Extensions/Actions/Discourse/DiscourseActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/Discourse/DiscourseActionHandler.cs index 8e75a40b68..be0ba97244 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Discourse/DiscourseActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Discourse/DiscourseActionHandler.cs @@ -13,19 +13,11 @@ namespace Squidex.Extensions.Actions.Discourse; -public sealed class DiscourseActionHandler : RuleActionHandler +public sealed class DiscourseActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory) : RuleActionHandler(formatter) { private const string DescriptionCreatePost = "Create discourse Post"; private const string DescriptionCreateTopic = "Create discourse Topic"; - private readonly IHttpClientFactory httpClientFactory; - - public DiscourseActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory) - : base(formatter) - { - this.httpClientFactory = httpClientFactory; - } - protected override async Task<(string Description, DiscourseJob Data)> CreateJobAsync(EnrichedEvent @event, DiscourseAction action) { var url = $"{action.Url.ToString().TrimEnd('/')}/posts.json?api_key={action.ApiKey}&api_username={action.ApiUsername}"; diff --git a/backend/extensions/Squidex.Extensions/Actions/ElasticSearch/ElasticSearchActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/ElasticSearch/ElasticSearchActionHandler.cs index 7e626b69d6..5309b6bfab 100644 --- a/backend/extensions/Squidex.Extensions/Actions/ElasticSearch/ElasticSearchActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/ElasticSearch/ElasticSearchActionHandler.cs @@ -18,16 +18,9 @@ namespace Squidex.Extensions.Actions.ElasticSearch; -public sealed class ElasticSearchActionHandler : RuleActionHandler +public sealed class ElasticSearchActionHandler(RuleEventFormatter formatter, IScriptEngine scriptEngine, IJsonSerializer serializer) : RuleActionHandler(formatter) { - private readonly ClientPool<(Uri Host, string? Username, string? Password), ElasticLowLevelClient> clients; - private readonly IScriptEngine scriptEngine; - private readonly IJsonSerializer serializer; - - public ElasticSearchActionHandler(RuleEventFormatter formatter, IScriptEngine scriptEngine, IJsonSerializer serializer) - : base(formatter) - { - clients = new ClientPool<(Uri Host, string? Username, string? Password), ElasticLowLevelClient>(key => + private readonly ClientPool<(Uri Host, string? Username, string? Password), ElasticLowLevelClient> clients = new ClientPool<(Uri Host, string? Username, string? Password), ElasticLowLevelClient>(key => { var config = new ConnectionConfiguration(key.Host); @@ -39,10 +32,6 @@ public ElasticSearchActionHandler(RuleEventFormatter formatter, IScriptEngine sc return new ElasticLowLevelClient(config); }); - this.scriptEngine = scriptEngine; - this.serializer = serializer; - } - protected override async Task<(string Description, ElasticSearchJob Data)> CreateJobAsync(EnrichedEvent @event, ElasticSearchAction action) { var delete = @event.ShouldDelete(scriptEngine, action.Delete); diff --git a/backend/extensions/Squidex.Extensions/Actions/Email/EmailActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/Email/EmailActionHandler.cs index bfc600cdfc..05ed162964 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Email/EmailActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Email/EmailActionHandler.cs @@ -15,13 +15,8 @@ namespace Squidex.Extensions.Actions.Email; -public sealed class EmailActionHandler : RuleActionHandler +public sealed class EmailActionHandler(RuleEventFormatter formatter) : RuleActionHandler(formatter) { - public EmailActionHandler(RuleEventFormatter formatter) - : base(formatter) - { - } - protected override async Task<(string Description, EmailJob Data)> CreateJobAsync(EnrichedEvent @event, EmailAction action) { var ruleJob = new EmailJob diff --git a/backend/extensions/Squidex.Extensions/Actions/Fastly/FastlyActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/Fastly/FastlyActionHandler.cs index c1ec23a400..1996542dd1 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Fastly/FastlyActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Fastly/FastlyActionHandler.cs @@ -13,18 +13,10 @@ namespace Squidex.Extensions.Actions.Fastly; -public sealed class FastlyActionHandler : RuleActionHandler +public sealed class FastlyActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory) : RuleActionHandler(formatter) { private const string Description = "Purge key in fastly"; - private readonly IHttpClientFactory httpClientFactory; - - public FastlyActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory) - : base(formatter) - { - this.httpClientFactory = httpClientFactory; - } - protected override (string Description, FastlyJob Data) CreateJob(EnrichedEvent @event, FastlyAction action) { var id = string.Empty; diff --git a/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaActionHandler.cs index f906b98473..86c634b7ff 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaActionHandler.cs @@ -12,16 +12,9 @@ namespace Squidex.Extensions.Actions.Kafka; -public sealed class KafkaActionHandler : RuleActionHandler +public sealed class KafkaActionHandler(RuleEventFormatter formatter, KafkaProducer kafkaProducer) : RuleActionHandler(formatter) { private const string Description = "Push to Kafka"; - private readonly KafkaProducer kafkaProducer; - - public KafkaActionHandler(RuleEventFormatter formatter, KafkaProducer kafkaProducer) - : base(formatter) - { - this.kafkaProducer = kafkaProducer; - } protected override async Task<(string Description, KafkaJob Data)> CreateJobAsync(EnrichedEvent @event, KafkaAction action) { diff --git a/backend/extensions/Squidex.Extensions/Actions/Medium/MediumActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/Medium/MediumActionHandler.cs index 225939b9e4..9efc5a8456 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Medium/MediumActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Medium/MediumActionHandler.cs @@ -15,13 +15,10 @@ namespace Squidex.Extensions.Actions.Medium; -public sealed class MediumActionHandler : RuleActionHandler +public sealed class MediumActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory, IJsonSerializer serializer) : RuleActionHandler(formatter) { private const string Description = "Post to medium"; - private readonly IHttpClientFactory httpClientFactory; - private readonly IJsonSerializer serializer; - private sealed class UserResponse { public UserResponseData Data { get; set; } @@ -32,14 +29,6 @@ private sealed class UserResponseData public string Id { get; set; } } - public MediumActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory, IJsonSerializer serializer) - : base(formatter) - { - this.httpClientFactory = httpClientFactory; - - this.serializer = serializer; - } - protected override async Task<(string Description, MediumJob Data)> CreateJobAsync(EnrichedEvent @event, MediumAction action) { var ruleJob = new MediumJob { AccessToken = action.AccessToken, PublicationId = action.PublicationId }; diff --git a/backend/extensions/Squidex.Extensions/Actions/Notification/NotificationActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/Notification/NotificationActionHandler.cs index e9b3ef8389..f3f1f6f3cb 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Notification/NotificationActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Notification/NotificationActionHandler.cs @@ -14,18 +14,9 @@ namespace Squidex.Extensions.Actions.Notification; -public sealed class NotificationActionHandler : RuleActionHandler +public sealed class NotificationActionHandler(RuleEventFormatter formatter, ICollaborationService collaboration, IUserResolver userResolver) : RuleActionHandler(formatter) { private const string Description = "Send a Notification"; - private readonly ICollaborationService collaboration; - private readonly IUserResolver userResolver; - - public NotificationActionHandler(RuleEventFormatter formatter, ICollaborationService collaboration, IUserResolver userResolver) - : base(formatter) - { - this.collaboration = collaboration; - this.userResolver = userResolver; - } protected override async Task<(string Description, CommentCreated Data)> CreateJobAsync(EnrichedEvent @event, NotificationAction action) { diff --git a/backend/extensions/Squidex.Extensions/Actions/OpenSearch/OpenSearchActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/OpenSearch/OpenSearchActionHandler.cs index 4158748fe2..46411e2332 100644 --- a/backend/extensions/Squidex.Extensions/Actions/OpenSearch/OpenSearchActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/OpenSearch/OpenSearchActionHandler.cs @@ -18,16 +18,9 @@ namespace Squidex.Extensions.Actions.OpenSearch; -public sealed class OpenSearchActionHandler : RuleActionHandler +public sealed class OpenSearchActionHandler(RuleEventFormatter formatter, IScriptEngine scriptEngine, IJsonSerializer serializer) : RuleActionHandler(formatter) { - private readonly ClientPool<(Uri Host, string? Username, string? Password), OpenSearchLowLevelClient> clients; - private readonly IScriptEngine scriptEngine; - private readonly IJsonSerializer serializer; - - public OpenSearchActionHandler(RuleEventFormatter formatter, IScriptEngine scriptEngine, IJsonSerializer serializer) - : base(formatter) - { - clients = new ClientPool<(Uri Host, string? Username, string? Password), OpenSearchLowLevelClient>(key => + private readonly ClientPool<(Uri Host, string? Username, string? Password), OpenSearchLowLevelClient> clients = new ClientPool<(Uri Host, string? Username, string? Password), OpenSearchLowLevelClient>(key => { var config = new ConnectionConfiguration(key.Host); @@ -39,10 +32,6 @@ public OpenSearchActionHandler(RuleEventFormatter formatter, IScriptEngine scrip return new OpenSearchLowLevelClient(config); }); - this.scriptEngine = scriptEngine; - this.serializer = serializer; - } - protected override async Task<(string Description, OpenSearchJob Data)> CreateJobAsync(EnrichedEvent @event, OpenSearchAction action) { var delete = @event.ShouldDelete(scriptEngine, action.Delete); diff --git a/backend/extensions/Squidex.Extensions/Actions/Prerender/PrerenderActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/Prerender/PrerenderActionHandler.cs index 5ac0c33575..f3dd7c652d 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Prerender/PrerenderActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Prerender/PrerenderActionHandler.cs @@ -13,16 +13,8 @@ namespace Squidex.Extensions.Actions.Prerender; -public sealed class PrerenderActionHandler : RuleActionHandler +public sealed class PrerenderActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory) : RuleActionHandler(formatter) { - private readonly IHttpClientFactory httpClientFactory; - - public PrerenderActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory) - : base(formatter) - { - this.httpClientFactory = httpClientFactory; - } - protected override async Task<(string Description, PrerenderJob Data)> CreateJobAsync(EnrichedEvent @event, PrerenderAction action) { var url = await FormatAsync(action.Url, @event); diff --git a/backend/extensions/Squidex.Extensions/Actions/Script/ScriptActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/Script/ScriptActionHandler.cs index 02056a3f2a..cb3c9811d0 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Script/ScriptActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Script/ScriptActionHandler.cs @@ -16,16 +16,8 @@ namespace Squidex.Extensions.Actions.Script; -public sealed class ScriptActionHandler : RuleActionHandler +public sealed class ScriptActionHandler(RuleEventFormatter formatter, IScriptEngine scriptEngine) : RuleActionHandler(formatter) { - private readonly IScriptEngine scriptEngine; - - public ScriptActionHandler(RuleEventFormatter formatter, IScriptEngine scriptEngine) - : base(formatter) - { - this.scriptEngine = scriptEngine; - } - protected override Task<(string Description, ScriptJob Data)> CreateJobAsync(EnrichedEvent @event, ScriptAction action) { var job = new ScriptJob { Script = action.Script, Event = @event }; diff --git a/backend/extensions/Squidex.Extensions/Actions/SignalR/SignalRActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/SignalR/SignalRActionHandler.cs index 6c82f86f73..7a4fe446b0 100644 --- a/backend/extensions/Squidex.Extensions/Actions/SignalR/SignalRActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/SignalR/SignalRActionHandler.cs @@ -14,14 +14,9 @@ namespace Squidex.Extensions.Actions.SignalR; -public sealed class SignalRActionHandler : RuleActionHandler +public sealed class SignalRActionHandler(RuleEventFormatter formatter) : RuleActionHandler(formatter) { - private readonly ClientPool<(string ConnectionString, string HubName), ServiceManager> clients; - - public SignalRActionHandler(RuleEventFormatter formatter) - : base(formatter) - { - clients = new ClientPool<(string ConnectionString, string HubName), ServiceManager>(key => + private readonly ClientPool<(string ConnectionString, string HubName), ServiceManager> clients = new ClientPool<(string ConnectionString, string HubName), ServiceManager>(key => { var serviceManager = new ServiceManagerBuilder() .WithOptions(option => @@ -33,7 +28,6 @@ public SignalRActionHandler(RuleEventFormatter formatter) return serviceManager; }); - } protected override async Task<(string Description, SignalRJob Data)> CreateJobAsync(EnrichedEvent @event, SignalRAction action) { diff --git a/backend/extensions/Squidex.Extensions/Actions/Slack/SlackActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/Slack/SlackActionHandler.cs index 76305e5340..28cf31021f 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Slack/SlackActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Slack/SlackActionHandler.cs @@ -13,18 +13,10 @@ namespace Squidex.Extensions.Actions.Slack; -public sealed class SlackActionHandler : RuleActionHandler +public sealed class SlackActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory) : RuleActionHandler(formatter) { private const string Description = "Send message to slack"; - private readonly IHttpClientFactory httpClientFactory; - - public SlackActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory) - : base(formatter) - { - this.httpClientFactory = httpClientFactory; - } - protected override async Task<(string Description, SlackJob Data)> CreateJobAsync(EnrichedEvent @event, SlackAction action) { var body = new { text = await FormatAsync(action.Text, @event) }; diff --git a/backend/extensions/Squidex.Extensions/Actions/Twitter/TweetActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/Twitter/TweetActionHandler.cs index e5fdd1ec40..b09d29c237 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Twitter/TweetActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Twitter/TweetActionHandler.cs @@ -14,17 +14,11 @@ namespace Squidex.Extensions.Actions.Twitter; -public sealed class TweetActionHandler : RuleActionHandler +public sealed class TweetActionHandler(RuleEventFormatter formatter, IOptions twitterOptions) : RuleActionHandler(formatter) { private const string Description = "Send a tweet"; - private readonly TwitterOptions twitterOptions; - - public TweetActionHandler(RuleEventFormatter formatter, IOptions twitterOptions) - : base(formatter) - { - this.twitterOptions = twitterOptions.Value; - } + private readonly TwitterOptions twitterOptions = twitterOptions.Value; protected override async Task<(string Description, TweetJob Data)> CreateJobAsync(EnrichedEvent @event, TweetAction action) { diff --git a/backend/extensions/Squidex.Extensions/Actions/Typesense/TypesenseActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/Typesense/TypesenseActionHandler.cs index 3fc0a93c42..fba703bd3a 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Typesense/TypesenseActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Typesense/TypesenseActionHandler.cs @@ -18,20 +18,8 @@ namespace Squidex.Extensions.Actions.Typesense; -public sealed class TypesenseActionHandler : RuleActionHandler +public sealed class TypesenseActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory, IScriptEngine scriptEngine, IJsonSerializer serializer) : RuleActionHandler(formatter) { - private readonly IScriptEngine scriptEngine; - private readonly IHttpClientFactory httpClientFactory; - private readonly IJsonSerializer serializer; - - public TypesenseActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory, IScriptEngine scriptEngine, IJsonSerializer serializer) - : base(formatter) - { - this.scriptEngine = scriptEngine; - this.httpClientFactory = httpClientFactory; - this.serializer = serializer; - } - protected override async Task<(string Description, TypesenseJob Data)> CreateJobAsync(EnrichedEvent @event, TypesenseAction action) { var delete = @event.ShouldDelete(scriptEngine, action.Delete); diff --git a/backend/extensions/Squidex.Extensions/Actions/Webhook/WebhookActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/Webhook/WebhookActionHandler.cs index 32eacca292..f1a88d7351 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Webhook/WebhookActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Webhook/WebhookActionHandler.cs @@ -14,16 +14,8 @@ namespace Squidex.Extensions.Actions.Webhook; -public sealed class WebhookActionHandler : RuleActionHandler +public sealed class WebhookActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory) : RuleActionHandler(formatter) { - private readonly IHttpClientFactory httpClientFactory; - - public WebhookActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory) - : base(formatter) - { - this.httpClientFactory = httpClientFactory; - } - protected override async Task<(string Description, WebhookJob Data)> CreateJobAsync(EnrichedEvent @event, WebhookAction action) { var requestUrl = await FormatAsync(action.Url, @event); diff --git a/backend/extensions/Squidex.Extensions/Samples/Controllers/PluginController.cs b/backend/extensions/Squidex.Extensions/Samples/Controllers/PluginController.cs index 57219606cc..d1aec9b0f8 100644 --- a/backend/extensions/Squidex.Extensions/Samples/Controllers/PluginController.cs +++ b/backend/extensions/Squidex.Extensions/Samples/Controllers/PluginController.cs @@ -11,13 +11,8 @@ namespace Squidex.Extensions.Samples.Controllers; -public sealed class PluginController : ApiController +public sealed class PluginController(ICommandBus commandBus) : ApiController(commandBus) { - public PluginController(ICommandBus commandBus) - : base(commandBus) - { - } - [Route("plugins/sample")] public IActionResult Test() { diff --git a/backend/extensions/Squidex.Extensions/Samples/Middleware/DoubleLinkedContentMiddleware.cs b/backend/extensions/Squidex.Extensions/Samples/Middleware/DoubleLinkedContentMiddleware.cs index f784dfdf0e..fe9147103c 100644 --- a/backend/extensions/Squidex.Extensions/Samples/Middleware/DoubleLinkedContentMiddleware.cs +++ b/backend/extensions/Squidex.Extensions/Samples/Middleware/DoubleLinkedContentMiddleware.cs @@ -14,15 +14,8 @@ namespace Squidex.Extensions.Samples.Middleware; -public sealed class DoubleLinkedContentMiddleware : ICustomCommandMiddleware +public sealed class DoubleLinkedContentMiddleware(IContentLoader contentLoader) : ICustomCommandMiddleware { - private readonly IContentLoader contentLoader; - - public DoubleLinkedContentMiddleware(IContentLoader contentLoader) - { - this.contentLoader = contentLoader; - } - public async Task HandleAsync(CommandContext context, NextDelegate next, CancellationToken ct) { diff --git a/backend/extensions/Squidex.Extensions/Squidex.Extensions.csproj b/backend/extensions/Squidex.Extensions/Squidex.Extensions.csproj index 745a60da08..92331a942c 100644 --- a/backend/extensions/Squidex.Extensions/Squidex.Extensions.csproj +++ b/backend/extensions/Squidex.Extensions/Squidex.Extensions.csproj @@ -13,23 +13,23 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - + + + + + + diff --git a/backend/extensions/Squidex.Extensions/Text/ElasticSearch/ElasticSearchTextIndex.cs b/backend/extensions/Squidex.Extensions/Text/ElasticSearch/ElasticSearchTextIndex.cs index d0538a1c08..8233a7da2d 100644 --- a/backend/extensions/Squidex.Extensions/Text/ElasticSearch/ElasticSearchTextIndex.cs +++ b/backend/extensions/Squidex.Extensions/Text/ElasticSearch/ElasticSearchTextIndex.cs @@ -15,21 +15,11 @@ namespace Squidex.Extensions.Text.ElasticSearch; -public sealed partial class ElasticSearchTextIndex : ITextIndex, IInitializable +public sealed partial class ElasticSearchTextIndex(IElasticSearchClient elasticClient, string indexName, IJsonSerializer jsonSerializer) : ITextIndex, IInitializable { private static readonly Regex RegexLanguageNormal = BuildLanguageRegexNormal(); private static readonly Regex RegexLanguageStart = BuildLanguageRegexStart(); - private readonly IJsonSerializer jsonSerializer; - private readonly IElasticSearchClient elasticClient; private readonly QueryParser queryParser = new QueryParser(ElasticSearchIndexDefinition.GetFieldPath); - private readonly string indexName; - - public ElasticSearchTextIndex(IElasticSearchClient elasticClient, string indexName, IJsonSerializer jsonSerializer) - { - this.elasticClient = elasticClient; - this.indexName = indexName; - this.jsonSerializer = jsonSerializer; - } public Task InitializeAsync( CancellationToken ct) @@ -217,7 +207,7 @@ private async Task> SearchAsync(object query, foreach (var item in hits) { - ids.Add(DomainId.Create(item["_source"]["contentId"])); + ids.Add(DomainId.Create(item["_source"]["contentId"])); } return ids; diff --git a/backend/extensions/Squidex.Extensions/Validation/CompositeUniqueValidator.cs b/backend/extensions/Squidex.Extensions/Validation/CompositeUniqueValidator.cs index eb952b9bab..8df1f471e0 100644 --- a/backend/extensions/Squidex.Extensions/Validation/CompositeUniqueValidator.cs +++ b/backend/extensions/Squidex.Extensions/Validation/CompositeUniqueValidator.cs @@ -16,17 +16,8 @@ namespace Squidex.Extensions.Validation; -internal sealed class CompositeUniqueValidator : IValidator +internal sealed class CompositeUniqueValidator(string contentTag, IContentRepository contentRepository) : IValidator { - private readonly string contentTag; - private readonly IContentRepository contentRepository; - - public CompositeUniqueValidator(string contentTag, IContentRepository contentRepository) - { - this.contentTag = contentTag; - this.contentRepository = contentRepository; - } - public void Validate(object? value, ValidationContext context) { if (value is ContentData data) diff --git a/backend/extensions/Squidex.Extensions/Validation/CompositeUniqueValidatorFactory.cs b/backend/extensions/Squidex.Extensions/Validation/CompositeUniqueValidatorFactory.cs index f46b569ed7..6e3a42dd29 100644 --- a/backend/extensions/Squidex.Extensions/Validation/CompositeUniqueValidatorFactory.cs +++ b/backend/extensions/Squidex.Extensions/Validation/CompositeUniqueValidatorFactory.cs @@ -10,15 +10,9 @@ namespace Squidex.Extensions.Validation; -public sealed class CompositeUniqueValidatorFactory : IValidatorsFactory +public sealed class CompositeUniqueValidatorFactory(IContentRepository contentRepository) : IValidatorsFactory { private const string Prefix = "unique:"; - private readonly IContentRepository contentRepository; - - public CompositeUniqueValidatorFactory(IContentRepository contentRepository) - { - this.contentRepository = contentRepository; - } public IEnumerable CreateContentValidators(ValidationContext context, ValidatorFactory createFieldValidator) { diff --git a/backend/i18n/frontend_en.json b/backend/i18n/frontend_en.json index cd71c08816..5489001582 100644 --- a/backend/i18n/frontend_en.json +++ b/backend/i18n/frontend_en.json @@ -422,7 +422,8 @@ "contents.arrayMoveTop": "Move this item to top", "contents.arrayMoveUp": "Move this item up", "contents.arrayNoFields": "Add a nested field first to add items.", - "contents.assetsUpload": "Drop files or click", + "contents.assetsSelect": "Select existing Asset", + "contents.assetsUpload": "Upload new Asset", "contents.autotranslate": "Autotranslate from master language", "contents.bulkFailed": "Failed to delete or update content. Please reload.", "contents.calendar": "Scheduled Contents", @@ -479,11 +480,11 @@ "contents.pendingChangesTextToPreview": "You have unsaved changes.\n\nYou will not see them on preview.\n\n**Do you want to continue anyway?**", "contents.pendingChangesTitle": "Unsaved changes", "contents.publishAll": "Publish All", - "contents.referencesCreateNew": "Add New", + "contents.referencesCreateNew": "Add new Content", "contents.referencesCreatePublish": "Create and Publish", "contents.referencesLink": "Link selected contents ({count})", "contents.referencesNoSchema": "No Schema", - "contents.referencesSelectExisting": "Select Existing", + "contents.referencesSelectExisting": "Select existing Content", "contents.referencesSelectSchema": "Select {schema}", "contents.refreshTooltip": "Refresh Contents", "contents.reloaded": "Contents reloaded.", diff --git a/backend/i18n/frontend_fr.json b/backend/i18n/frontend_fr.json index ffb7085007..8ddc7fd065 100644 --- a/backend/i18n/frontend_fr.json +++ b/backend/i18n/frontend_fr.json @@ -422,6 +422,7 @@ "contents.arrayMoveTop": "Déplacer cet élément vers le haut", "contents.arrayMoveUp": "Déplacez cet élément vers le haut", "contents.arrayNoFields": "Ajoutez d'abord un champ imbriqué pour ajouter des éléments.", + "contents.assetsSelect": "Select existing Asset", "contents.assetsUpload": "Déposez des fichiers ou cliquez sur", "contents.autotranslate": "Traduire automatiquement à partir de la langue principale", "contents.bulkFailed": "Échec de la suppression ou de la mise à jour du contenu. Veuillez recharger.", diff --git a/backend/i18n/frontend_it.json b/backend/i18n/frontend_it.json index 6d6e7dbe49..35f0de45fd 100644 --- a/backend/i18n/frontend_it.json +++ b/backend/i18n/frontend_it.json @@ -422,6 +422,7 @@ "contents.arrayMoveTop": "Sposta in cima questo elemento", "contents.arrayMoveUp": "Sposta su questo elemento", "contents.arrayNoFields": "Aggiungi un primo campo annidato agli elementi.", + "contents.assetsSelect": "Select existing Asset", "contents.assetsUpload": "Trascina i file o clicca", "contents.autotranslate": "Traduci in automatico dalla lingua principale", "contents.bulkFailed": "Non è stato possibile eliminare il contenuto. Per favore ricarica.", diff --git a/backend/i18n/frontend_nl.json b/backend/i18n/frontend_nl.json index 55ad54fea5..28b2e13f90 100644 --- a/backend/i18n/frontend_nl.json +++ b/backend/i18n/frontend_nl.json @@ -422,6 +422,7 @@ "contents.arrayMoveTop": "Verplaats dit item naar boven", "contents.arrayMoveUp": "Verplaats dit item omhoog", "contents.arrayNoFields": "Voeg eerst een genest veld toe om items toe te voegen.", + "contents.assetsSelect": "Select existing Asset", "contents.assetsUpload": "Zet bestanden neer of klik", "contents.autotranslate": "Automatisch vertalen vanuit de hoofdtaal", "contents.bulkFailed": "Verwijderen van inhoud is mislukt. Laad opnieuw.", diff --git a/backend/i18n/frontend_pt.json b/backend/i18n/frontend_pt.json index 85cfebc072..5558e0acbe 100644 --- a/backend/i18n/frontend_pt.json +++ b/backend/i18n/frontend_pt.json @@ -422,6 +422,7 @@ "contents.arrayMoveTop": "Mova este item para cima", "contents.arrayMoveUp": "Mova este item para cima", "contents.arrayNoFields": "Adicione primeiro um campo aninhado para adicionar itens.", + "contents.assetsSelect": "Select existing Asset", "contents.assetsUpload": "Deixe cair ficheiros ou clique", "contents.autotranslate": "Transtração automática da linguagem mestra", "contents.bulkFailed": "Falhou em eliminar ou atualizar o conteúdo. Por favor, recarregue.", diff --git a/backend/i18n/frontend_zh.json b/backend/i18n/frontend_zh.json index fcdea253cb..4d6114a7dd 100644 --- a/backend/i18n/frontend_zh.json +++ b/backend/i18n/frontend_zh.json @@ -422,6 +422,7 @@ "contents.arrayMoveTop": "将此项移至顶部", "contents.arrayMoveUp": "将此项向上移动", "contents.arrayNoFields": "先添加一个嵌套字段来添加项目。", + "contents.assetsSelect": "Select existing Asset", "contents.assetsUpload": "删除文件或点击", "contents.autotranslate": "从母语自动翻译", "contents.bulkFailed": "删除或更新内容失败。请重新加载。", diff --git a/backend/i18n/source/frontend_en.json b/backend/i18n/source/frontend_en.json index cd71c08816..5489001582 100644 --- a/backend/i18n/source/frontend_en.json +++ b/backend/i18n/source/frontend_en.json @@ -422,7 +422,8 @@ "contents.arrayMoveTop": "Move this item to top", "contents.arrayMoveUp": "Move this item up", "contents.arrayNoFields": "Add a nested field first to add items.", - "contents.assetsUpload": "Drop files or click", + "contents.assetsSelect": "Select existing Asset", + "contents.assetsUpload": "Upload new Asset", "contents.autotranslate": "Autotranslate from master language", "contents.bulkFailed": "Failed to delete or update content. Please reload.", "contents.calendar": "Scheduled Contents", @@ -479,11 +480,11 @@ "contents.pendingChangesTextToPreview": "You have unsaved changes.\n\nYou will not see them on preview.\n\n**Do you want to continue anyway?**", "contents.pendingChangesTitle": "Unsaved changes", "contents.publishAll": "Publish All", - "contents.referencesCreateNew": "Add New", + "contents.referencesCreateNew": "Add new Content", "contents.referencesCreatePublish": "Create and Publish", "contents.referencesLink": "Link selected contents ({count})", "contents.referencesNoSchema": "No Schema", - "contents.referencesSelectExisting": "Select Existing", + "contents.referencesSelectExisting": "Select existing Content", "contents.referencesSelectSchema": "Select {schema}", "contents.refreshTooltip": "Refresh Contents", "contents.reloaded": "Contents reloaded.", diff --git a/backend/i18n/translator/Squidex.Translator/Processes/CheckBackend.cs b/backend/i18n/translator/Squidex.Translator/Processes/CheckBackend.cs index 36a89ea916..3faf248410 100644 --- a/backend/i18n/translator/Squidex.Translator/Processes/CheckBackend.cs +++ b/backend/i18n/translator/Squidex.Translator/Processes/CheckBackend.cs @@ -10,17 +10,9 @@ namespace Squidex.Translator.Processes; -public class CheckBackend +public class CheckBackend(DirectoryInfo folder, TranslationService service) { - private readonly TranslationService service; - private readonly DirectoryInfo folder; - - public CheckBackend(DirectoryInfo folder, TranslationService service) - { - this.folder = Backend.GetFolder(folder); - - this.service = service; - } + private readonly DirectoryInfo folder = Backend.GetFolder(folder); public void Run() { diff --git a/backend/i18n/translator/Squidex.Translator/Processes/CheckFrontend.cs b/backend/i18n/translator/Squidex.Translator/Processes/CheckFrontend.cs index 98a9376410..0bb25864bf 100644 --- a/backend/i18n/translator/Squidex.Translator/Processes/CheckFrontend.cs +++ b/backend/i18n/translator/Squidex.Translator/Processes/CheckFrontend.cs @@ -10,17 +10,9 @@ namespace Squidex.Translator.Processes; -public class CheckFrontend +public class CheckFrontend(DirectoryInfo folder, TranslationService service) { - private readonly TranslationService service; - private readonly DirectoryInfo folder; - - public CheckFrontend(DirectoryInfo folder, TranslationService service) - { - this.folder = Frontend.GetFolder(folder); - - this.service = service; - } + private readonly DirectoryInfo folder = Frontend.GetFolder(folder); public void Run(bool fix) { diff --git a/backend/i18n/translator/Squidex.Translator/Processes/GenerateBackendResources.cs b/backend/i18n/translator/Squidex.Translator/Processes/GenerateBackendResources.cs index 1327c40dc2..f70929c022 100644 --- a/backend/i18n/translator/Squidex.Translator/Processes/GenerateBackendResources.cs +++ b/backend/i18n/translator/Squidex.Translator/Processes/GenerateBackendResources.cs @@ -11,17 +11,9 @@ namespace Squidex.Translator.Processes; -public sealed class GenerateBackendResources +public sealed class GenerateBackendResources(DirectoryInfo folder, TranslationService service) { - private readonly TranslationService service; - private readonly DirectoryInfo folder; - - public GenerateBackendResources(DirectoryInfo folder, TranslationService service) - { - this.folder = new DirectoryInfo(Path.Combine(folder.FullName, "backend", "src", "Squidex.Shared")); - - this.service = service; - } + private readonly DirectoryInfo folder = new DirectoryInfo(Path.Combine(folder.FullName, "backend", "src", "Squidex.Shared")); public void Run() { diff --git a/backend/i18n/translator/Squidex.Translator/Processes/GenerateFrontendResources.cs b/backend/i18n/translator/Squidex.Translator/Processes/GenerateFrontendResources.cs index c03c0bcf75..7e606b651e 100644 --- a/backend/i18n/translator/Squidex.Translator/Processes/GenerateFrontendResources.cs +++ b/backend/i18n/translator/Squidex.Translator/Processes/GenerateFrontendResources.cs @@ -9,17 +9,9 @@ namespace Squidex.Translator.Processes; -public sealed class GenerateFrontendResources +public sealed class GenerateFrontendResources(DirectoryInfo folder, TranslationService service) { - private readonly TranslationService service; - private readonly DirectoryInfo folder; - - public GenerateFrontendResources(DirectoryInfo folder, TranslationService service) - { - this.folder = new DirectoryInfo(Path.Combine(folder.FullName, "backend", "i18n")); - - this.service = service; - } + private readonly DirectoryInfo folder = new DirectoryInfo(Path.Combine(folder.FullName, "backend", "i18n")); public void Run() { diff --git a/backend/i18n/translator/Squidex.Translator/Processes/GenerateKeys.cs b/backend/i18n/translator/Squidex.Translator/Processes/GenerateKeys.cs index 66650d7613..c015e8ae88 100644 --- a/backend/i18n/translator/Squidex.Translator/Processes/GenerateKeys.cs +++ b/backend/i18n/translator/Squidex.Translator/Processes/GenerateKeys.cs @@ -9,19 +9,8 @@ namespace Squidex.Translator.Processes; -public sealed class GenerateKeys +public sealed class GenerateKeys(DirectoryInfo folder, TranslationService service, string fileName) { - private readonly TranslationService service; - private readonly string fileName; - private readonly DirectoryInfo folder; - - public GenerateKeys(DirectoryInfo folder, TranslationService service, string fileName) - { - this.folder = folder; - this.service = service; - this.fileName = fileName; - } - public void Run() { var keys = new TranslatedTexts(); diff --git a/backend/i18n/translator/Squidex.Translator/Processes/TranslateBackend.cs b/backend/i18n/translator/Squidex.Translator/Processes/TranslateBackend.cs index 45c26a0204..e3aa99de68 100644 --- a/backend/i18n/translator/Squidex.Translator/Processes/TranslateBackend.cs +++ b/backend/i18n/translator/Squidex.Translator/Processes/TranslateBackend.cs @@ -10,17 +10,9 @@ namespace Squidex.Translator.Processes; -public class TranslateBackend +public class TranslateBackend(DirectoryInfo folder, TranslationService service) { - private readonly TranslationService service; - private readonly DirectoryInfo folder; - - public TranslateBackend(DirectoryInfo folder, TranslationService service) - { - this.folder = Backend.GetFolder(folder); - - this.service = service; - } + private readonly DirectoryInfo folder = Backend.GetFolder(folder); public void Run() { diff --git a/backend/i18n/translator/Squidex.Translator/Processes/TranslateTemplates.cs b/backend/i18n/translator/Squidex.Translator/Processes/TranslateTemplates.cs index 91157cf068..1df15de85c 100644 --- a/backend/i18n/translator/Squidex.Translator/Processes/TranslateTemplates.cs +++ b/backend/i18n/translator/Squidex.Translator/Processes/TranslateTemplates.cs @@ -11,7 +11,7 @@ namespace Squidex.Translator.Processes; -public partial class TranslateTemplates +public partial class TranslateTemplates(DirectoryInfo folder, TranslationService service) { private static readonly HashSet TagsToIgnore = [ @@ -29,20 +29,11 @@ public partial class TranslateTemplates "confirmText", // Confirm Click "message", // Title Component }; - - private readonly TranslationService service; - private readonly DirectoryInfo folder; + private readonly DirectoryInfo folder = Frontend.GetFolder(folder); private bool isReplaced; private bool isSilent; private int total; - public TranslateTemplates(DirectoryInfo folder, TranslationService service) - { - this.folder = Frontend.GetFolder(folder); - - this.service = service; - } - public void Run(bool reportMissing) { isSilent = reportMissing; diff --git a/backend/i18n/translator/Squidex.Translator/Processes/TranslateTypescript.cs b/backend/i18n/translator/Squidex.Translator/Processes/TranslateTypescript.cs index 113898d6fd..acf053b938 100644 --- a/backend/i18n/translator/Squidex.Translator/Processes/TranslateTypescript.cs +++ b/backend/i18n/translator/Squidex.Translator/Processes/TranslateTypescript.cs @@ -10,17 +10,9 @@ namespace Squidex.Translator.Processes; -public partial class TranslateTypescript +public partial class TranslateTypescript(DirectoryInfo folder, TranslationService service) { - private readonly TranslationService service; - private readonly DirectoryInfo folder; - - public TranslateTypescript(DirectoryInfo folder, TranslationService service) - { - this.folder = Frontend.GetFolder(folder); - - this.service = service; - } + private readonly DirectoryInfo folder = Frontend.GetFolder(folder); public void Run() { diff --git a/backend/src/Migrations/MigrationPath.cs b/backend/src/Migrations/MigrationPath.cs index be44434d7d..657e1c29ea 100644 --- a/backend/src/Migrations/MigrationPath.cs +++ b/backend/src/Migrations/MigrationPath.cs @@ -14,15 +14,9 @@ namespace Migrations; -public sealed class MigrationPath : IMigrationPath +public sealed class MigrationPath(IServiceProvider serviceProvider) : IMigrationPath { private const int CurrentVersion = 27; - private readonly IServiceProvider serviceProvider; - - public MigrationPath(IServiceProvider serviceProvider) - { - this.serviceProvider = serviceProvider; - } public (int Version, IEnumerable? Migrations) GetNext(int version) { diff --git a/backend/src/Migrations/Migrations.csproj b/backend/src/Migrations/Migrations.csproj index 6874e26a68..06781ee030 100644 --- a/backend/src/Migrations/Migrations.csproj +++ b/backend/src/Migrations/Migrations.csproj @@ -6,7 +6,7 @@ enable - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/backend/src/Migrations/Migrations/Backup/BackupState.cs b/backend/src/Migrations/Migrations/Backup/BackupState.cs index 299ef7e795..27aea66cbf 100644 --- a/backend/src/Migrations/Migrations/Backup/BackupState.cs +++ b/backend/src/Migrations/Migrations/Backup/BackupState.cs @@ -11,7 +11,7 @@ namespace Migrations.Migrations.Backup; public sealed class BackupState { - public List Jobs { get; set; } = []; + public List Jobs { get; set; } = []; public JobsState ToJob() { diff --git a/backend/src/Migrations/Migrations/Backup/ConvertBackup.cs b/backend/src/Migrations/Migrations/Backup/ConvertBackup.cs index a0837fafa3..41dba333dd 100644 --- a/backend/src/Migrations/Migrations/Backup/ConvertBackup.cs +++ b/backend/src/Migrations/Migrations/Backup/ConvertBackup.cs @@ -11,19 +11,11 @@ namespace Migrations.Migrations.Backup; -public sealed class ConvertBackup : IMigration +public sealed class ConvertBackup( + ISnapshotStore stateBackups, + ISnapshotStore stateJobs) + : IMigration { - private readonly ISnapshotStore stateBackups; - private readonly ISnapshotStore stateJobs; - - public ConvertBackup( - ISnapshotStore stateBackups, - ISnapshotStore stateJobs) - { - this.stateBackups = stateBackups; - this.stateJobs = stateJobs; - } - public async Task UpdateAsync( CancellationToken ct) { diff --git a/backend/src/Migrations/Migrations/ClearRules.cs b/backend/src/Migrations/Migrations/ClearRules.cs index 95af15b4d3..2cdd8d675b 100644 --- a/backend/src/Migrations/Migrations/ClearRules.cs +++ b/backend/src/Migrations/Migrations/ClearRules.cs @@ -11,15 +11,8 @@ namespace Migrations.Migrations; -public sealed class ClearRules : IMigration +public sealed class ClearRules(IStore store) : IMigration { - private readonly IStore store; - - public ClearRules(IStore store) - { - this.store = store; - } - public Task UpdateAsync( CancellationToken ct) { diff --git a/backend/src/Migrations/Migrations/ClearSchemas.cs b/backend/src/Migrations/Migrations/ClearSchemas.cs index 9ec8c429e8..acb4e0a759 100644 --- a/backend/src/Migrations/Migrations/ClearSchemas.cs +++ b/backend/src/Migrations/Migrations/ClearSchemas.cs @@ -11,15 +11,8 @@ namespace Migrations.Migrations; -public sealed class ClearSchemas : IMigration +public sealed class ClearSchemas(IStore store) : IMigration { - private readonly IStore store; - - public ClearSchemas(IStore store) - { - this.store = store; - } - public Task UpdateAsync( CancellationToken ct) { diff --git a/backend/src/Migrations/Migrations/ConvertEventStore.cs b/backend/src/Migrations/Migrations/ConvertEventStore.cs index 144e184df3..bfe2dc64d7 100644 --- a/backend/src/Migrations/Migrations/ConvertEventStore.cs +++ b/backend/src/Migrations/Migrations/ConvertEventStore.cs @@ -13,15 +13,8 @@ namespace Migrations.Migrations; -public sealed class ConvertEventStore : MongoBase, IMigration +public sealed class ConvertEventStore(IEventStore eventStore) : MongoBase, IMigration { - private readonly IEventStore eventStore; - - public ConvertEventStore(IEventStore eventStore) - { - this.eventStore = eventStore; - } - public async Task UpdateAsync( CancellationToken ct) { diff --git a/backend/src/Migrations/Migrations/ConvertEventStoreAppId.cs b/backend/src/Migrations/Migrations/ConvertEventStoreAppId.cs index f0ef17e7ba..842c0fcfef 100644 --- a/backend/src/Migrations/Migrations/ConvertEventStoreAppId.cs +++ b/backend/src/Migrations/Migrations/ConvertEventStoreAppId.cs @@ -14,15 +14,8 @@ namespace Migrations.Migrations; -public sealed class ConvertEventStoreAppId : MongoBase, IMigration +public sealed class ConvertEventStoreAppId(IEventStore eventStore) : MongoBase, IMigration { - private readonly IEventStore eventStore; - - public ConvertEventStoreAppId(IEventStore eventStore) - { - this.eventStore = eventStore; - } - public async Task UpdateAsync( CancellationToken ct) { diff --git a/backend/src/Migrations/Migrations/CreateAssetSlugs.cs b/backend/src/Migrations/Migrations/CreateAssetSlugs.cs index 3480f8f574..fd0c90b772 100644 --- a/backend/src/Migrations/Migrations/CreateAssetSlugs.cs +++ b/backend/src/Migrations/Migrations/CreateAssetSlugs.cs @@ -12,15 +12,8 @@ namespace Migrations.Migrations; -public sealed class CreateAssetSlugs : IMigration +public sealed class CreateAssetSlugs(ISnapshotStore stateForAssets) : IMigration { - private readonly ISnapshotStore stateForAssets; - - public CreateAssetSlugs(ISnapshotStore stateForAssets) - { - this.stateForAssets = stateForAssets; - } - public async Task UpdateAsync( CancellationToken ct) { diff --git a/backend/src/Migrations/Migrations/MongoDb/AddAppIdToEventStream.cs b/backend/src/Migrations/Migrations/MongoDb/AddAppIdToEventStream.cs index b69662a93e..5c272abae2 100644 --- a/backend/src/Migrations/Migrations/MongoDb/AddAppIdToEventStream.cs +++ b/backend/src/Migrations/Migrations/MongoDb/AddAppIdToEventStream.cs @@ -15,15 +15,8 @@ namespace Migrations.Migrations.MongoDb; -public sealed class AddAppIdToEventStream : MongoBase, IMigration +public sealed class AddAppIdToEventStream(IMongoDatabase database) : MongoBase, IMigration { - private readonly IMongoDatabase database; - - public AddAppIdToEventStream(IMongoDatabase database) - { - this.database = database; - } - public async Task UpdateAsync( CancellationToken ct) { diff --git a/backend/src/Migrations/Migrations/MongoDb/ConvertDocumentIds.cs b/backend/src/Migrations/Migrations/MongoDb/ConvertDocumentIds.cs index 78ce2c720b..ca28142d8a 100644 --- a/backend/src/Migrations/Migrations/MongoDb/ConvertDocumentIds.cs +++ b/backend/src/Migrations/Migrations/MongoDb/ConvertDocumentIds.cs @@ -14,10 +14,8 @@ namespace Migrations.Migrations.MongoDb; -public sealed class ConvertDocumentIds : MongoBase, IMigration +public sealed class ConvertDocumentIds(IMongoDatabase databaseDefault, IMongoDatabase databaseContent) : MongoBase, IMigration { - private readonly IMongoDatabase databaseDefault; - private readonly IMongoDatabase databaseContent; private Scope scope; private enum Scope @@ -27,12 +25,6 @@ private enum Scope Contents } - public ConvertDocumentIds(IMongoDatabase databaseDefault, IMongoDatabase databaseContent) - { - this.databaseDefault = databaseDefault; - this.databaseContent = databaseContent; - } - public override string ToString() { return $"{base.ToString()}({scope})"; diff --git a/backend/src/Migrations/Migrations/MongoDb/ConvertOldSnapshotStores.cs b/backend/src/Migrations/Migrations/MongoDb/ConvertOldSnapshotStores.cs index 604b795a86..8e473107f6 100644 --- a/backend/src/Migrations/Migrations/MongoDb/ConvertOldSnapshotStores.cs +++ b/backend/src/Migrations/Migrations/MongoDb/ConvertOldSnapshotStores.cs @@ -12,15 +12,8 @@ namespace Migrations.Migrations.MongoDb; -public sealed class ConvertOldSnapshotStores : MongoBase, IMigration +public sealed class ConvertOldSnapshotStores(IMongoDatabase database) : MongoBase, IMigration { - private readonly IMongoDatabase database; - - public ConvertOldSnapshotStores(IMongoDatabase database) - { - this.database = database; - } - public Task UpdateAsync( CancellationToken ct) { diff --git a/backend/src/Migrations/Migrations/MongoDb/ConvertRuleEventsJson.cs b/backend/src/Migrations/Migrations/MongoDb/ConvertRuleEventsJson.cs index b5891f3ef0..d8041c49eb 100644 --- a/backend/src/Migrations/Migrations/MongoDb/ConvertRuleEventsJson.cs +++ b/backend/src/Migrations/Migrations/MongoDb/ConvertRuleEventsJson.cs @@ -12,14 +12,9 @@ namespace Migrations.Migrations.MongoDb; -public sealed class ConvertRuleEventsJson : MongoBase, IMigration +public sealed class ConvertRuleEventsJson(IMongoDatabase database) : MongoBase, IMigration { - private readonly IMongoCollection collection; - - public ConvertRuleEventsJson(IMongoDatabase database) - { - collection = database.GetCollection("RuleEvents"); - } + private readonly IMongoCollection collection = database.GetCollection("RuleEvents"); public async Task UpdateAsync( CancellationToken ct) diff --git a/backend/src/Migrations/Migrations/MongoDb/CopyRuleStatistics.cs b/backend/src/Migrations/Migrations/MongoDb/CopyRuleStatistics.cs index d97b51ca28..4b3d775389 100644 --- a/backend/src/Migrations/Migrations/MongoDb/CopyRuleStatistics.cs +++ b/backend/src/Migrations/Migrations/MongoDb/CopyRuleStatistics.cs @@ -15,11 +15,8 @@ namespace Migrations.Migrations.MongoDb; -public sealed class CopyRuleStatistics : IMigration +public sealed class CopyRuleStatistics(IMongoDatabase database, IRuleUsageTracker ruleUsageTracker) : IMigration { - private readonly IMongoDatabase database; - private readonly IRuleUsageTracker ruleUsageTracker; - [BsonIgnoreExtraElements] public class Document { @@ -32,12 +29,6 @@ public class Document public int NumSucceeded { get; private set; } } - public CopyRuleStatistics(IMongoDatabase database, IRuleUsageTracker ruleUsageTracker) - { - this.database = database; - this.ruleUsageTracker = ruleUsageTracker; - } - public async Task UpdateAsync( CancellationToken ct) { diff --git a/backend/src/Migrations/Migrations/MongoDb/DeleteContentCollections.cs b/backend/src/Migrations/Migrations/MongoDb/DeleteContentCollections.cs index 70ea81ec41..fec5c7573b 100644 --- a/backend/src/Migrations/Migrations/MongoDb/DeleteContentCollections.cs +++ b/backend/src/Migrations/Migrations/MongoDb/DeleteContentCollections.cs @@ -10,15 +10,8 @@ namespace Migrations.Migrations.MongoDb; -public sealed class DeleteContentCollections : IMigration +public sealed class DeleteContentCollections(IMongoDatabase database) : IMigration { - private readonly IMongoDatabase database; - - public DeleteContentCollections(IMongoDatabase database) - { - this.database = database; - } - public async Task UpdateAsync( CancellationToken ct) { diff --git a/backend/src/Migrations/Migrations/MongoDb/RenameAssetMetadata.cs b/backend/src/Migrations/Migrations/MongoDb/RenameAssetMetadata.cs index a3bbc06b07..2356a48137 100644 --- a/backend/src/Migrations/Migrations/MongoDb/RenameAssetMetadata.cs +++ b/backend/src/Migrations/Migrations/MongoDb/RenameAssetMetadata.cs @@ -12,15 +12,8 @@ namespace Migrations.Migrations.MongoDb; -public sealed class RenameAssetMetadata : MongoBase, IMigration +public sealed class RenameAssetMetadata(IMongoDatabase database) : MongoBase, IMigration { - private readonly IMongoDatabase database; - - public RenameAssetMetadata(IMongoDatabase database) - { - this.database = database; - } - public async Task UpdateAsync( CancellationToken ct) { diff --git a/backend/src/Migrations/Migrations/MongoDb/RenameAssetSlugField.cs b/backend/src/Migrations/Migrations/MongoDb/RenameAssetSlugField.cs index c872d959af..6249f205e0 100644 --- a/backend/src/Migrations/Migrations/MongoDb/RenameAssetSlugField.cs +++ b/backend/src/Migrations/Migrations/MongoDb/RenameAssetSlugField.cs @@ -12,15 +12,8 @@ namespace Migrations.Migrations.MongoDb; -public sealed class RenameAssetSlugField : MongoBase, IMigration +public sealed class RenameAssetSlugField(IMongoDatabase database) : MongoBase, IMigration { - private readonly IMongoDatabase database; - - public RenameAssetSlugField(IMongoDatabase database) - { - this.database = database; - } - public Task UpdateAsync( CancellationToken ct) { diff --git a/backend/src/Migrations/Migrations/MongoDb/RestructureContentCollection.cs b/backend/src/Migrations/Migrations/MongoDb/RestructureContentCollection.cs index 766b09b0fa..cd62d015c2 100644 --- a/backend/src/Migrations/Migrations/MongoDb/RestructureContentCollection.cs +++ b/backend/src/Migrations/Migrations/MongoDb/RestructureContentCollection.cs @@ -12,15 +12,8 @@ namespace Migrations.Migrations.MongoDb; -public sealed class RestructureContentCollection : MongoBase, IMigration +public sealed class RestructureContentCollection(IMongoDatabase contentDatabase) : MongoBase, IMigration { - private readonly IMongoDatabase contentDatabase; - - public RestructureContentCollection(IMongoDatabase contentDatabase) - { - this.contentDatabase = contentDatabase; - } - public async Task UpdateAsync( CancellationToken ct) { diff --git a/backend/src/Migrations/Migrations/RebuildApps.cs b/backend/src/Migrations/Migrations/RebuildApps.cs index 30b71450df..bba2571b85 100644 --- a/backend/src/Migrations/Migrations/RebuildApps.cs +++ b/backend/src/Migrations/Migrations/RebuildApps.cs @@ -11,17 +11,12 @@ namespace Migrations.Migrations; -public sealed class RebuildApps : IMigration +public sealed class RebuildApps( + Rebuilder rebuilder, + IOptions rebuildOptions) + : IMigration { - private readonly Rebuilder rebuilder; - private readonly RebuildOptions rebuildOptions; - - public RebuildApps(Rebuilder rebuilder, - IOptions rebuildOptions) - { - this.rebuilder = rebuilder; - this.rebuildOptions = rebuildOptions.Value; - } + private readonly RebuildOptions rebuildOptions = rebuildOptions.Value; public Task UpdateAsync( CancellationToken ct) diff --git a/backend/src/Migrations/Migrations/RebuildAssetFolders.cs b/backend/src/Migrations/Migrations/RebuildAssetFolders.cs index 54cae8d7e7..d0ed200586 100644 --- a/backend/src/Migrations/Migrations/RebuildAssetFolders.cs +++ b/backend/src/Migrations/Migrations/RebuildAssetFolders.cs @@ -11,17 +11,12 @@ namespace Migrations.Migrations; -public sealed class RebuildAssetFolders : IMigration +public sealed class RebuildAssetFolders( + Rebuilder rebuilder, + IOptions rebuildOptions) + : IMigration { - private readonly Rebuilder rebuilder; - private readonly RebuildOptions rebuildOptions; - - public RebuildAssetFolders(Rebuilder rebuilder, - IOptions rebuildOptions) - { - this.rebuilder = rebuilder; - this.rebuildOptions = rebuildOptions.Value; - } + private readonly RebuildOptions rebuildOptions = rebuildOptions.Value; public Task UpdateAsync( CancellationToken ct) diff --git a/backend/src/Migrations/Migrations/RebuildAssets.cs b/backend/src/Migrations/Migrations/RebuildAssets.cs index fb7dfc3d59..bfeea0e6b4 100644 --- a/backend/src/Migrations/Migrations/RebuildAssets.cs +++ b/backend/src/Migrations/Migrations/RebuildAssets.cs @@ -11,17 +11,12 @@ namespace Migrations.Migrations; -public sealed class RebuildAssets : IMigration +public sealed class RebuildAssets( + Rebuilder rebuilder, + IOptions rebuildOptions) + : IMigration { - private readonly Rebuilder rebuilder; - private readonly RebuildOptions rebuildOptions; - - public RebuildAssets(Rebuilder rebuilder, - IOptions rebuildOptions) - { - this.rebuilder = rebuilder; - this.rebuildOptions = rebuildOptions.Value; - } + private readonly RebuildOptions rebuildOptions = rebuildOptions.Value; public Task UpdateAsync( CancellationToken ct) diff --git a/backend/src/Migrations/Migrations/RebuildContents.cs b/backend/src/Migrations/Migrations/RebuildContents.cs index ed01bfccd0..6cbc23401c 100644 --- a/backend/src/Migrations/Migrations/RebuildContents.cs +++ b/backend/src/Migrations/Migrations/RebuildContents.cs @@ -11,17 +11,12 @@ namespace Migrations.Migrations; -public sealed class RebuildContents : IMigration +public sealed class RebuildContents( + Rebuilder rebuilder, + IOptions rebuildOptions) + : IMigration { - private readonly Rebuilder rebuilder; - private readonly RebuildOptions rebuildOptions; - - public RebuildContents(Rebuilder rebuilder, - IOptions rebuildOptions) - { - this.rebuilder = rebuilder; - this.rebuildOptions = rebuildOptions.Value; - } + private readonly RebuildOptions rebuildOptions = rebuildOptions.Value; public Task UpdateAsync( CancellationToken ct) diff --git a/backend/src/Migrations/Migrations/RebuildRules.cs b/backend/src/Migrations/Migrations/RebuildRules.cs index 05c3ff143d..545d48f22c 100644 --- a/backend/src/Migrations/Migrations/RebuildRules.cs +++ b/backend/src/Migrations/Migrations/RebuildRules.cs @@ -11,17 +11,12 @@ namespace Migrations.Migrations; -public sealed class RebuildRules : IMigration +public sealed class RebuildRules( + Rebuilder rebuilder, + IOptions rebuildOptions) + : IMigration { - private readonly Rebuilder rebuilder; - private readonly RebuildOptions rebuildOptions; - - public RebuildRules(Rebuilder rebuilder, - IOptions rebuildOptions) - { - this.rebuilder = rebuilder; - this.rebuildOptions = rebuildOptions.Value; - } + private readonly RebuildOptions rebuildOptions = rebuildOptions.Value; public Task UpdateAsync( CancellationToken ct) diff --git a/backend/src/Migrations/Migrations/RebuildSchemas.cs b/backend/src/Migrations/Migrations/RebuildSchemas.cs index 5566f1c4a7..4ed2b2265f 100644 --- a/backend/src/Migrations/Migrations/RebuildSchemas.cs +++ b/backend/src/Migrations/Migrations/RebuildSchemas.cs @@ -11,17 +11,12 @@ namespace Migrations.Migrations; -public sealed class RebuildSchemas : IMigration +public sealed class RebuildSchemas( + Rebuilder rebuilder, + IOptions rebuildOptions) + : IMigration { - private readonly Rebuilder rebuilder; - private readonly RebuildOptions rebuildOptions; - - public RebuildSchemas(Rebuilder rebuilder, - IOptions rebuildOptions) - { - this.rebuilder = rebuilder; - this.rebuildOptions = rebuildOptions.Value; - } + private readonly RebuildOptions rebuildOptions = rebuildOptions.Value; public Task UpdateAsync( CancellationToken ct) diff --git a/backend/src/Migrations/Migrations/RebuildSnapshots.cs b/backend/src/Migrations/Migrations/RebuildSnapshots.cs index cf684b103f..f8842f5280 100644 --- a/backend/src/Migrations/Migrations/RebuildSnapshots.cs +++ b/backend/src/Migrations/Migrations/RebuildSnapshots.cs @@ -11,17 +11,12 @@ namespace Migrations.Migrations; -public sealed class RebuildSnapshots : IMigration +public sealed class RebuildSnapshots( + Rebuilder rebuilder, + IOptions rebuildOptions) + : IMigration { - private readonly Rebuilder rebuilder; - private readonly RebuildOptions rebuildOptions; - - public RebuildSnapshots(Rebuilder rebuilder, - IOptions rebuildOptions) - { - this.rebuilder = rebuilder; - this.rebuildOptions = rebuildOptions.Value; - } + private readonly RebuildOptions rebuildOptions = rebuildOptions.Value; public async Task UpdateAsync( CancellationToken ct) diff --git a/backend/src/Migrations/OldEvents/AppClientUpdated.cs b/backend/src/Migrations/OldEvents/AppClientUpdated.cs index da14b637c8..cbdf333558 100644 --- a/backend/src/Migrations/OldEvents/AppClientUpdated.cs +++ b/backend/src/Migrations/OldEvents/AppClientUpdated.cs @@ -41,4 +41,4 @@ public IEvent Migrate() return result; } -} \ No newline at end of file +} diff --git a/backend/src/Migrations/RebuildRunner.cs b/backend/src/Migrations/RebuildRunner.cs index 86efb9fb13..b66cd95e52 100644 --- a/backend/src/Migrations/RebuildRunner.cs +++ b/backend/src/Migrations/RebuildRunner.cs @@ -11,21 +11,12 @@ namespace Migrations; -public sealed class RebuildRunner +public sealed class RebuildRunner( + IOptions rebuildOptions, + Rebuilder rebuilder, + RebuildFiles rebuildFiles) { - private readonly RebuildFiles rebuildFiles; - private readonly Rebuilder rebuilder; - private readonly RebuildOptions rebuildOptions; - - public RebuildRunner( - IOptions rebuildOptions, - Rebuilder rebuilder, - RebuildFiles rebuildFiles) - { - this.rebuildFiles = rebuildFiles; - this.rebuilder = rebuilder; - this.rebuildOptions = rebuildOptions.Value; - } + private readonly RebuildOptions rebuildOptions = rebuildOptions.Value; public async Task RunAsync( CancellationToken ct) diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/Status.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/Status.cs index a0ed94a327..6506b95ee9 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/Status.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/Status.cs @@ -10,24 +10,17 @@ namespace Squidex.Domain.Apps.Core.Contents; [TypeConverter(typeof(StatusTypeConverter))] -public readonly struct Status : IEquatable, IComparable +public readonly struct Status(string? name) : IEquatable, IComparable { public static readonly Status Archived = new Status("Archived"); public static readonly Status Draft = new Status("Draft"); public static readonly Status Published = new Status("Published"); - private readonly string? name; - public string Name { get => name ?? "Unknown"; } - public Status(string? name) - { - this.name = name; - } - public override bool Equals(object? obj) { return obj is Status status && Equals(status); diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/FieldDescriptionAttribute.cs b/backend/src/Squidex.Domain.Apps.Core.Model/FieldDescriptionAttribute.cs index 9303f63eb0..893e49e46e 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/FieldDescriptionAttribute.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/FieldDescriptionAttribute.cs @@ -8,12 +8,7 @@ namespace Squidex.Domain.Apps.Core; [AttributeUsage(AttributeTargets.Property)] -public sealed class FieldDescriptionAttribute : Attribute +public sealed class FieldDescriptionAttribute(string name) : Attribute { - public string Name { get; } - - public FieldDescriptionAttribute(string name) - { - Name = name; - } + public string Name { get; } = name; } diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Rules/EnrichedEvents/EnrichedAssetEventType.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Rules/EnrichedEvents/EnrichedAssetEventType.cs index 3b9fb0b6f1..7eca9e27a6 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Rules/EnrichedEvents/EnrichedAssetEventType.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Rules/EnrichedEvents/EnrichedAssetEventType.cs @@ -13,4 +13,4 @@ public enum EnrichedAssetEventType Deleted, Annotated, Updated -} \ No newline at end of file +} diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Rules/EnrichedEvents/EnrichedSchemaEventType.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Rules/EnrichedEvents/EnrichedSchemaEventType.cs index a0cbeaf56a..94304d8f22 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Rules/EnrichedEvents/EnrichedSchemaEventType.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Rules/EnrichedEvents/EnrichedSchemaEventType.cs @@ -14,4 +14,4 @@ public enum EnrichedSchemaEventType Published, Unpublished, Updated -} \ No newline at end of file +} diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldRuleAction.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldRuleAction.cs index ea9d520b13..e069611343 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldRuleAction.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldRuleAction.cs @@ -12,4 +12,4 @@ public enum FieldRuleAction Disable, Hide, Require -} \ No newline at end of file +} diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/Fields.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/Fields.cs index 83f6bdf829..48851f043f 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/Fields.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/Fields.cs @@ -20,7 +20,7 @@ public static ArrayField Array(long id, string name, Partitioning partitioning, public static RootField Assets(long id, string name, Partitioning partitioning, AssetsFieldProperties? properties = null) { - return new RootField { Id = id, Name = name, Partitioning = partitioning, Properties = properties ?? new () }; + return new RootField { Id = id, Name = name, Partitioning = partitioning, Properties = properties ?? new() }; } public static RootField Boolean(long id, string name, Partitioning partitioning, diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Squidex.Domain.Apps.Core.Model.csproj b/backend/src/Squidex.Domain.Apps.Core.Model/Squidex.Domain.Apps.Core.Model.csproj index d15dcaeac2..a7b8292392 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Squidex.Domain.Apps.Core.Model.csproj +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Squidex.Domain.Apps.Core.Model.csproj @@ -12,11 +12,11 @@ True - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/AddDefaultValues.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/AddDefaultValues.cs index 665b2163f9..ac49d06b43 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/AddDefaultValues.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/AddDefaultValues.cs @@ -12,10 +12,9 @@ namespace Squidex.Domain.Apps.Core.ConvertContent; -public sealed class AddDefaultValues : IContentDataConverter, IContentItemConverter, IContentFieldConverter +public sealed class AddDefaultValues(PartitionResolver partitionResolver, IClock? clock = null) : IContentDataConverter, IContentItemConverter, IContentFieldConverter { - private readonly PartitionResolver partitionResolver; - private readonly IClock clock; + private readonly IClock clock = clock ?? SystemClock.Instance; private Instant now; public bool IgnoreRequiredFields { get; init; } @@ -24,13 +23,6 @@ public sealed class AddDefaultValues : IContentDataConverter, IContentItemConver public HashSet? FieldNames { get; init; } - public AddDefaultValues(PartitionResolver partitionResolver, IClock? clock = null) - { - this.partitionResolver = partitionResolver; - - this.clock = clock ?? SystemClock.Instance; - } - public void ConvertDataBefore(Schema schema, ContentData data) { foreach (var field in schema.Fields) diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/AddSchemaNames.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/AddSchemaNames.cs index 21b5e83254..4b9963b3c3 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/AddSchemaNames.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/AddSchemaNames.cs @@ -12,15 +12,8 @@ namespace Squidex.Domain.Apps.Core.ConvertContent; -public sealed class AddSchemaNames : IContentItemConverter +public sealed class AddSchemaNames(ResolvedComponents components) : IContentItemConverter { - private readonly ResolvedComponents components; - - public AddSchemaNames(ResolvedComponents components) - { - this.components = components; - } - public JsonObject ConvertItemAfter(IField parentField, JsonObject source, IEnumerable schema) { if (parentField is IArrayField) diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/ContentConverter.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/ContentConverter.cs index 89ea8a27ab..c0573ebe34 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/ContentConverter.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/ContentConverter.cs @@ -14,20 +14,12 @@ namespace Squidex.Domain.Apps.Core.ConvertContent; -public sealed class ContentConverter +public sealed class ContentConverter(ResolvedComponents components, Schema schema) { private readonly List dataConverters = []; private readonly List itemConverters = []; private readonly List fieldConverters = []; private readonly List valueConverters = []; - private readonly ResolvedComponents components; - private readonly Schema schema; - - public ContentConverter(ResolvedComponents components, Schema schema) - { - this.components = components; - this.schema = schema; - } public ContentConverter Add(IConverter converter) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/ExcludeChangedTypes.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/ExcludeChangedTypes.cs index 7f915eee74..7448dac1a4 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/ExcludeChangedTypes.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/ExcludeChangedTypes.cs @@ -13,15 +13,8 @@ namespace Squidex.Domain.Apps.Core.ConvertContent; -public sealed class ExcludeChangedTypes : IContentFieldConverter, IContentValueConverter +public sealed class ExcludeChangedTypes(IJsonSerializer serializer) : IContentFieldConverter, IContentValueConverter { - private readonly IJsonSerializer serializer; - - public ExcludeChangedTypes(IJsonSerializer serializer) - { - this.serializer = serializer; - } - public ContentFieldData? ConvertFieldBefore(IRootField field, ContentFieldData source) { foreach (var (_, value) in source) diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/ResolveFromPreviousPartitioning.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/ResolveFromPreviousPartitioning.cs index 2592dff30b..95b5b2866d 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/ResolveFromPreviousPartitioning.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/ResolveFromPreviousPartitioning.cs @@ -11,15 +11,8 @@ namespace Squidex.Domain.Apps.Core.ConvertContent; -public sealed class ResolveFromPreviousPartitioning : IContentFieldConverter +public sealed class ResolveFromPreviousPartitioning(LanguagesConfig languages) : IContentFieldConverter { - private readonly LanguagesConfig languages; - - public ResolveFromPreviousPartitioning(LanguagesConfig languages) - { - this.languages = languages; - } - public ContentFieldData? ConvertFieldAfter(IRootField field, ContentFieldData source) { if (field.Partitioning.Equals(Partitioning.Invariant)) diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/UpdateValues.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/UpdateValues.cs index ca22bf4364..da2e2d86b1 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/UpdateValues.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/UpdateValues.cs @@ -12,20 +12,10 @@ namespace Squidex.Domain.Apps.Core.ConvertContent; -public sealed class UpdateValues : IContentValueConverter, IContentDataConverter +public sealed class UpdateValues(ContentData existingData, IScriptEngine scriptEngine, bool canUnset) : IContentValueConverter, IContentDataConverter { - private readonly ContentData existingData; - private readonly IScriptEngine scriptEngine; - private readonly bool canUnset; private ScriptVars? vars; - public UpdateValues(ContentData existingData, IScriptEngine scriptEngine, bool canUnset) - { - this.existingData = existingData; - this.scriptEngine = scriptEngine; - this.canUnset = canUnset; - } - public void ConvertDataBefore(Schema schema, ContentData source) { // Avoid unnecessary allocations if nothing has been changed, which is the default. diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/ValueReferencesConverter.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/ValueReferencesConverter.cs index 0911ee332e..0d30dcb6d4 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/ValueReferencesConverter.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/ValueReferencesConverter.cs @@ -12,15 +12,8 @@ namespace Squidex.Domain.Apps.Core.ExtractReferenceIds; -public sealed class ValueReferencesConverter : IContentValueConverter +public sealed class ValueReferencesConverter(HashSet? validIds = null) : IContentValueConverter { - private readonly HashSet? validIds; - - public ValueReferencesConverter(HashSet? validIds = null) - { - this.validIds = validIds; - } - public (bool Remove, JsonValue) ConvertValue(IField field, JsonValue source, IField? parent) { if (validIds == null || source == default) diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/EditorAttribute.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/EditorAttribute.cs index 348bf60be5..30eae8e4ac 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/EditorAttribute.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/EditorAttribute.cs @@ -8,12 +8,7 @@ namespace Squidex.Domain.Apps.Core.HandleRules; [AttributeUsage(AttributeTargets.Property)] -public sealed class EditorAttribute : Attribute +public sealed class EditorAttribute(RuleFieldEditor editor) : Attribute { - public RuleFieldEditor Editor { get; } - - public EditorAttribute(RuleFieldEditor editor) - { - Editor = editor; - } + public RuleFieldEditor Editor { get; } = editor; } diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/EventEnricher.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/EventEnricher.cs index e6e2728006..953334eec7 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/EventEnricher.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/EventEnricher.cs @@ -14,17 +14,9 @@ namespace Squidex.Domain.Apps.Core.HandleRules; -public sealed class EventEnricher : IEventEnricher +public sealed class EventEnricher(IMemoryCache userCache, IUserResolver userResolver) : IEventEnricher { private static readonly TimeSpan CacheDuration = TimeSpan.FromMinutes(10); - private readonly IMemoryCache userCache; - private readonly IUserResolver userResolver; - - public EventEnricher(IMemoryCache userCache, IUserResolver userResolver) - { - this.userCache = userCache; - this.userResolver = userResolver; - } public async Task EnrichAsync(EnrichedEvent enrichedEvent, Envelope? @event) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Extensions/EventFluidExtensions.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Extensions/EventFluidExtensions.cs index 0d4195e1e5..ab1fcb84d7 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Extensions/EventFluidExtensions.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Extensions/EventFluidExtensions.cs @@ -14,15 +14,8 @@ namespace Squidex.Domain.Apps.Core.HandleRules.Extensions; -public sealed class EventFluidExtensions : IFluidExtension +public sealed class EventFluidExtensions(IUrlGenerator urlGenerator) : IFluidExtension { - private readonly IUrlGenerator urlGenerator; - - public EventFluidExtensions(IUrlGenerator urlGenerator) - { - this.urlGenerator = urlGenerator; - } - public void RegisterLanguageExtensions(CustomFluidParser parser, TemplateOptions options) { options.Filters.AddFilter("contentUrl", ContentUrl); diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Extensions/EventJintExtension.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Extensions/EventJintExtension.cs index e1a5a2919f..b9c71208a3 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Extensions/EventJintExtension.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Extensions/EventJintExtension.cs @@ -13,15 +13,9 @@ namespace Squidex.Domain.Apps.Core.HandleRules.Extensions; -public sealed class EventJintExtension : IJintExtension, IScriptDescriptor +public sealed class EventJintExtension(IUrlGenerator urlGenerator) : IJintExtension, IScriptDescriptor { private delegate JsValue EventDelegate(); - private readonly IUrlGenerator urlGenerator; - - public EventJintExtension(IUrlGenerator urlGenerator) - { - this.urlGenerator = urlGenerator; - } public void Extend(ScriptExecutionContext context) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/IRuleEventFormatter.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/IRuleEventFormatter.cs index 78f6175b1f..bc04ec8068 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/IRuleEventFormatter.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/IRuleEventFormatter.cs @@ -20,4 +20,4 @@ public interface IRuleEventFormatter { return default; } -} \ No newline at end of file +} diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleActionHandler.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleActionHandler.cs index 895c2dbec7..184c93fe0b 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleActionHandler.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleActionHandler.cs @@ -12,10 +12,8 @@ namespace Squidex.Domain.Apps.Core.HandleRules; -public abstract class RuleActionHandler : IRuleActionHandler where TAction : RuleAction +public abstract class RuleActionHandler(RuleEventFormatter formatter) : IRuleActionHandler where TAction : RuleAction { - private readonly RuleEventFormatter formatter; - Type IRuleActionHandler.ActionType { get => typeof(TAction); @@ -26,11 +24,6 @@ Type IRuleActionHandler.DataType get => typeof(TData); } - protected RuleActionHandler(RuleEventFormatter formatter) - { - this.formatter = formatter; - } - protected virtual string ToJson(T @event) where T : notnull { return formatter.ToPayload(@event); 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 f876fdd2bf..4edd077aca 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleEventFormatter.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleEventFormatter.cs @@ -23,15 +23,11 @@ namespace Squidex.Domain.Apps.Core.HandleRules; -public partial class RuleEventFormatter +public partial class RuleEventFormatter(IJsonSerializer serializer, IEnumerable formatters, ITemplateEngine templateEngine, IScriptEngine scriptEngine) { private const string GlobalFallback = "null"; private static readonly Regex RegexPatternOld = RegexPatternOldFactory(); private static readonly Regex RegexPatternNew = RegexPatternNewFactory(); - private readonly IJsonSerializer serializer; - private readonly IEnumerable formatters; - private readonly ITemplateEngine templateEngine; - private readonly IScriptEngine scriptEngine; private struct TextPart { @@ -70,14 +66,6 @@ public static TextPart Variable(ValueTask replacement, string fallback, } } - public RuleEventFormatter(IJsonSerializer serializer, IEnumerable formatters, ITemplateEngine templateEngine, IScriptEngine scriptEngine) - { - this.serializer = serializer; - this.formatters = formatters; - this.templateEngine = templateEngine; - this.scriptEngine = scriptEngine; - } - public virtual string ToPayload(T @event) where T : notnull { // Just serialize the payload. diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleService.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleService.cs index 8220089c31..8d4ab63168 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleService.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleService.cs @@ -22,15 +22,19 @@ namespace Squidex.Domain.Apps.Core.HandleRules; -public sealed class RuleService : IRuleService +public sealed class RuleService( + IOptions ruleOptions, + IEnumerable ruleTriggerHandlers, + IEnumerable ruleActionHandlers, + IEventEnricher eventEnricher, + IJsonSerializer serializer, + ILogger log, + TypeRegistry typeRegistry) + : IRuleService { - private readonly Dictionary ruleActionHandlers; - private readonly Dictionary ruleTriggerHandlers; - private readonly TypeRegistry typeRegistry; - private readonly RuleOptions ruleOptions; - private readonly IEventEnricher eventEnricher; - private readonly IJsonSerializer serializer; - private readonly ILogger log; + private readonly Dictionary ruleActionHandlers = ruleActionHandlers.ToDictionary(x => x.ActionType); + private readonly Dictionary ruleTriggerHandlers = ruleTriggerHandlers.ToDictionary(x => x.TriggerType); + private readonly RuleOptions ruleOptions = ruleOptions.Value; private sealed class RuleState { @@ -43,24 +47,6 @@ private sealed class RuleState public IClock Clock { get; set; } = SystemClock.Instance; - public RuleService( - IOptions ruleOptions, - IEnumerable ruleTriggerHandlers, - IEnumerable ruleActionHandlers, - IEventEnricher eventEnricher, - IJsonSerializer serializer, - ILogger log, - TypeRegistry typeRegistry) - { - this.typeRegistry = typeRegistry; - this.eventEnricher = eventEnricher; - this.ruleOptions = ruleOptions.Value; - this.ruleTriggerHandlers = ruleTriggerHandlers.ToDictionary(x => x.TriggerType); - this.ruleActionHandlers = ruleActionHandlers.ToDictionary(x => x.ActionType); - this.serializer = serializer; - this.log = log; - } - public bool CanCreateSnapshotEvents(Rule rule) { if (!ruleTriggerHandlers.TryGetValue(rule.Trigger.GetType(), out var triggerHandler)) diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/ContentWrapper/ContentDataObject.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/ContentWrapper/ContentDataObject.cs index 80546fea1e..d5fccaa125 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/ContentWrapper/ContentDataObject.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/ContentWrapper/ContentDataObject.cs @@ -15,21 +15,14 @@ namespace Squidex.Domain.Apps.Core.Scripting.ContentWrapper; -public sealed class ContentDataObject : ObjectInstance +public sealed class ContentDataObject(Engine engine, ContentData contentData) : ObjectInstance(engine) { - private readonly ContentData contentData; private HashSet fieldsToDelete; private Dictionary fieldProperties; private bool isChanged; public override bool Extensible => true; - public ContentDataObject(Engine engine, ContentData contentData) - : base(engine) - { - this.contentData = contentData; - } - public void MarkChanged() { isChanged = true; diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/ContentWrapper/ContentFieldProperty.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/ContentWrapper/ContentFieldProperty.cs index 452d5f8883..43e90a8aca 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/ContentWrapper/ContentFieldProperty.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/ContentWrapper/ContentFieldProperty.cs @@ -12,10 +12,8 @@ namespace Squidex.Domain.Apps.Core.Scripting.ContentWrapper; -public sealed class ContentFieldProperty : CustomProperty +public sealed class ContentFieldProperty(ContentFieldObject contentField, JsonValue contentValue = default) : CustomProperty { - private readonly ContentFieldObject contentField; - private JsonValue contentValue; private JsValue? value; private bool isChanged; @@ -59,10 +57,4 @@ public bool IsChanged { get => isChanged; } - - public ContentFieldProperty(ContentFieldObject contentField, JsonValue contentValue = default) - { - this.contentField = contentField; - this.contentValue = contentValue; - } } diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Extensions/HttpJintExtension.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Extensions/HttpJintExtension.cs index 0683f12155..8d992ce2eb 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Extensions/HttpJintExtension.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Extensions/HttpJintExtension.cs @@ -16,16 +16,10 @@ namespace Squidex.Domain.Apps.Core.Scripting.Extensions; -public sealed class HttpJintExtension : IJintExtension, IScriptDescriptor +public sealed class HttpJintExtension(IHttpClientFactory httpClientFactory) : IJintExtension, IScriptDescriptor { private delegate void HttpJsonDelegate(string url, Action callback, JsValue? headers = null, bool ignoreError = false); private delegate void HttpJsonWithBodyDelegate(string url, JsValue body, Action callback, JsValue? headers = null, bool ignoreError = false); - private readonly IHttpClientFactory httpClientFactory; - - public HttpJintExtension(IHttpClientFactory httpClientFactory) - { - this.httpClientFactory = httpClientFactory; - } public void ExtendAsync(ScriptExecutionContext context) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Extensions/StringAsyncJintExtension.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Extensions/StringAsyncJintExtension.cs index 27b9b8dc9b..5042ab8155 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Extensions/StringAsyncJintExtension.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Extensions/StringAsyncJintExtension.cs @@ -15,18 +15,10 @@ namespace Squidex.Domain.Apps.Core.Scripting.Extensions; -public sealed class StringAsyncJintExtension : IJintExtension, IScriptDescriptor +public sealed class StringAsyncJintExtension(ITranslator translator, IChatAgent chatAgent) : IJintExtension, IScriptDescriptor { private delegate void TextGenerateDelegate(string prompt, Action callback); private delegate void TextTranslateDelegate(string text, string language, Action callback, string sourceLanguage); - private readonly ITranslator translator; - private readonly IChatAgent chatAgent; - - public StringAsyncJintExtension(ITranslator translator, IChatAgent chatAgent) - { - this.translator = translator; - this.chatAgent = chatAgent; - } public void ExtendAsync(ScriptExecutionContext context) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Internal/CacheParser.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Internal/CacheParser.cs index fe3aa6b512..5e731f32cd 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Internal/CacheParser.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Internal/CacheParser.cs @@ -11,17 +11,10 @@ namespace Squidex.Domain.Apps.Core.Scripting.Internal; -internal sealed class CacheParser +internal sealed class CacheParser(IMemoryCache cache) { private static readonly TimeSpan CacheDuration = TimeSpan.FromMinutes(10); - private readonly IMemoryCache cache; - - public CacheParser(IMemoryCache cache) - { - this.cache = cache; - } - public Prepared