Browse Source

Code styling fixes.

pull/581/head
Sebastian 5 years ago
parent
commit
0159b8fde1
  1. 2
      backend/extensions/Squidex.Extensions/APM/Datadog/DatadogPlugin.cs
  2. 4
      backend/extensions/Squidex.Extensions/Actions/Email/EmailActionHandler.cs
  3. 6
      backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaProducer.cs
  4. 6
      backend/extensions/Squidex.Extensions/Validation/CompositeUniqueValidator.cs
  5. 2
      backend/i18n/source/backend_en.json
  6. 2
      backend/i18n/source/backend_it.json
  7. 2
      backend/i18n/source/backend_nl.json
  8. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Apps/Json/RolesConverter.cs
  9. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Apps/Roles.cs
  10. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Contents/Status.cs
  11. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Schemas/NestedField{T}.cs
  12. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Schemas/RootField{T}.cs
  13. 4
      backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleEventFormatter.cs
  14. 2
      backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Extensions/HttpJintExtension.cs
  15. 10
      backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/ScriptOperations.cs
  16. 2
      backend/src/Squidex.Domain.Apps.Entities.MongoDb/FullText/MongoTextIndex.cs
  17. 2
      backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppContributors.cs
  18. 2
      backend/src/Squidex.Domain.Apps.Entities/Assets/FileTagAssetMetadataSource.cs
  19. 2
      backend/src/Squidex.Domain.Apps.Entities/Contents/BulkUpdateCommandMiddleware.cs
  20. 2
      backend/src/Squidex.Domain.Apps.Entities/Contents/ContentOperationContext.cs
  21. 2
      backend/src/Squidex.Domain.Apps.Entities/Contents/ContentsSearchSource.cs
  22. 2
      backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLExecutionContext.cs
  23. 10
      backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/ContentActions.cs
  24. 2
      backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ConvertData.cs
  25. 2
      backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ResolveAssets.cs
  26. 2
      backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ResolveReferences.cs
  27. 2
      backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ScriptContent.cs
  28. 2
      backend/src/Squidex.Domain.Apps.Entities/Contents/Text/Elastic/ElasticSearchTextIndex.cs
  29. 4
      backend/src/Squidex.Domain.Apps.Entities/Context.cs
  30. 2
      backend/src/Squidex.Domain.Apps.Entities/Rules/RuleDequeuerGrain.cs
  31. 4
      backend/src/Squidex.Domain.Apps.Entities/Schemas/Indexes/SchemasIndex.cs
  32. 11
      backend/src/Squidex.Domain.Apps.Entities/Schemas/SchemaDomainObject.cs
  33. 2
      backend/src/Squidex.Domain.Users.MongoDb/MongoKeyStore.cs
  34. 1
      backend/src/Squidex.Domain.Users/DefaultUserResolver.cs
  35. 2
      backend/src/Squidex.Infrastructure.Amazon/Assets/AmazonS3AssetStore.cs
  36. 4
      backend/src/Squidex.Infrastructure.Azure/Assets/AzureBlobAssetStore.cs
  37. 2
      backend/src/Squidex.Infrastructure.GoogleCloud/Assets/GoogleCloudAssetStore.cs
  38. 4
      backend/src/Squidex.Infrastructure.MongoDb/Assets/MongoGridFsAssetStore.cs
  39. 2
      backend/src/Squidex.Infrastructure.MongoDb/MongoDb/MongoExtensions.cs
  40. 6
      backend/src/Squidex.Infrastructure/Assets/ImageSharp/ImageSharpAssetThumbnailGenerator.cs
  41. 2
      backend/src/Squidex.Infrastructure/BytesRange.cs
  42. 2
      backend/src/Squidex.Infrastructure/Email/SmtpEmailSender.cs
  43. 2
      backend/src/Squidex.Infrastructure/Log/ISemanticLog.cs
  44. 2
      backend/src/Squidex.Infrastructure/Orleans/J{T}.cs
  45. 6
      backend/src/Squidex.Infrastructure/Tasks/AsyncHelper.cs
  46. 2
      backend/src/Squidex.Infrastructure/Translations/ResourcesLocalizer.cs
  47. 2
      backend/src/Squidex.Infrastructure/ValueStopwatch.cs
  48. 2
      backend/src/Squidex.Shared/Texts.it.resx
  49. 2
      backend/src/Squidex.Shared/Texts.nl.resx
  50. 2
      backend/src/Squidex.Shared/Texts.resx
  51. 2
      backend/src/Squidex.Web/Deferred.cs
  52. 3
      backend/src/Squidex.Web/Pipeline/ApiCostsFilter.cs
  53. 3
      backend/src/Squidex.Web/Pipeline/AppResolver.cs
  54. 13
      backend/src/Squidex/Areas/Api/Config/OpenApi/OpenApiServices.cs
  55. 3
      backend/src/Squidex/Areas/Api/Controllers/Apps/AppsController.cs
  56. 8
      backend/src/Squidex/Areas/Api/Controllers/Assets/AssetContentController.cs
  57. 8
      backend/src/Squidex/Areas/Api/Controllers/Assets/AssetFoldersController.cs
  58. 10
      backend/src/Squidex/Areas/Api/Controllers/Assets/AssetsController.cs
  59. 2
      backend/src/Squidex/Areas/Api/Controllers/Assets/Models/AssetDto.cs
  60. 2
      backend/src/Squidex/Areas/Api/Controllers/Assets/Models/AssetFoldersDto.cs
  61. 1
      backend/src/Squidex/Areas/Api/Controllers/Contents/Models/GraphQLGetDto.cs
  62. 1
      backend/src/Squidex/Areas/Api/Controllers/Contents/Models/GraphQLPostDto.cs
  63. 10
      backend/src/Squidex/Areas/Api/Controllers/Rules/RulesController.cs
  64. 20
      backend/src/Squidex/Areas/Api/Controllers/Schemas/SchemasController.cs
  65. 2
      backend/src/Squidex/Areas/Api/Controllers/Users/UsersController.cs
  66. 2
      backend/src/Squidex/Areas/IdentityServer/Views/Account/Login.cshtml
  67. 2
      backend/src/Squidex/Areas/IdentityServer/Views/Error/Error.cshtml
  68. 8
      backend/src/Squidex/Areas/IdentityServer/Views/Profile/Profile.cshtml
  69. 2
      backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/RolesJsonTests.cs
  70. 3
      backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/EventSynchronization/SchemaSynchronizerTests.cs
  71. 4
      backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/ExpressionsAttribute.cs
  72. 6
      backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleEventFormatterCompareTests.cs
  73. 6
      backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleEventFormatterTests.cs
  74. 4
      backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/AssetsValidatorTests.cs
  75. 2
      backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/ReferencesValidatorTests.cs
  76. 4
      backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/UniqueValidatorTests.cs
  77. 3
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DefaultAppLogStoreTests.cs
  78. 1
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Guards/GuardAppRolesTests.cs
  79. 4
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/FileTagAssetMetadataSourceTests.cs
  80. 2
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/ImageAssetMetadataSourceTests.cs
  81. 2
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/RecursiveDeleterTests.cs
  82. 2
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/CommentTriggerHandlerTests.cs
  83. 2
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentDomainObjectTests.cs
  84. 2
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/TestAsset.cs
  85. 12
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Guard/GuardContentTests.cs
  86. 4
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryFixture.cs
  87. 2
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ResolveReferencesTests.cs
  88. 2
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ScriptContentTests.cs
  89. 2
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ReferenceFluidExtensionTests.cs
  90. 2
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/CachingTextIndexerStateTests.cs
  91. 2
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Queries/RuleEnricherTests.cs
  92. 2
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/RuleEnqueuerTests.cs
  93. 2
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/GuardSchemaTests.cs
  94. 2
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Tags/TagGrainTests.cs
  95. 2
      backend/tests/Squidex.Infrastructure.Tests/BytesRangeTests.cs
  96. 4
      backend/tests/Squidex.Infrastructure.Tests/Orleans/PubSubTests.cs
  97. 2
      backend/tests/Squidex.Infrastructure.Tests/Queries/QueryJsonConversionTests.cs
  98. 2
      backend/tests/Squidex.Infrastructure.Tests/Reflection/SimpleEqualsTests.cs
  99. 2
      backend/tests/Squidex.Infrastructure.Tests/UsageTracking/BackgroundUsageTrackerTests.cs
  100. 4
      backend/tests/Squidex.Infrastructure.Tests/ValidationExceptionTests.cs

2
backend/extensions/Squidex.Extensions/APM/Datadog/DatadogPlugin.cs

@ -15,7 +15,7 @@ using Microsoft.Extensions.DependencyInjection;
using Squidex.Infrastructure.Log; using Squidex.Infrastructure.Log;
using Squidex.Infrastructure.Plugins; using Squidex.Infrastructure.Plugins;
namespace Squidex.Extensions.APM.Datadoq namespace Squidex.Extensions.APM.Datadog
{ {
public sealed class DatadogPlugin : IPlugin, IStartupFilter public sealed class DatadogPlugin : IPlugin, IStartupFilter
{ {

4
backend/extensions/Squidex.Extensions/Actions/Email/EmailActionHandler.cs

@ -69,13 +69,13 @@ namespace Squidex.Extensions.Actions.Email
return Result.Complete(); return Result.Complete();
} }
private async Task CheckConnectionAsync(EmailJob job, CancellationToken ct) private static async Task CheckConnectionAsync(EmailJob job, CancellationToken ct)
{ {
using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
{ {
var tcs = new TaskCompletionSource<IAsyncResult>(); var tcs = new TaskCompletionSource<IAsyncResult>();
var state = socket.BeginConnect(job.ServerHost, job.ServerPort, tcs.SetResult, null); socket.BeginConnect(job.ServerHost, job.ServerPort, tcs.SetResult, null);
using (ct.Register(() => using (ct.Register(() =>
{ {

6
backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaProducer.cs

@ -131,7 +131,7 @@ namespace Squidex.Extensions.Actions.Kafka
} }
} }
private async Task ProduceAsync<T>(IProducer<string, T> producer, Message<string, T> message, KafkaJob job, CancellationToken ct) private static async Task ProduceAsync<T>(IProducer<string, T> producer, Message<string, T> message, KafkaJob job, CancellationToken ct)
{ {
message.Key = job.MessageKey; message.Key = job.MessageKey;
@ -161,7 +161,7 @@ namespace Squidex.Extensions.Actions.Kafka
{ {
try try
{ {
var schema = (RecordSchema)Avro.Schema.Parse(avroSchema); var schema = (RecordSchema)Schema.Parse(avroSchema);
var jsonObject = jsonSerializer.Deserialize<JsonObject>(json); var jsonObject = jsonSerializer.Deserialize<JsonObject>(json);
@ -181,7 +181,7 @@ namespace Squidex.Extensions.Actions.Kafka
avroProducer?.Dispose(); avroProducer?.Dispose();
} }
private object GetValue(IJsonValue value, Schema schema) private static object GetValue(IJsonValue value, Schema schema)
{ {
switch (value) switch (value)
{ {

6
backend/extensions/Squidex.Extensions/Validation/CompositeUniqueValidator.cs

@ -78,15 +78,15 @@ namespace Squidex.Extensions.Validation
{ {
case BooleanFieldProperties _ when value is JsonBoolean boolean: case BooleanFieldProperties _ when value is JsonBoolean boolean:
return boolean.Value; return boolean.Value;
case BooleanFieldProperties _ when value is JsonNull _: case BooleanFieldProperties _ when value is JsonNull:
return ClrValue.Null; return ClrValue.Null;
case NumberFieldProperties _ when value is JsonNumber number: case NumberFieldProperties _ when value is JsonNumber number:
return number.Value; return number.Value;
case NumberFieldProperties _ when value is JsonNull _: case NumberFieldProperties _ when value is JsonNull:
return ClrValue.Null; return ClrValue.Null;
case StringFieldProperties _ when value is JsonString @string: case StringFieldProperties _ when value is JsonString @string:
return @string.Value; return @string.Value;
case StringFieldProperties _ when value is JsonNull _: case StringFieldProperties _ when value is JsonNull:
return ClrValue.Null; return ClrValue.Null;
case ReferencesFieldProperties _ when value is JsonArray array && array.FirstOrDefault() is JsonString @string: case ReferencesFieldProperties _ when value is JsonArray array && array.FirstOrDefault() is JsonString @string:
return @string.Value; return @string.Value;

2
backend/i18n/source/backend_en.json

@ -66,7 +66,7 @@
"common.httpValidationError": "Validation error", "common.httpValidationError": "Validation error",
"common.initialStep": "Initial step", "common.initialStep": "Initial step",
"common.jsError": "Failed to execute script with Javascript error: {message}", "common.jsError": "Failed to execute script with Javascript error: {message}",
"common.jsNotAlloweed": "Script has forbidden the operation.", "common.jsNotAllowed": "Script has forbidden the operation.",
"common.jsParseError": "Failed to execute script with Javascript syntax error: {message}", "common.jsParseError": "Failed to execute script with Javascript syntax error: {message}",
"common.jsRejected": "Script rejected the operation.", "common.jsRejected": "Script rejected the operation.",
"common.language": "Language code", "common.language": "Language code",

2
backend/i18n/source/backend_it.json

@ -66,7 +66,7 @@
"common.httpValidationError": "Errore di validazione", "common.httpValidationError": "Errore di validazione",
"common.initialStep": "Step iniziale", "common.initialStep": "Step iniziale",
"common.jsError": "Esecuzione dello script fallita, Errore Javascript: {message}", "common.jsError": "Esecuzione dello script fallita, Errore Javascript: {message}",
"common.jsNotAlloweed": "Uno script ha proibito l'operazione.", "common.jsNotAllowed": "Uno script ha proibito l'operazione.",
"common.jsParseError": "Esecuzione dello script fallita, errore di sintassi nel Javascript: {message}", "common.jsParseError": "Esecuzione dello script fallita, errore di sintassi nel Javascript: {message}",
"common.jsRejected": "Lo script ha rifiutato l'operazione.", "common.jsRejected": "Lo script ha rifiutato l'operazione.",
"common.language": "Codice della lingua", "common.language": "Codice della lingua",

2
backend/i18n/source/backend_nl.json

@ -61,7 +61,7 @@
"common.httpValidationError": "Validatiefout", "common.httpValidationError": "Validatiefout",
"common.initialStep": "Eerste stap", "common.initialStep": "Eerste stap",
"common.jsError": "Kan script niet uitvoeren met Javascript-fout: {message}", "common.jsError": "Kan script niet uitvoeren met Javascript-fout: {message}",
"common.jsNotAlloweed": "Script heeft de bewerking verboden.", "common.jsNotAllowed": "Script heeft de bewerking verboden.",
"common.jsParseError": "Kan script niet uitvoeren met Javascript-syntaxisfout: {message}", "common.jsParseError": "Kan script niet uitvoeren met Javascript-syntaxisfout: {message}",
"common.jsRejected": "Script heeft de bewerking afgewezen.", "common.jsRejected": "Script heeft de bewerking afgewezen.",
"common.language": "Taalcode", "common.language": "Taalcode",

2
backend/src/Squidex.Domain.Apps.Core.Model/Apps/Json/RolesConverter.cs

@ -25,7 +25,7 @@ namespace Squidex.Domain.Apps.Core.Apps.Json
json.Add(role.Name, new JsonRole json.Add(role.Name, new JsonRole
{ {
Permissions = role.Permissions.ToIds().ToArray(), Permissions = role.Permissions.ToIds().ToArray(),
Properties = role.Properties, Properties = role.Properties
}); });
} }

2
backend/src/Squidex.Domain.Apps.Core.Model/Apps/Roles.cs

@ -55,7 +55,7 @@ namespace Squidex.Domain.Apps.Core.Apps
Clean(Permissions.AppRules), Clean(Permissions.AppRules),
Clean(Permissions.AppSchemas), Clean(Permissions.AppSchemas),
Clean(Permissions.AppWorkflows)), Clean(Permissions.AppWorkflows)),
JsonValue.Object()), JsonValue.Object())
}; };
public static readonly Roles Empty = new Roles(new ImmutableDictionary<string, Role>()); public static readonly Roles Empty = new Roles(new ImmutableDictionary<string, Role>());

2
backend/src/Squidex.Domain.Apps.Core.Model/Contents/Status.cs

@ -12,7 +12,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Squidex.Domain.Apps.Core.Contents namespace Squidex.Domain.Apps.Core.Contents
{ {
[TypeConverter(typeof(StatusConverter))] [TypeConverter(typeof(StatusConverter))]
public struct Status : IEquatable<Status>, IComparable<Status> public readonly struct Status : IEquatable<Status>, IComparable<Status>
{ {
public static readonly Status Archived = new Status("Archived"); public static readonly Status Archived = new Status("Archived");
public static readonly Status Draft = new Status("Draft"); public static readonly Status Draft = new Status("Draft");

2
backend/src/Squidex.Domain.Apps.Core.Model/Schemas/NestedField{T}.cs

@ -55,7 +55,7 @@ namespace Squidex.Domain.Apps.Core.Schemas
properties.Freeze(); properties.Freeze();
} }
private T ValidateProperties(FieldProperties newProperties) private static T ValidateProperties(FieldProperties newProperties)
{ {
Guard.NotNull(newProperties, nameof(newProperties)); Guard.NotNull(newProperties, nameof(newProperties));

2
backend/src/Squidex.Domain.Apps.Core.Model/Schemas/RootField{T}.cs

@ -53,7 +53,7 @@ namespace Squidex.Domain.Apps.Core.Schemas
properties.Freeze(); properties.Freeze();
} }
private T ValidateProperties(FieldProperties newProperties) private static T ValidateProperties(FieldProperties newProperties)
{ {
Guard.NotNull(newProperties, nameof(newProperties)); Guard.NotNull(newProperties, nameof(newProperties));

4
backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleEventFormatter.cs

@ -137,7 +137,7 @@ namespace Squidex.Domain.Apps.Core.HandleRules
return CombineParts(text, parts); return CombineParts(text, parts);
} }
private string CombineParts(string text, List<TextPart> parts) private static string CombineParts(string text, List<TextPart> parts)
{ {
var span = text.AsSpan(); var span = text.AsSpan();
@ -225,7 +225,7 @@ namespace Squidex.Domain.Apps.Core.HandleRules
return default; return default;
} }
private (bool IsNew, Match) Match(string test) private static (bool IsNew, Match) Match(string test)
{ {
var match = RegexPatternNew.Match(test); var match = RegexPatternNew.Match(test);

2
backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Extensions/HttpJintExtension.cs

@ -102,7 +102,7 @@ namespace Squidex.Domain.Apps.Core.Scripting.Extensions
return request; return request;
} }
private async Task<JsValue> ParseResponse(ExecutionContext context, HttpResponseMessage response) private static async Task<JsValue> ParseResponse(ExecutionContext context, HttpResponseMessage response)
{ {
var responseString = await response.Content.ReadAsStringAsync(); var responseString = await response.Content.ReadAsStringAsync();

10
backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/ScriptOperations.cs

@ -16,19 +16,19 @@ namespace Squidex.Domain.Apps.Core.Scripting
{ {
private delegate void MessageDelegate(string? message); private delegate void MessageDelegate(string? message);
private static readonly MessageDelegate Disallow = new MessageDelegate(message => private static readonly MessageDelegate Disallow = message =>
{ {
message = !string.IsNullOrWhiteSpace(message) ? message : T.Get("common.jsNotAlloweed"); message = !string.IsNullOrWhiteSpace(message) ? message : T.Get("common.jsNotAllowed");
throw new DomainForbiddenException(message); throw new DomainForbiddenException(message);
}); };
private static readonly MessageDelegate Reject = new MessageDelegate(message => private static readonly MessageDelegate Reject = message =>
{ {
message = !string.IsNullOrWhiteSpace(message) ? message : T.Get("common.jsRejected"); message = !string.IsNullOrWhiteSpace(message) ? message : T.Get("common.jsRejected");
throw new ValidationException(message); throw new ValidationException(message);
}); };
public static Engine AddDisallow(this Engine engine) public static Engine AddDisallow(this Engine engine)
{ {

2
backend/src/Squidex.Domain.Apps.Entities.MongoDb/FullText/MongoTextIndex.cs

@ -55,7 +55,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.FullText
{ {
switch (command) switch (command)
{ {
case DeleteIndexEntry delete: case DeleteIndexEntry _:
writes.Add( writes.Add(
new DeleteOneModel<MongoTextIndexEntity>( new DeleteOneModel<MongoTextIndexEntity>(
Filter.Eq(x => x.DocId, command.DocId))); Filter.Eq(x => x.DocId, command.DocId)));

2
backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppContributors.cs

@ -51,7 +51,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Guards
throw new DomainForbiddenException(T.Get("apps.contributors.cannotChangeYourself")); throw new DomainForbiddenException(T.Get("apps.contributors.cannotChangeYourself"));
} }
if (!contributors.TryGetValue(command.ContributorId, out var role)) if (!contributors.TryGetValue(command.ContributorId, out _))
{ {
if (plan != null && plan.MaxContributors > 0 && contributors.Count >= plan.MaxContributors) if (plan != null && plan.MaxContributors > 0 && contributors.Count >= plan.MaxContributors)
{ {

2
backend/src/Squidex.Domain.Apps.Entities/Assets/FileTagAssetMetadataSource.cs

@ -59,7 +59,7 @@ namespace Squidex.Domain.Apps.Entities.Assets
return Task.CompletedTask; return Task.CompletedTask;
} }
private void Enhance(UploadAssetCommand command) private static void Enhance(UploadAssetCommand command)
{ {
try try
{ {

2
backend/src/Squidex.Domain.Apps.Entities/Contents/BulkUpdateCommandMiddleware.cs

@ -102,7 +102,7 @@ namespace Squidex.Domain.Apps.Entities.Contents
case BulkUpdateType.Delete: case BulkUpdateType.Delete:
{ {
if (id == null || id == default) if (id == null || id.Value == default)
{ {
throw new DomainObjectNotFoundException("undefined"); throw new DomainObjectNotFoundException("undefined");
} }

2
backend/src/Squidex.Domain.Apps.Entities/Contents/ContentOperationContext.cs

@ -114,7 +114,7 @@ namespace Squidex.Domain.Apps.Entities.Contents
CheckErrors(validator); CheckErrors(validator);
} }
private void CheckErrors(ContentValidator validator) private static void CheckErrors(ContentValidator validator)
{ {
if (validator.Errors.Count > 0) if (validator.Errors.Count > 0)
{ {

2
backend/src/Squidex.Domain.Apps.Entities/Contents/ContentsSearchSource.cs

@ -109,7 +109,7 @@ namespace Squidex.Domain.Apps.Entities.Contents
return context.Permissions.Allows(permission); return context.Permissions.Allows(permission);
} }
private string FormatName(IEnrichedContentEntity content, string masterLanguage) private static string FormatName(IEnrichedContentEntity content, string masterLanguage)
{ {
var sb = new StringBuilder(); var sb = new StringBuilder();

2
backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLExecutionContext.cs

@ -33,8 +33,6 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL
public ICommandBus CommandBus { get; } public ICommandBus CommandBus { get; }
public ISemanticLog Log { get; }
public GraphQLExecutionContext(Context context, IServiceProvider resolver) public GraphQLExecutionContext(Context context, IServiceProvider resolver)
: base(context : base(context
.WithoutCleanup() .WithoutCleanup()

10
backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/ContentActions.cs

@ -37,7 +37,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
} }
}; };
public static readonly ValueResolver Resolver = new ValueResolver((value, c) => public static readonly ValueResolver Resolver = (value, c) =>
{ {
if (c.Arguments.TryGetValue("path", out var p) && p is string path) if (c.Arguments.TryGetValue("path", out var p) && p is string path)
{ {
@ -47,7 +47,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
} }
return value; return value;
}); };
} }
public static readonly QueryArguments JsonPath = new QueryArguments public static readonly QueryArguments JsonPath = new QueryArguments
@ -124,7 +124,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
Description = "Optional OData full text search.", Description = "Optional OData full text search.",
DefaultValue = string.Empty, DefaultValue = string.Empty,
ResolvedType = AllTypes.String ResolvedType = AllTypes.String
}, }
}; };
} }
@ -152,7 +152,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
Name = "data", Name = "data",
Description = "The data for the content.", Description = "The data for the content.",
DefaultValue = null, DefaultValue = null,
ResolvedType = new NonNullGraphType(inputType), ResolvedType = new NonNullGraphType(inputType)
}, },
new QueryArgument(AllTypes.None) new QueryArgument(AllTypes.None)
{ {
@ -194,7 +194,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
Name = "data", Name = "data",
Description = "The data for the content.", Description = "The data for the content.",
DefaultValue = null, DefaultValue = null,
ResolvedType = new NonNullGraphType(inputType), ResolvedType = new NonNullGraphType(inputType)
}, },
new QueryArgument(AllTypes.None) new QueryArgument(AllTypes.None)
{ {

2
backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ConvertData.cs

@ -38,8 +38,6 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries.Steps
public async Task EnrichAsync(Context context, IEnumerable<ContentEntity> contents, ProvideSchema schemas) public async Task EnrichAsync(Context context, IEnumerable<ContentEntity> contents, ProvideSchema schemas)
{ {
var resolveDataDraft = context.ShouldProvideUnpublished() || context.IsFrontendClient;
var referenceCleaner = await CleanReferencesAsync(context, contents, schemas); var referenceCleaner = await CleanReferencesAsync(context, contents, schemas);
var converters = GenerateConverters(context, referenceCleaner).ToArray(); var converters = GenerateConverters(context, referenceCleaner).ToArray();

2
backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ResolveAssets.cs

@ -125,7 +125,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries.Steps
return assets.ToLookup(x => x.Id); return assets.ToLookup(x => x.Id);
} }
private void AddAssetIds(HashSet<Guid> ids, ISchemaEntity schema, IEnumerable<ContentEntity> contents) private static void AddAssetIds(HashSet<Guid> ids, ISchemaEntity schema, IEnumerable<ContentEntity> contents)
{ {
foreach (var content in contents) foreach (var content in contents)
{ {

2
backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ResolveReferences.cs

@ -141,7 +141,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries.Steps
return value; return value;
} }
private void AddReferenceIds(HashSet<Guid> ids, ISchemaEntity schema, IEnumerable<ContentEntity> contents) private static void AddReferenceIds(HashSet<Guid> ids, ISchemaEntity schema, IEnumerable<ContentEntity> contents)
{ {
foreach (var content in contents) foreach (var content in contents)
{ {

2
backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ScriptContent.cs

@ -36,8 +36,6 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries.Steps
if (!string.IsNullOrWhiteSpace(script)) if (!string.IsNullOrWhiteSpace(script))
{ {
var results = new List<IEnrichedContentEntity>();
await Task.WhenAll(group.Select(x => TransformAsync(context, script, x))); await Task.WhenAll(group.Select(x => TransformAsync(context, script, x)));
} }
} }

2
backend/src/Squidex.Domain.Apps.Entities/Contents/Text/Elastic/ElasticSearchTextIndex.cs

@ -76,7 +76,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text.Elastic
schemaName = upsert.SchemaId.Name, schemaName = upsert.SchemaId.Name,
serveAll = upsert.ServeAll, serveAll = upsert.ServeAll,
servePublished = upsert.ServePublished, servePublished = upsert.ServePublished,
texts = upsert.Texts, texts = upsert.Texts
}; };
var result = await client.IndexAsync<StringResponse>(indexName, upsert.DocId, CreatePost(data)); var result = await client.IndexAsync<StringResponse>(indexName, upsert.DocId, CreatePost(data));

4
backend/src/Squidex.Domain.Apps.Entities/Context.cs

@ -26,9 +26,9 @@ namespace Squidex.Domain.Apps.Entities
public ClaimsPrincipal User { get; } public ClaimsPrincipal User { get; }
public ClaimsPermissions Permissions { get; } = ClaimsPermissions.Empty; public ClaimsPermissions Permissions { get; }
public bool IsFrontendClient { get; private set; } public bool IsFrontendClient { get; }
public Context(ClaimsPrincipal user) public Context(ClaimsPrincipal user)
{ {

2
backend/src/Squidex.Domain.Apps.Entities/Rules/RuleDequeuerGrain.cs

@ -112,7 +112,7 @@ namespace Squidex.Domain.Apps.Entities.Rules
ExecutionResult = response.Status, ExecutionResult = response.Status,
Finished = now, Finished = now,
JobNext = jobDelay, JobNext = jobDelay,
JobResult = ComputeJobResult(response.Status, jobDelay) JobResult = jobResult
}; };
await ruleEventRepository.UpdateAsync(@event.Job, update); await ruleEventRepository.UpdateAsync(@event.Job, update);

4
backend/src/Squidex.Domain.Apps.Entities/Schemas/Indexes/SchemasIndex.cs

@ -211,12 +211,12 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Indexes
return schema; return schema;
} }
private string GetCacheKey(Guid appId, string name) private static string GetCacheKey(Guid appId, string name)
{ {
return $"SCHEMAS_NAME_{appId}_{name}"; return $"SCHEMAS_NAME_{appId}_{name}";
} }
private string GetCacheKey(Guid appId, Guid id) private static string GetCacheKey(Guid appId, Guid id)
{ {
return $"SCHEMAS_ID_{appId}_{id}"; return $"SCHEMAS_ID_{appId}_{id}";
} }

11
backend/src/Squidex.Domain.Apps.Entities/Schemas/SchemaDomainObject.cs

@ -45,17 +45,6 @@ namespace Squidex.Domain.Apps.Entities.Schemas
Add(c); Add(c);
long id;
if (c.ParentFieldId == null)
{
id = Snapshot.SchemaDef.FieldsByName[c.Name].Id;
}
else
{
id = ((IArrayField)Snapshot.SchemaDef.FieldsById[c.ParentFieldId.Value]).FieldsByName[c.Name].Id;
}
return Snapshot; return Snapshot;
}); });

2
backend/src/Squidex.Domain.Users.MongoDb/MongoKeyStore.cs

@ -93,7 +93,7 @@ namespace Squidex.Domain.Users.MongoDb
} }
else else
{ {
throw ex; throw;
} }
} }
} }

1
backend/src/Squidex.Domain.Users/DefaultUserResolver.cs

@ -94,7 +94,6 @@ namespace Squidex.Domain.Users
using (var scope = serviceProvider.CreateScope()) using (var scope = serviceProvider.CreateScope())
{ {
var userFactory = scope.ServiceProvider.GetRequiredService<IUserFactory>();
var userManager = scope.ServiceProvider.GetRequiredService<UserManager<IdentityUser>>(); var userManager = scope.ServiceProvider.GetRequiredService<UserManager<IdentityUser>>();
return await userManager.FindByIdWithClaimsAsync(id); return await userManager.FindByIdWithClaimsAsync(id);

2
backend/src/Squidex.Infrastructure.Amazon/Assets/AmazonS3AssetStore.cs

@ -193,7 +193,7 @@ namespace Squidex.Infrastructure.Assets
using (tempStream) using (tempStream)
{ {
await stream.CopyToAsync(tempStream); await stream.CopyToAsync(tempStream, ct);
request.InputStream = tempStream; request.InputStream = tempStream;

4
backend/src/Squidex.Infrastructure.Azure/Assets/AzureBlobAssetStore.cs

@ -38,7 +38,7 @@ namespace Squidex.Infrastructure.Assets
var blobClient = storageAccount.CreateCloudBlobClient(); var blobClient = storageAccount.CreateCloudBlobClient();
var blobReference = blobClient.GetContainerReference(containerName); var blobReference = blobClient.GetContainerReference(containerName);
await blobReference.CreateIfNotExistsAsync(); await blobReference.CreateIfNotExistsAsync(ct);
blobContainer = blobReference; blobContainer = blobReference;
} }
@ -70,7 +70,7 @@ namespace Squidex.Infrastructure.Assets
{ {
var blob = blobContainer.GetBlockBlobReference(fileName); var blob = blobContainer.GetBlockBlobReference(fileName);
await blob.FetchAttributesAsync(); await blob.FetchAttributesAsync(ct);
return blob.Properties.Length; return blob.Properties.Length;
} }

2
backend/src/Squidex.Infrastructure.GoogleCloud/Assets/GoogleCloudAssetStore.cs

@ -34,7 +34,7 @@ namespace Squidex.Infrastructure.Assets
{ {
try try
{ {
storageClient = StorageClient.Create(); storageClient = await StorageClient.CreateAsync();
await storageClient.GetBucketAsync(bucketName, cancellationToken: ct); await storageClient.GetBucketAsync(bucketName, cancellationToken: ct);
} }

4
backend/src/Squidex.Infrastructure.MongoDb/Assets/MongoGridFsAssetStore.cs

@ -49,7 +49,9 @@ namespace Squidex.Infrastructure.Assets
{ {
var name = GetFileName(fileName, nameof(fileName)); var name = GetFileName(fileName, nameof(fileName));
var file = await bucket.Find(Builders<GridFSFileInfo<string>>.Filter.Eq(x => x.Id, name)).FirstOrDefaultAsync(); var query = await bucket.FindAsync(Builders<GridFSFileInfo<string>>.Filter.Eq(x => x.Id, name), cancellationToken: ct);
var file = await query.FirstOrDefaultAsync(cancellationToken: ct);
if (file == null) if (file == null)
{ {

2
backend/src/Squidex.Infrastructure.MongoDb/MongoDb/MongoExtensions.cs

@ -31,7 +31,7 @@ namespace Squidex.Infrastructure.MongoDb
Filter = new BsonDocument("name", collectionName) Filter = new BsonDocument("name", collectionName)
}; };
return (await database.ListCollectionNamesAsync(options)).Any(); return await (await database.ListCollectionNamesAsync(options)).AnyAsync();
} }
public static async Task<bool> InsertOneIfNotExistsAsync<T>(this IMongoCollection<T> collection, T document, CancellationToken ct = default) public static async Task<bool> InsertOneIfNotExistsAsync<T>(this IMongoCollection<T> collection, T document, CancellationToken ct = default)

6
backend/src/Squidex.Infrastructure/Assets/ImageSharp/ImageSharpAssetThumbnailGenerator.cs

@ -34,7 +34,7 @@ namespace Squidex.Infrastructure.Assets.ImageSharp
if (!options.IsValid) if (!options.IsValid)
{ {
source.CopyTo(destination); await source.CopyToAsync(destination);
return; return;
} }
@ -84,7 +84,7 @@ namespace Squidex.Infrastructure.Assets.ImageSharp
image.Mutate(x => x.Resize(resizeOptions)); image.Mutate(x => x.Resize(resizeOptions));
} }
image.Save(destination, encoder); await image.SaveAsync(destination, encoder);
} }
} }
finally finally
@ -93,7 +93,7 @@ namespace Squidex.Infrastructure.Assets.ImageSharp
} }
} }
private static IImageEncoder GetEncoder(ResizeOptions options, SixLabors.ImageSharp.Formats.IImageFormat? format) private static IImageEncoder GetEncoder(ResizeOptions options, IImageFormat? format)
{ {
var encoder = Configuration.Default.ImageFormatsManager.FindEncoder(format); var encoder = Configuration.Default.ImageFormatsManager.FindEncoder(format);

2
backend/src/Squidex.Infrastructure/BytesRange.cs

@ -9,7 +9,7 @@ using System;
namespace Squidex.Infrastructure namespace Squidex.Infrastructure
{ {
public struct BytesRange public readonly struct BytesRange
{ {
public readonly long? From; public readonly long? From;

2
backend/src/Squidex.Infrastructure/Email/SmtpEmailSender.cs

@ -88,7 +88,7 @@ namespace Squidex.Infrastructure.Email
{ {
var tcs = new TaskCompletionSource<IAsyncResult>(); var tcs = new TaskCompletionSource<IAsyncResult>();
var state = socket.BeginConnect(options.Server, options.Port, tcs.SetResult, null); socket.BeginConnect(options.Server, options.Port, tcs.SetResult, null);
using (ct.Register(() => using (ct.Register(() =>
{ {

2
backend/src/Squidex.Infrastructure/Log/ISemanticLog.cs

@ -11,7 +11,7 @@ namespace Squidex.Infrastructure.Log
{ {
public delegate void LogFormatter(IObjectWriter writer); public delegate void LogFormatter(IObjectWriter writer);
public delegate void LogFormatter<T>(T context, IObjectWriter writer); public delegate void LogFormatter<in T>(T context, IObjectWriter writer);
public interface ISemanticLog public interface ISemanticLog
{ {

2
backend/src/Squidex.Infrastructure/Orleans/J{T}.cs

@ -19,7 +19,7 @@ using Squidex.Infrastructure.Log;
namespace Squidex.Infrastructure.Orleans namespace Squidex.Infrastructure.Orleans
{ {
[Immutable] [Immutable]
public struct J<T> public readonly struct J<T>
{ {
public T Value { get; } public T Value { get; }

6
backend/src/Squidex.Infrastructure/Tasks/AsyncHelper.cs

@ -60,12 +60,12 @@ namespace Squidex.Infrastructure.Tasks
var timer = new Timer(_ => batchBlock.TriggerBatch()); var timer = new Timer(_ => batchBlock.TriggerBatch());
var timerBlock = new TransformBlock<T, T>((T value) => var timerBlock = new TransformBlock<T, T>(value =>
{ {
timer.Change(timeout, Timeout.Infinite); timer.Change(timeout, Timeout.Infinite);
return value; return value;
}, new ExecutionDataflowBlockOptions() }, new ExecutionDataflowBlockOptions
{ {
BoundedCapacity = 1, BoundedCapacity = 1,
CancellationToken = dataflowBlockOptions.CancellationToken, CancellationToken = dataflowBlockOptions.CancellationToken,
@ -76,7 +76,7 @@ namespace Squidex.Infrastructure.Tasks
TaskScheduler = dataflowBlockOptions.TaskScheduler TaskScheduler = dataflowBlockOptions.TaskScheduler
}); });
timerBlock.LinkTo(batchBlock, new DataflowLinkOptions() timerBlock.LinkTo(batchBlock, new DataflowLinkOptions
{ {
PropagateCompletion = true PropagateCompletion = true
}); });

2
backend/src/Squidex.Infrastructure/Translations/ResourcesLocalizer.cs

@ -175,7 +175,7 @@ namespace Squidex.Infrastructure.Translations
{ {
if (!missingTranslations.Add(key)) if (!missingTranslations.Add(key))
{ {
File.AppendAllLines(MissingFileName, new string[] { key }); File.AppendAllLines(MissingFileName, new[] { key });
} }
} }
#endif #endif

2
backend/src/Squidex.Infrastructure/ValueStopwatch.cs

@ -9,7 +9,7 @@ using System.Diagnostics;
namespace Squidex.Infrastructure namespace Squidex.Infrastructure
{ {
public struct ValueStopwatch public readonly struct ValueStopwatch
{ {
private const long TicksPerMillisecond = 10000; private const long TicksPerMillisecond = 10000;
private const long TicksPerSecond = TicksPerMillisecond * 1000; private const long TicksPerSecond = TicksPerMillisecond * 1000;

2
backend/src/Squidex.Shared/Texts.it.resx

@ -283,7 +283,7 @@
<data name="common.jsError" xml:space="preserve"> <data name="common.jsError" xml:space="preserve">
<value>Esecuzione dello script fallita, Errore Javascript: {message}</value> <value>Esecuzione dello script fallita, Errore Javascript: {message}</value>
</data> </data>
<data name="common.jsNotAlloweed" xml:space="preserve"> <data name="common.jsNotAllowed" xml:space="preserve">
<value>Uno script ha proibito l'operazione.</value> <value>Uno script ha proibito l'operazione.</value>
</data> </data>
<data name="common.jsParseError" xml:space="preserve"> <data name="common.jsParseError" xml:space="preserve">

2
backend/src/Squidex.Shared/Texts.nl.resx

@ -283,7 +283,7 @@
<data name="common.jsError" xml:space="preserve"> <data name="common.jsError" xml:space="preserve">
<value>Kan script niet uitvoeren met Javascript-fout: {message}</value> <value>Kan script niet uitvoeren met Javascript-fout: {message}</value>
</data> </data>
<data name="common.jsNotAlloweed" xml:space="preserve"> <data name="common.jsNotAllowed" xml:space="preserve">
<value>Script heeft de bewerking verboden.</value> <value>Script heeft de bewerking verboden.</value>
</data> </data>
<data name="common.jsParseError" xml:space="preserve"> <data name="common.jsParseError" xml:space="preserve">

2
backend/src/Squidex.Shared/Texts.resx

@ -283,7 +283,7 @@
<data name="common.jsError" xml:space="preserve"> <data name="common.jsError" xml:space="preserve">
<value>Failed to execute script with Javascript error: {message}</value> <value>Failed to execute script with Javascript error: {message}</value>
</data> </data>
<data name="common.jsNotAlloweed" xml:space="preserve"> <data name="common.jsNotAllowed" xml:space="preserve">
<value>Script has forbidden the operation.</value> <value>Script has forbidden the operation.</value>
</data> </data>
<data name="common.jsParseError" xml:space="preserve"> <data name="common.jsParseError" xml:space="preserve">

2
backend/src/Squidex.Web/Deferred.cs

@ -11,7 +11,7 @@ using Squidex.Infrastructure;
namespace Squidex.Web namespace Squidex.Web
{ {
public struct Deferred public readonly struct Deferred
{ {
private readonly Lazy<Task<object>> value; private readonly Lazy<Task<object>> value;

3
backend/src/Squidex.Web/Pipeline/ApiCostsFilter.cs

@ -6,6 +6,7 @@
// ========================================================================== // ==========================================================================
using System; using System;
using System.Globalization;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.Filters;
@ -64,7 +65,7 @@ namespace Squidex.Web.Pipeline
} }
} }
context.HttpContext.Response.Headers.Add("X-Costs", FilterDefinition.Costs.ToString()); context.HttpContext.Response.Headers.Add("X-Costs", FilterDefinition.Costs.ToString(CultureInfo.InvariantCulture));
} }
await next(); await next();

3
backend/src/Squidex.Web/Pipeline/AppResolver.cs

@ -6,7 +6,6 @@
// ========================================================================== // ==========================================================================
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Security.Claims; using System.Security.Claims;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -106,7 +105,7 @@ namespace Squidex.Web.Pipeline
await next(); await next();
} }
private Context SetContext(HttpContext httpContext, IAppEntity app) private static Context SetContext(HttpContext httpContext, IAppEntity app)
{ {
var requestContext = new Context(httpContext.User, app); var requestContext = new Context(httpContext.User, app);

13
backend/src/Squidex/Areas/Api/Config/OpenApi/OpenApiServices.cs

@ -17,6 +17,7 @@ using Squidex.Areas.Api.Controllers.Rules.Models;
using Squidex.Domain.Apps.Core.Assets; using Squidex.Domain.Apps.Core.Assets;
using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.Contents;
using Squidex.Infrastructure; using Squidex.Infrastructure;
using Squidex.Infrastructure.Json.Objects;
namespace Squidex.Areas.Api.Config.OpenApi namespace Squidex.Areas.Api.Config.OpenApi
{ {
@ -76,7 +77,14 @@ namespace Squidex.Areas.Api.Config.OpenApi
CreateStringMap<RefToken>(), CreateStringMap<RefToken>(),
CreateStringMap<Status>(), CreateStringMap<Status>(),
new PrimitiveTypeMapper(typeof(AssetMetadata), schema => CreateObjectMap<JsonObject>(),
CreateObjectMap<AssetMetadata>()
};
}
private static ITypeMapper CreateObjectMap<T>()
{
return new PrimitiveTypeMapper(typeof(T), schema =>
{ {
schema.Type = JsonObjectType.Object; schema.Type = JsonObjectType.Object;
@ -84,8 +92,7 @@ namespace Squidex.Areas.Api.Config.OpenApi
{ {
Description = "Any JSON type" Description = "Any JSON type"
}; };
}) });
};
} }
private static ITypeMapper CreateStringMap<T>(string? format = null) private static ITypeMapper CreateStringMap<T>(string? format = null)

3
backend/src/Squidex/Areas/Api/Controllers/Apps/AppsController.cs

@ -108,7 +108,6 @@ namespace Squidex.Areas.Api.Controllers.Apps
var response = Deferred.Response(() => var response = Deferred.Response(() =>
{ {
var userOrClientId = HttpContext.User.UserOrClientId()!; var userOrClientId = HttpContext.User.UserOrClientId()!;
var userPermissions = Resources.Permissions;
var isFrontend = HttpContext.User.IsInClient(DefaultClients.Frontend); var isFrontend = HttpContext.User.IsInClient(DefaultClients.Frontend);
@ -217,7 +216,7 @@ namespace Squidex.Areas.Api.Controllers.Apps
try try
{ {
await assetStore.DownloadAsync(resizedAsset, body); await assetStore.DownloadAsync(resizedAsset, body, ct: ct);
} }
catch (AssetNotFoundException) catch (AssetNotFoundException)
{ {

8
backend/src/Squidex/Areas/Api/Controllers/Assets/AssetContentController.cs

@ -143,7 +143,7 @@ namespace Squidex.Areas.Api.Controllers.Assets
if (asset.Type == AssetType.Image && resizeOptions.IsValid) if (asset.Type == AssetType.Image && resizeOptions.IsValid)
{ {
callback = new FileCallback(async (bodyStream, range, ct) => callback = async (bodyStream, range, ct) =>
{ {
var resizedAsset = $"{asset.Id}_{asset.FileVersion}_{resizeOptions}"; var resizedAsset = $"{asset.Id}_{asset.FileVersion}_{resizeOptions}";
@ -162,16 +162,16 @@ namespace Squidex.Areas.Api.Controllers.Assets
await ResizeAsync(asset, bodyStream, resizedAsset, resizeOptions, false, ct); await ResizeAsync(asset, bodyStream, resizedAsset, resizeOptions, false, ct);
} }
} }
}); };
} }
else else
{ {
contentLength = asset.FileSize; contentLength = asset.FileSize;
callback = new FileCallback(async (bodyStream, range, ct) => callback = async (bodyStream, range, ct) =>
{ {
await assetFileStore.DownloadAsync(asset.Id, asset.FileVersion, bodyStream, range, ct); await assetFileStore.DownloadAsync(asset.Id, asset.FileVersion, bodyStream, range, ct);
}); };
} }
return new FileCallbackResult(asset.MimeType, callback) return new FileCallbackResult(asset.MimeType, callback)

8
backend/src/Squidex/Areas/Api/Controllers/Assets/AssetFoldersController.cs

@ -85,7 +85,7 @@ namespace Squidex.Areas.Api.Controllers.Assets
{ {
var command = request.ToCommand(); var command = request.ToCommand();
var response = await InvokeCommandAsync(app, command); var response = await InvokeCommandAsync(command);
return CreatedAtAction(nameof(GetAssetFolders), new { parentId = request.ParentId, app }, response); return CreatedAtAction(nameof(GetAssetFolders), new { parentId = request.ParentId, app }, response);
} }
@ -111,7 +111,7 @@ namespace Squidex.Areas.Api.Controllers.Assets
{ {
var command = request.ToCommand(id); var command = request.ToCommand(id);
var response = await InvokeCommandAsync(app, command); var response = await InvokeCommandAsync(command);
return Ok(response); return Ok(response);
} }
@ -136,7 +136,7 @@ namespace Squidex.Areas.Api.Controllers.Assets
{ {
var command = request.ToFolderCommand(id); var command = request.ToFolderCommand(id);
var response = await InvokeCommandAsync(app, command); var response = await InvokeCommandAsync(command);
return Ok(response); return Ok(response);
} }
@ -161,7 +161,7 @@ namespace Squidex.Areas.Api.Controllers.Assets
return NoContent(); return NoContent();
} }
private async Task<AssetFolderDto> InvokeCommandAsync(string app, ICommand command) private async Task<AssetFolderDto> InvokeCommandAsync(ICommand command)
{ {
var context = await CommandBus.PublishAsync(command); var context = await CommandBus.PublishAsync(command);

10
backend/src/Squidex/Areas/Api/Controllers/Assets/AssetsController.cs

@ -193,7 +193,7 @@ namespace Squidex.Areas.Api.Controllers.Assets
var command = new CreateAsset { File = assetFile, ParentId = parentId }; var command = new CreateAsset { File = assetFile, ParentId = parentId };
var response = await InvokeCommandAsync(app, command); var response = await InvokeCommandAsync(command);
return CreatedAtAction(nameof(GetAsset), new { app, id = response.Id }, response); return CreatedAtAction(nameof(GetAsset), new { app, id = response.Id }, response);
} }
@ -223,7 +223,7 @@ namespace Squidex.Areas.Api.Controllers.Assets
var command = new UpdateAsset { File = assetFile, AssetId = id }; var command = new UpdateAsset { File = assetFile, AssetId = id };
var response = await InvokeCommandAsync(app, command); var response = await InvokeCommandAsync(command);
return Ok(response); return Ok(response);
} }
@ -249,7 +249,7 @@ namespace Squidex.Areas.Api.Controllers.Assets
{ {
var command = request.ToCommand(id); var command = request.ToCommand(id);
var response = await InvokeCommandAsync(app, command); var response = await InvokeCommandAsync(command);
return Ok(response); return Ok(response);
} }
@ -274,7 +274,7 @@ namespace Squidex.Areas.Api.Controllers.Assets
{ {
var command = request.ToCommand(id); var command = request.ToCommand(id);
var response = await InvokeCommandAsync(app, command); var response = await InvokeCommandAsync(command);
return Ok(response); return Ok(response);
} }
@ -299,7 +299,7 @@ namespace Squidex.Areas.Api.Controllers.Assets
return NoContent(); return NoContent();
} }
private async Task<AssetDto> InvokeCommandAsync(string app, ICommand command) private async Task<AssetDto> InvokeCommandAsync(ICommand command)
{ {
var context = await CommandBus.PublishAsync(command); var context = await CommandBus.PublishAsync(command);

2
backend/src/Squidex/Areas/Api/Controllers/Assets/Models/AssetDto.cs

@ -201,8 +201,6 @@ namespace Squidex.Areas.Api.Controllers.Assets.Models
response.AddDeleteLink("delete", resources.Url<AssetsController>(x => nameof(x.DeleteAsset), values)); response.AddDeleteLink("delete", resources.Url<AssetsController>(x => nameof(x.DeleteAsset), values));
} }
var version = response.FileVersion;
if (!string.IsNullOrWhiteSpace(response.Slug)) if (!string.IsNullOrWhiteSpace(response.Slug))
{ {
response.AddGetLink("content", resources.Url<AssetContentController>(x => nameof(x.GetAssetContentBySlug), new { app, idOrSlug = response.Id, more = response.Slug })); response.AddGetLink("content", resources.Url<AssetContentController>(x => nameof(x.GetAssetContentBySlug), new { app, idOrSlug = response.Id, more = response.Slug }));

2
backend/src/Squidex/Areas/Api/Controllers/Assets/Models/AssetFoldersDto.cs

@ -38,7 +38,7 @@ namespace Squidex.Areas.Api.Controllers.Assets.Models
var response = new AssetFoldersDto var response = new AssetFoldersDto
{ {
Total = assetFolders.Total, Total = assetFolders.Total,
Items = assetFolders.Select(x => AssetFolderDto.FromAssetFolder(x, resources)).ToArray(), Items = assetFolders.Select(x => AssetFolderDto.FromAssetFolder(x, resources)).ToArray()
}; };
response.Path = path.Select(x => AssetFolderDto.FromAssetFolder(x, resources)).ToArray(); response.Path = path.Select(x => AssetFolderDto.FromAssetFolder(x, resources)).ToArray();

1
backend/src/Squidex/Areas/Api/Controllers/Contents/Models/GraphQLGetDto.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license. // All rights reserved. Licensed under the MIT license.
// ========================================================================== // ==========================================================================
using GraphQL;
using GraphQL.NewtonsoftJson; using GraphQL.NewtonsoftJson;
using Squidex.Domain.Apps.Entities.Contents.GraphQL; using Squidex.Domain.Apps.Entities.Contents.GraphQL;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;

1
backend/src/Squidex/Areas/Api/Controllers/Contents/Models/GraphQLPostDto.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license. // All rights reserved. Licensed under the MIT license.
// ========================================================================== // ==========================================================================
using GraphQL;
using GraphQL.NewtonsoftJson; using GraphQL.NewtonsoftJson;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Squidex.Domain.Apps.Entities.Contents.GraphQL; using Squidex.Domain.Apps.Entities.Contents.GraphQL;

10
backend/src/Squidex/Areas/Api/Controllers/Rules/RulesController.cs

@ -120,7 +120,7 @@ namespace Squidex.Areas.Api.Controllers.Rules
{ {
var command = request.ToCommand(); var command = request.ToCommand();
var response = await InvokeCommandAsync(app, command); var response = await InvokeCommandAsync(command);
return CreatedAtAction(nameof(GetRules), new { app }, response); return CreatedAtAction(nameof(GetRules), new { app }, response);
} }
@ -164,7 +164,7 @@ namespace Squidex.Areas.Api.Controllers.Rules
{ {
var command = request.ToCommand(id); var command = request.ToCommand(id);
var response = await InvokeCommandAsync(app, command); var response = await InvokeCommandAsync(command);
return Ok(response); return Ok(response);
} }
@ -187,7 +187,7 @@ namespace Squidex.Areas.Api.Controllers.Rules
{ {
var command = new EnableRule { RuleId = id }; var command = new EnableRule { RuleId = id };
var response = await InvokeCommandAsync(app, command); var response = await InvokeCommandAsync(command);
return Ok(response); return Ok(response);
} }
@ -210,7 +210,7 @@ namespace Squidex.Areas.Api.Controllers.Rules
{ {
var command = new DisableRule { RuleId = id }; var command = new DisableRule { RuleId = id };
var response = await InvokeCommandAsync(app, command); var response = await InvokeCommandAsync(command);
return Ok(response); return Ok(response);
} }
@ -356,7 +356,7 @@ namespace Squidex.Areas.Api.Controllers.Rules
return NoContent(); return NoContent();
} }
private async Task<RuleDto> InvokeCommandAsync(string app, ICommand command) private async Task<RuleDto> InvokeCommandAsync(ICommand command)
{ {
var context = await CommandBus.PublishAsync(command); var context = await CommandBus.PublishAsync(command);

20
backend/src/Squidex/Areas/Api/Controllers/Schemas/SchemasController.cs

@ -121,7 +121,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas
{ {
var command = request.ToCommand(); var command = request.ToCommand();
var response = await InvokeCommandAsync(app, command); var response = await InvokeCommandAsync(command);
return CreatedAtAction(nameof(GetSchema), new { app, name = request.Name }, response); return CreatedAtAction(nameof(GetSchema), new { app, name = request.Name }, response);
} }
@ -146,7 +146,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas
{ {
var command = request.ToCommand(); var command = request.ToCommand();
var response = await InvokeCommandAsync(app, command); var response = await InvokeCommandAsync(command);
return Ok(response); return Ok(response);
} }
@ -171,7 +171,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas
{ {
var command = request.ToCommand(); var command = request.ToCommand();
var response = await InvokeCommandAsync(app, command); var response = await InvokeCommandAsync(command);
return Ok(response); return Ok(response);
} }
@ -195,7 +195,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas
{ {
var command = request.ToCommand(); var command = request.ToCommand();
var response = await InvokeCommandAsync(app, command); var response = await InvokeCommandAsync(command);
return Ok(response); return Ok(response);
} }
@ -220,7 +220,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas
{ {
var command = request.ToCommand(); var command = request.ToCommand();
var response = await InvokeCommandAsync(app, command); var response = await InvokeCommandAsync(command);
return Ok(response); return Ok(response);
} }
@ -245,7 +245,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas
{ {
var command = request.ToCommand(); var command = request.ToCommand();
var response = await InvokeCommandAsync(app, command); var response = await InvokeCommandAsync(command);
return Ok(response); return Ok(response);
} }
@ -270,7 +270,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas
{ {
var command = request.ToCommand(); var command = request.ToCommand();
var response = await InvokeCommandAsync(app, command); var response = await InvokeCommandAsync(command);
return Ok(response); return Ok(response);
} }
@ -293,7 +293,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas
{ {
var command = new PublishSchema(); var command = new PublishSchema();
var response = await InvokeCommandAsync(app, command); var response = await InvokeCommandAsync(command);
return Ok(response); return Ok(response);
} }
@ -316,7 +316,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas
{ {
var command = new UnpublishSchema(); var command = new UnpublishSchema();
var response = await InvokeCommandAsync(app, command); var response = await InvokeCommandAsync(command);
return Ok(response); return Ok(response);
} }
@ -341,7 +341,7 @@ namespace Squidex.Areas.Api.Controllers.Schemas
return NoContent(); return NoContent();
} }
private async Task<SchemaDetailsDto> InvokeCommandAsync(string app, ICommand command) private async Task<SchemaDetailsDto> InvokeCommandAsync(ICommand command)
{ {
var context = await CommandBus.PublishAsync(command); var context = await CommandBus.PublishAsync(command);

2
backend/src/Squidex/Areas/Api/Controllers/Users/UsersController.cs

@ -176,7 +176,7 @@ namespace Squidex.Areas.Api.Controllers.Users
} }
catch catch
{ {
await body.WriteAsync(AvatarBytes); await body.WriteAsync(AvatarBytes, ct);
} }
}); });

2
backend/src/Squidex/Areas/IdentityServer/Views/Account/Login.cshtml

@ -1,7 +1,7 @@
@model Squidex.Areas.IdentityServer.Controllers.Account.LoginVM @model Squidex.Areas.IdentityServer.Controllers.Account.LoginVM
@{ @{
var action = Model.IsLogin ? @T.Get("common.login") : @T.Get("common.signup"); var action = Model.IsLogin ? T.Get("common.login") : T.Get("common.signup");
ViewBag.Title = action; ViewBag.Title = action;
} }

2
backend/src/Squidex/Areas/IdentityServer/Views/Error/Error.cshtml

@ -3,7 +3,7 @@
@{ @{
ViewBag.Theme = "white"; ViewBag.Theme = "white";
ViewBag.Title = @T.Get("users.error.title"); ViewBag.Title = T.Get("users.error.title");
} }
<img class="splash-image" src="@Url.RootContentUrl("~/squid.svg?title=OH%20DAMN&text=I%20am%20sorry%2C%20that%20something%20went%20wrong")" /> <img class="splash-image" src="@Url.RootContentUrl("~/squid.svg?title=OH%20DAMN&text=I%20am%20sorry%2C%20that%20something%20went%20wrong")" />

8
backend/src/Squidex/Areas/IdentityServer/Views/Profile/Profile.cshtml

@ -3,14 +3,14 @@
@{ @{
ViewBag.Class = "profile-lg"; ViewBag.Class = "profile-lg";
ViewBag.Title = @T.Get("users.profile.title"); ViewBag.Title = T.Get("users.profile.title");
void RenderValidation(string field) void RenderValidation(string field)
{ {
@if (ViewContext.ViewData.ModelState[field]?.ValidationState == Microsoft.AspNetCore.Mvc.ModelBinding.ModelValidationState.Invalid) @if (ViewContext.ViewData.ModelState[field]?.ValidationState == Microsoft.AspNetCore.Mvc.ModelBinding.ModelValidationState.Invalid)
{ {
<div class="errors-container"> <div class="errors-container">
<span class="errors">@Html.ValidationMessage(field)</span> <span class="errors">Html.ValidationMessage(field)</span>
</div> </div>
} }
} }
@ -278,13 +278,13 @@
} }
document.addEventListener('click', document.addEventListener('click',
function (event) { function(event) {
if (event.target.className.indexOf('remove-item') >= 0) { if (event.target.className.indexOf('remove-item') >= 0) {
event.target.parentNode.parentNode.remove(); event.target.parentNode.parentNode.remove();
updateNames(); updateNames();
} }
}) });
pictureButton.addEventListener('click', pictureButton.addEventListener('click',
function () { function () {

2
backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/RolesJsonTests.cs

@ -22,7 +22,7 @@ namespace Squidex.Domain.Apps.Core.Model.Apps
{ {
var source = new Dictionary<string, string[]> var source = new Dictionary<string, string[]>
{ {
["Custom"] = new string[] ["Custom"] = new[]
{ {
"Permission1", "Permission1",
"Permission2" "Permission2"

3
backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/EventSynchronization/SchemaSynchronizerTests.cs

@ -560,9 +560,6 @@ namespace Squidex.Domain.Apps.Core.Operations.EventSynchronization
[Fact] [Fact]
public void Should_create_events_if_nested_fields_reordered() public void Should_create_events_if_nested_fields_reordered()
{ {
var id1 = NamedId.Of(1, "f1");
var id2 = NamedId.Of(2, "f1");
var sourceSchema = var sourceSchema =
new Schema("source") new Schema("source")
.AddArray(arrayId.Id, arrayId.Name, Partitioning.Invariant, f => f .AddArray(arrayId.Id, arrayId.Name, Partitioning.Invariant, f => f

4
backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/ExpressionsAttribute.cs

@ -44,7 +44,7 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules
{ {
yield return new object[] yield return new object[]
{ {
string.Format("Script(`{0}`)", script) $"Script(`{script}`)"
}; };
} }
@ -52,7 +52,7 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules
{ {
yield return new object[] yield return new object[]
{ {
string.Format("Liquid({0})", liquid) $"Liquid({liquid})"
}; };
} }
} }

6
backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleEventFormatterCompareTests.cs

@ -46,7 +46,7 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules
{ {
public (bool Match, ValueTask<string?>) Format(EnrichedEvent @event, object value, string[] path) public (bool Match, ValueTask<string?>) Format(EnrichedEvent @event, object value, string[] path)
{ {
if (path[0] == "data" && value is JsonArray _) if (path[0] == "data" && value is JsonArray)
{ {
return (true, GetValueAsync()); return (true, GetValueAsync());
} }
@ -54,7 +54,7 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules
return default; return default;
} }
private async ValueTask<string?> GetValueAsync() private static async ValueTask<string?> GetValueAsync()
{ {
await Task.Delay(5); await Task.Delay(5);
@ -79,8 +79,6 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules
A.CallTo(() => user.Claims) A.CallTo(() => user.Claims)
.Returns(new List<Claim> { new Claim(SquidexClaimTypes.DisplayName, "me") }); .Returns(new List<Claim> { new Claim(SquidexClaimTypes.DisplayName, "me") });
JintScriptEngine scriptEngine = BuildScriptEngine();
var formatters = new IRuleEventFormatter[] var formatters = new IRuleEventFormatter[]
{ {
new PredefinedPatternsFormatter(urlGenerator), new PredefinedPatternsFormatter(urlGenerator),

6
backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleEventFormatterTests.cs

@ -43,7 +43,7 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules
{ {
public (bool Match, ValueTask<string?>) Format(EnrichedEvent @event, object value, string[] path) public (bool Match, ValueTask<string?>) Format(EnrichedEvent @event, object value, string[] path)
{ {
if (path[0] == "data" && value is JsonArray _) if (path[0] == "data" && value is JsonArray)
{ {
return (true, GetValueAsync()); return (true, GetValueAsync());
} }
@ -51,7 +51,7 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules
return default; return default;
} }
private async ValueTask<string?> GetValueAsync() private static async ValueTask<string?> GetValueAsync()
{ {
await Task.Delay(5); await Task.Delay(5);
@ -76,8 +76,6 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules
A.CallTo(() => user.Claims) A.CallTo(() => user.Claims)
.Returns(new List<Claim> { new Claim(SquidexClaimTypes.DisplayName, "me") }); .Returns(new List<Claim> { new Claim(SquidexClaimTypes.DisplayName, "me") });
JintScriptEngine scriptEngine = BuildScriptEngine();
var formatters = new IRuleEventFormatter[] var formatters = new IRuleEventFormatter[]
{ {
new PredefinedPatternsFormatter(urlGenerator), new PredefinedPatternsFormatter(urlGenerator),

4
backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/AssetsValidatorTests.cs

@ -224,10 +224,10 @@ namespace Squidex.Domain.Apps.Core.Operations.ValidateContent.Validators
private IValidator Validator(AssetsFieldProperties properties) private IValidator Validator(AssetsFieldProperties properties)
{ {
return new AssetsValidator(properties, new CheckAssets(ids => return new AssetsValidator(properties, ids =>
{ {
return Task.FromResult<IReadOnlyList<IAssetInfo>>(new List<IAssetInfo> { document, image1, image2 }); return Task.FromResult<IReadOnlyList<IAssetInfo>>(new List<IAssetInfo> { document, image1, image2 });
})); });
} }
} }
} }

2
backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/ReferencesValidatorTests.cs

@ -72,7 +72,7 @@ namespace Squidex.Domain.Apps.Core.Operations.ValidateContent
private static CheckContentsByIds FoundReferences(params (Guid SchemaId, Guid Id)[] references) private static CheckContentsByIds FoundReferences(params (Guid SchemaId, Guid Id)[] references)
{ {
return new CheckContentsByIds(x => Task.FromResult<IReadOnlyList<(Guid SchemaId, Guid Id)>>(references.ToList())); return x => Task.FromResult<IReadOnlyList<(Guid SchemaId, Guid Id)>>(references.ToList());
} }
} }
} }

4
backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/UniqueValidatorTests.cs

@ -86,12 +86,12 @@ namespace Squidex.Domain.Apps.Core.Operations.ValidateContent.Validators
private CheckUniqueness Check(Guid id, Action<string>? filter = null) private CheckUniqueness Check(Guid id, Action<string>? filter = null)
{ {
return new CheckUniqueness(filterNode => return filterNode =>
{ {
filter?.Invoke(filterNode.ToString()); filter?.Invoke(filterNode.ToString());
return Task.FromResult<IReadOnlyList<(Guid, Guid)>>(new List<(Guid, Guid)> { (schemaId, id) }); return Task.FromResult<IReadOnlyList<(Guid, Guid)>>(new List<(Guid, Guid)> { (schemaId, id) });
}); };
} }
} }
} }

3
backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DefaultAppLogStoreTests.cs

@ -85,8 +85,7 @@ namespace Squidex.Domain.Apps.Entities.Apps
using (var reader = new StreamReader(stream)) using (var reader = new StreamReader(stream))
{ {
string? line = null; while ((await reader.ReadLineAsync()) != null)
while ((line = reader.ReadLine()) != null)
{ {
lines++; lines++;
} }

1
backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Guards/GuardAppRolesTests.cs

@ -10,7 +10,6 @@ using Squidex.Domain.Apps.Core.TestHelpers;
using Squidex.Domain.Apps.Entities.Apps.Commands; using Squidex.Domain.Apps.Entities.Apps.Commands;
using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Domain.Apps.Entities.TestHelpers;
using Squidex.Infrastructure; using Squidex.Infrastructure;
using Squidex.Infrastructure.Json.Objects;
using Squidex.Infrastructure.Validation; using Squidex.Infrastructure.Validation;
using Xunit; using Xunit;

4
backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/FileTagAssetMetadataSourceTests.cs

@ -121,7 +121,7 @@ namespace Squidex.Domain.Apps.Entities.Assets
Assert.Empty(formatted); Assert.Empty(formatted);
} }
private UploadAssetCommand Command(string path) private static UploadAssetCommand Command(string path)
{ {
var file = new FileInfo(Path.Combine("Assets", "TestFiles", path)); var file = new FileInfo(Path.Combine("Assets", "TestFiles", path));
@ -131,7 +131,7 @@ namespace Squidex.Domain.Apps.Entities.Assets
}; };
} }
private UploadAssetCommand FakeCommand(string name) private static UploadAssetCommand FakeCommand(string name)
{ {
var stream = new MemoryStream(); var stream = new MemoryStream();

2
backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/ImageAssetMetadataSourceTests.cs

@ -139,7 +139,7 @@ namespace Squidex.Domain.Apps.Entities.Assets
{ {
var source = new AssetEntity var source = new AssetEntity
{ {
Metadata = new AssetMetadata() Metadata = new AssetMetadata
{ {
["pixelWidth"] = JsonValue.Create(128), ["pixelWidth"] = JsonValue.Create(128),
["pixelHeight"] = JsonValue.Create(55) ["pixelHeight"] = JsonValue.Create(55)

2
backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/RecursiveDeleterTests.cs

@ -59,7 +59,7 @@ namespace Squidex.Domain.Apps.Entities.Assets
{ {
IEventConsumer consumer = sut; IEventConsumer consumer = sut;
Assert.Equal(typeof(RecursiveDeleter).Name, consumer.Name); Assert.Equal(nameof(RecursiveDeleter), consumer.Name);
} }
[Fact] [Fact]

2
backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/CommentTriggerHandlerTests.cs

@ -255,7 +255,7 @@ namespace Squidex.Domain.Apps.Entities.Comments
}); });
} }
private IUser CreateUser(string id, string email = "sebastian@squidex.io") private static IUser CreateUser(string id, string email = "sebastian@squidex.io")
{ {
var user = A.Fake<IUser>(); var user = A.Fake<IUser>();

2
backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentDomainObjectTests.cs

@ -587,7 +587,7 @@ namespace Squidex.Domain.Apps.Entities.Contents
return A<ScriptVars>.That.Matches(x => M(x, newData, oldData, newStatus, oldStatus)); return A<ScriptVars>.That.Matches(x => M(x, newData, oldData, newStatus, oldStatus));
} }
private ScriptOptions ScriptOptions() private static ScriptOptions ScriptOptions()
{ {
return A<ScriptOptions>.That.Matches(x => x.CanDisallow && x.CanReject && x.AsContext); return A<ScriptOptions>.That.Matches(x => x.CanDisallow && x.CanReject && x.AsContext);
} }

2
backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/TestAsset.cs

@ -109,7 +109,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL
pixelWidth = asset.Metadata.GetPixelWidth(), pixelWidth = asset.Metadata.GetPixelWidth(),
pixelHeight = asset.Metadata.GetPixelHeight() pixelHeight = asset.Metadata.GetPixelHeight()
}, },
slug = asset.Slug, slug = asset.Slug
}; };
} }
} }

12
backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Guard/GuardContentTests.cs

@ -233,8 +233,6 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guard
[Fact] [Fact]
public void CreateDraft_should_throw_exception_if_not_published() public void CreateDraft_should_throw_exception_if_not_published()
{ {
var schema = CreateSchema(false);
var content = CreateContent(Status.Draft); var content = CreateContent(Status.Draft);
var command = new CreateContentDraft(); var command = new CreateContentDraft();
@ -244,8 +242,6 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guard
[Fact] [Fact]
public void CreateDraft_should_not_throw_exception() public void CreateDraft_should_not_throw_exception()
{ {
var schema = CreateSchema(false);
var content = CreateContent(Status.Published); var content = CreateContent(Status.Published);
var command = new CreateContentDraft(); var command = new CreateContentDraft();
@ -255,8 +251,6 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guard
[Fact] [Fact]
public void CanDeleteDraft_should_throw_exception_if_no_draft_found() public void CanDeleteDraft_should_throw_exception_if_no_draft_found()
{ {
var schema = CreateSchema(false);
var content = new ContentState(); var content = new ContentState();
var command = new DeleteContentDraft(); var command = new DeleteContentDraft();
@ -266,8 +260,6 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guard
[Fact] [Fact]
public void CanDeleteDraft_should_not_throw_exception() public void CanDeleteDraft_should_not_throw_exception()
{ {
var schema = CreateSchema(false);
var content = CreateDraftContent(Status.Draft); var content = CreateDraftContent(Status.Draft);
var command = new DeleteContentDraft(); var command = new DeleteContentDraft();
@ -311,7 +303,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guard
return Mocks.Schema(appId, NamedId.Of(Guid.NewGuid(), "my-schema"), new Schema("schema", isSingleton: isSingleton)); return Mocks.Schema(appId, NamedId.Of(Guid.NewGuid(), "my-schema"), new Schema("schema", isSingleton: isSingleton));
} }
private ContentState CreateDraftContent(Status status) private static ContentState CreateDraftContent(Status status)
{ {
return new ContentState return new ContentState
{ {
@ -319,7 +311,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guard
}; };
} }
private ContentState CreateContent(Status status) private static ContentState CreateContent(Status status)
{ {
return new ContentState return new ContentState
{ {

4
backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryFixture.cs

@ -37,13 +37,13 @@ namespace Squidex.Domain.Apps.Entities.Contents.MongoDb
public IContentRepository ContentRepository { get; } public IContentRepository ContentRepository { get; }
public NamedId<Guid>[] AppIds { get; } = new[] public NamedId<Guid>[] AppIds { get; } =
{ {
NamedId.Of(Guid.Parse("3b5ba909-e5a5-4858-9d0d-df4ff922d452"), "my-app1"), NamedId.Of(Guid.Parse("3b5ba909-e5a5-4858-9d0d-df4ff922d452"), "my-app1"),
NamedId.Of(Guid.Parse("4b3672c1-97c6-4e0b-a067-71e9e9a29db9"), "my-app1") NamedId.Of(Guid.Parse("4b3672c1-97c6-4e0b-a067-71e9e9a29db9"), "my-app1")
}; };
public NamedId<Guid>[] SchemaIds { get; } = new[] public NamedId<Guid>[] SchemaIds { get; } =
{ {
NamedId.Of(Guid.Parse("3b5ba909-e5a5-4858-9d0d-df4ff922d452"), "my-schema1"), NamedId.Of(Guid.Parse("3b5ba909-e5a5-4858-9d0d-df4ff922d452"), "my-schema1"),
NamedId.Of(Guid.Parse("4b3672c1-97c6-4e0b-a067-71e9e9a29db9"), "my-schema2"), NamedId.Of(Guid.Parse("4b3672c1-97c6-4e0b-a067-71e9e9a29db9"), "my-schema2"),

2
backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ResolveReferencesTests.cs

@ -107,8 +107,6 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries
await sut.EnrichAsync(requestContext, contents, schemaProvider); await sut.EnrichAsync(requestContext, contents, schemaProvider);
var enriched1 = contents[0];
A.CallTo(() => requestCache.AddDependency(refSchemaId1.Id, 0)) A.CallTo(() => requestCache.AddDependency(refSchemaId1.Id, 0))
.MustHaveHappened(); .MustHaveHappened();

2
backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ScriptContentTests.cs

@ -109,7 +109,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries
.MustHaveHappened(); .MustHaveHappened();
} }
private ScriptOptions ScriptOptions() private static ScriptOptions ScriptOptions()
{ {
return A<ScriptOptions>.That.Matches(x => x.AsContext); return A<ScriptOptions>.That.Matches(x => x.AsContext);
} }

2
backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ReferenceFluidExtensionTests.cs

@ -85,7 +85,7 @@ namespace Squidex.Domain.Apps.Entities.Contents
Assert.Equal(expected, result); Assert.Equal(expected, result);
} }
private IEnrichedContentEntity CreateReference(Guid referenceId, int index) private static IEnrichedContentEntity CreateReference(Guid referenceId, int index)
{ {
return new ContentEntity return new ContentEntity
{ {

2
backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/CachingTextIndexerStateTests.cs

@ -58,8 +58,6 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text
var contentId = Guid.NewGuid(); var contentId = Guid.NewGuid();
var contentIds = HashSet.Of(contentId); var contentIds = HashSet.Of(contentId);
var state = new TextContentState { ContentId = contentId };
A.CallTo(() => inner.GetAsync(A<HashSet<Guid>>.That.Is(contentIds))) A.CallTo(() => inner.GetAsync(A<HashSet<Guid>>.That.Is(contentIds)))
.Returns(new Dictionary<Guid, TextContentState>()); .Returns(new Dictionary<Guid, TextContentState>());

2
backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Queries/RuleEnricherTests.cs

@ -65,7 +65,7 @@ namespace Squidex.Domain.Apps.Entities.Rules.Queries
A.CallTo(() => ruleEventRepository.QueryStatisticsByAppAsync(appId.Id)) A.CallTo(() => ruleEventRepository.QueryStatisticsByAppAsync(appId.Id))
.Returns(new List<RuleStatistics> { stats }); .Returns(new List<RuleStatistics> { stats });
var result = await sut.EnrichAsync(source, requestContext); await sut.EnrichAsync(source, requestContext);
A.CallTo(() => requestCache.AddDependency(source.Id, source.Version)) A.CallTo(() => requestCache.AddDependency(source.Id, source.Version))
.MustHaveHappened(); .MustHaveHappened();

2
backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/RuleEnqueuerTests.cs

@ -71,7 +71,7 @@ namespace Squidex.Domain.Apps.Entities.Rules
{ {
IEventConsumer consumer = sut; IEventConsumer consumer = sut;
Assert.Equal(typeof(RuleEnqueuer).Name, consumer.Name); Assert.Equal(nameof(RuleEnqueuer), consumer.Name);
} }
[Fact] [Fact]

2
backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Guards/GuardSchemaTests.cs

@ -578,7 +578,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Guards
FieldRules = new[] FieldRules = new[]
{ {
new FieldRuleCommand { Field = "field", Action = (FieldRuleAction)5 }, new FieldRuleCommand { Field = "field", Action = (FieldRuleAction)5 },
new FieldRuleCommand(), new FieldRuleCommand()
} }
}; };

2
backend/tests/Squidex.Domain.Apps.Entities.Tests/Tags/TagGrainTests.cs

@ -108,9 +108,7 @@ namespace Squidex.Domain.Apps.Entities.Tags
public async Task Should_remove_tags_from_grain() public async Task Should_remove_tags_from_grain()
{ {
var result1 = await sut.NormalizeTagsAsync(HashSet.Of("name1", "name2"), null); var result1 = await sut.NormalizeTagsAsync(HashSet.Of("name1", "name2"), null);
#pragma warning disable IDE0059 // Unnecessary assignment of a value
var result2 = await sut.NormalizeTagsAsync(HashSet.Of("name2", "name3"), null); var result2 = await sut.NormalizeTagsAsync(HashSet.Of("name2", "name3"), null);
#pragma warning restore IDE0059 // Unnecessary assignment of a value
await sut.NormalizeTagsAsync(null, new HashSet<string>(result1.Values)); await sut.NormalizeTagsAsync(null, new HashSet<string>(result1.Values));

2
backend/tests/Squidex.Infrastructure.Tests/BytesRangeTests.cs

@ -75,7 +75,7 @@ namespace Squidex.Infrastructure
TestBytesRange(sut, -5, -3, 0, false, null); TestBytesRange(sut, -5, -3, 0, false, null);
} }
private void TestBytesRange(BytesRange sut, long? from, long? to, long length, bool defined, string? formatted) private static void TestBytesRange(BytesRange sut, long? from, long? to, long length, bool defined, string? formatted)
{ {
Assert.Equal(from, sut.From); Assert.Equal(from, sut.From);
Assert.Equal(to, sut.To); Assert.Equal(to, sut.To);

4
backend/tests/Squidex.Infrastructure.Tests/Orleans/PubSubTests.cs

@ -30,7 +30,7 @@ namespace Squidex.Infrastructure.Orleans
{ {
Guid.NewGuid(), Guid.NewGuid(),
Guid.NewGuid(), Guid.NewGuid(),
Guid.NewGuid(), Guid.NewGuid()
}; };
var received1 = await CreateSubscriber(cluster.Client, sent.Count); var received1 = await CreateSubscriber(cluster.Client, sent.Count);
@ -54,7 +54,7 @@ namespace Squidex.Infrastructure.Orleans
Assert.True(received2.Result.SetEquals(sent)); Assert.True(received2.Result.SetEquals(sent));
} }
private async Task<Task<HashSet<Guid>>> CreateSubscriber(IGrainFactory grainFactory, int expectedCount) private static async Task<Task<HashSet<Guid>>> CreateSubscriber(IGrainFactory grainFactory, int expectedCount)
{ {
var pubSub = new OrleansPubSub(grainFactory); var pubSub = new OrleansPubSub(grainFactory);

2
backend/tests/Squidex.Infrastructure.Tests/Queries/QueryJsonConversionTests.cs

@ -465,7 +465,7 @@ namespace Squidex.Infrastructure.Queries
public static IEnumerable<object[]> BuildTests(string field, Predicate<string> opFilter, object value, string valueString) public static IEnumerable<object[]> BuildTests(string field, Predicate<string> opFilter, object value, string valueString)
{ {
var fields = new string[] var fields = new[]
{ {
$"{field}", $"{field}",
$"json.{field}", $"json.{field}",

2
backend/tests/Squidex.Infrastructure.Tests/Reflection/SimpleEqualsTests.cs

@ -88,7 +88,7 @@ namespace Squidex.Infrastructure.Reflection
yield return new object[] yield return new object[]
{ {
new Uri("/url1", UriKind.Relative), new Uri("/url1", UriKind.Relative),
new Uri("/url2", UriKind.Relative), new Uri("/url2", UriKind.Relative)
}; };
} }

2
backend/tests/Squidex.Infrastructure.Tests/UsageTracking/BackgroundUsageTrackerTests.cs

@ -134,6 +134,8 @@ namespace Squidex.Infrastructure.UsageTracking
(dateFrom.AddDays(4), new Counters()) (dateFrom.AddDays(4), new Counters())
} }
}; };
result.Should().BeEquivalentTo(expected);
} }
[Fact] [Fact]

4
backend/tests/Squidex.Infrastructure.Tests/ValidationExceptionTests.cs

@ -37,7 +37,7 @@ namespace Squidex.Infrastructure
var errors = new List<ValidationError> var errors = new List<ValidationError>
{ {
new ValidationError("Error1"), new ValidationError("Error1"),
new ValidationError("Error2"), new ValidationError("Error2")
}; };
var ex = new ValidationException(errors); var ex = new ValidationException(errors);
@ -51,7 +51,7 @@ namespace Squidex.Infrastructure
var errors = new List<ValidationError> var errors = new List<ValidationError>
{ {
new ValidationError("Error1"), new ValidationError("Error1"),
new ValidationError("Error2"), new ValidationError("Error2")
}; };
var source = new ValidationException(errors); var source = new ValidationException(errors);

Loading…
Cancel
Save