Skip to content

Commit

Permalink
Use updated Crud and Search services
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-dudarev committed Jul 26, 2023
1 parent 7ac4b76 commit f307862
Show file tree
Hide file tree
Showing 23 changed files with 300 additions and 241 deletions.
115 changes: 105 additions & 10 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,24 @@ root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
indent_size = 2
end_of_line = crlf
trim_trailing_whitespace = true
insert_final_newline = true

# Dotnet code style settings:
# Project files
[*.{csproj,props}]
insert_final_newline = false

# HTML files
[*.{html,htm}]
insert_final_newline = false

# Code
[*.{cs,js,ts,ps1,sh,bat,cmd}]
indent_size = 4

# Dotnet code style settings
[*.{cs,vb}]

# Sort using and Import directives with System.* appearing first
Expand All @@ -24,16 +36,24 @@ dotnet_style_qualification_for_event = false:suggestion
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion

# Use explicit accessibility modifiers
dotnet_style_require_accessibility_modifiers = true:suggestion

# Suggest more modern language features when available
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_prefer_inferred_tuple_names = true:suggestion
dotnet_prefer_inferred_anonymous_type_member_names = true:suggestion

# CSharp code style settings:
# CSharp code style settings
[*.cs]

# Prefer curly braces even for one line of code
csharp_prefer_braces = true:suggestion

# Prefer "var" everywhere
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
Expand All @@ -55,6 +75,9 @@ csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion

# Newline settings
csharp_new_line_before_open_brace = all
Expand All @@ -63,12 +86,84 @@ csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true

#JSON code style settings
[*.json]
indent_style = space
indent_size = 2
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left

csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_parentheses = false

csharp_preserve_single_line_statements = false
csharp_preserve_single_line_blocks = true
csharp_using_directive_placement = outside_namespace:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_style_namespace_declarations = block_scoped:silent
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent

[*.{cs,vb}]
#### Naming styles ####

# Naming rules

dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i

dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case

dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case

# Symbol specifications

dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =

dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =

dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =

# Naming styles

dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case

#HTML code style settings
[*.html]
insert_final_newline = false
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion
dotnet_style_namespace_match_folder = true:suggestion
9 changes: 6 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<?xml version="1.0" encoding="utf-8"?><Project>
<?xml version="1.0" encoding="utf-8"?>
<Project>
<!-- These properties will be shared for all projects -->
<PropertyGroup>
<VersionPrefix>3.400.0</VersionPrefix>
<VersionSuffix>
</VersionSuffix>
<VersionSuffix></VersionSuffix>
<VersionSuffix Condition=" '$(VersionSuffix)' != '' AND '$(BuildNumber)' != '' ">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
</PropertyGroup>
<PropertyGroup>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
</Project>
5 changes: 5 additions & 0 deletions VirtoCommerce.SubscriptionModule.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=auditable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=postgre/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=virto/@EntryIndexedValue">True</s:Boolean>
</wpf:ResourceDictionary>
1 change: 1 addition & 0 deletions module.ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TimeZoneConverter.dll
4 changes: 2 additions & 2 deletions src/VirtoCommerce.SubscriptionModule.Core/ModuleConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ public static class General
Name = "Subscription.CronExpression",
GroupName = "Subscriptions|General",
ValueType = SettingValueType.ShortText,
DefaultValue = "0 */1 * * *"
DefaultValue = "0/5 * * * *"
};

public static readonly SettingDescriptor CronExpressionOrdersJob = new SettingDescriptor
{
Name = "Subscription.CronExpressionOrdersJob",
GroupName = "Subscriptions|General",
ValueType = SettingValueType.ShortText,
DefaultValue = "0 0 */1 * *"
DefaultValue = "0/15 * * * *"
};

public static readonly SettingDescriptor PastDueDelay = new SettingDescriptor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<noWarn>1591</noWarn>
<IsPackable>True</IsPackable>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<PropertyGroup>
<!-- Project is not a test project -->
<SonarQubeTestProject>false</SonarQubeTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="VirtoCommerce.CoreModule.Core" Version="3.200.0" />
<PackageReference Include="VirtoCommerce.OrdersModule.Core" Version="3.200.0" />
<PackageReference Include="VirtoCommerce.Platform.Core" Version="3.200.0" />
</ItemGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<noWarn>1591</noWarn>
<IsPackable>True</IsPackable>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<PropertyGroup>
<!-- Project is not a test project -->
<SonarQubeTestProject>false</SonarQubeTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="VirtoCommerce.CoreModule.Core" Version="3.400.0" />
<PackageReference Include="VirtoCommerce.OrdersModule.Core" Version="3.400.0" />
<PackageReference Include="VirtoCommerce.Platform.Core" Version="3.400.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>


<ItemGroup>
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.13">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VirtoCommerce.SubscriptionModule.Data\VirtoCommerce.SubscriptionModule.Data.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Npgsql" Version="6.0.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.13">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Npgsql" Version="6.0.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VirtoCommerce.SubscriptionModule.Data\VirtoCommerce.SubscriptionModule.Data.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.13">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.13" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VirtoCommerce.SubscriptionModule.Data\VirtoCommerce.SubscriptionModule.Data.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Threading.Tasks;
using Hangfire;
using VirtoCommerce.Platform.Core.Settings;
using SubscriptionSettings = VirtoCommerce.SubscriptionModule.Core.ModuleConstants.Settings.General;

namespace VirtoCommerce.SubscriptionModule.Data.BackgroundJobs
{
Expand All @@ -15,10 +16,10 @@ public BackgroundJobsRunner(ISettingsManager settingsManager)

public async Task ConfigureProcessSubscriptionJob()
{
var processJobEnable = await _settingsManager.GetValueAsync(Core.ModuleConstants.Settings.General.EnableSubscriptionProcessJob.Name, true);
var processJobEnable = await _settingsManager.GetValueAsync<bool>(SubscriptionSettings.EnableSubscriptionProcessJob);
if (processJobEnable)
{
var cronExpression = _settingsManager.GetValue(Core.ModuleConstants.Settings.General.CronExpression.Name, "0/5 * * * *");
var cronExpression = await _settingsManager.GetValueAsync<string>(SubscriptionSettings.CronExpression);
RecurringJob.AddOrUpdate<ProcessSubscriptionJob>("ProcessSubscriptionJob", x => x.Process(), cronExpression);
}
else
Expand All @@ -29,10 +30,10 @@ public async Task ConfigureProcessSubscriptionJob()

public async Task ConfigureProcessSubscriptionOrdersJob()
{
var createOrderJobEnable = await _settingsManager.GetValueAsync(Core.ModuleConstants.Settings.General.EnableSubscriptionOrdersCreateJob.Name, true);
var createOrderJobEnable = await _settingsManager.GetValueAsync<bool>(SubscriptionSettings.EnableSubscriptionOrdersCreateJob);
if (createOrderJobEnable)
{
var cronExpressionOrder = _settingsManager.GetValue(Core.ModuleConstants.Settings.General.CronExpressionOrdersJob.Name, "0/15 * * * *");
var cronExpressionOrder = await _settingsManager.GetValueAsync<string>(SubscriptionSettings.CronExpressionOrdersJob);
RecurringJob.AddOrUpdate<CreateRecurrentOrdersJob>("ProcessSubscriptionOrdersJob", x => x.Process(), cronExpressionOrder);
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected virtual async Task TryToSendNotificationsAsync(GenericChangedEntry<Sub
/// </summary>
protected virtual async Task SetNotificationParametersAsync(SubscriptionEmailNotificationBase notification, Subscription subscription)
{
var store = await _storeService.GetByIdAsync(subscription.StoreId, StoreResponseGroup.StoreInfo.ToString());
var store = await _storeService.GetNoCloneAsync(subscription.StoreId, StoreResponseGroup.StoreInfo.ToString());

notification.Subscription = subscription;

Expand All @@ -88,7 +88,7 @@ protected virtual async Task SetNotificationParametersAsync(SubscriptionEmailNot
notification.LanguageCode = subscription.CustomerOrderPrototype.LanguageCode;

//Link notification to subscription to getting notification history for each subscription individually
notification.TenantIdentity = new TenantIdentity(subscription.Id, typeof(Subscription).Name);
notification.TenantIdentity = new TenantIdentity(subscription.Id, nameof(Subscription));
}

protected virtual bool IsSubscriptionCanceled(GenericChangedEntry<Subscription> changedEntry)
Expand Down
Loading

0 comments on commit f307862

Please sign in to comment.