Skip to content

Commit

Permalink
Merge pull request #151 from kodlamaio-projects/development
Browse files Browse the repository at this point in the history
style: reformat
  • Loading branch information
ahmet-cetinkaya authored Feb 2, 2024
2 parents ad396c3 + 5624c52 commit bbaa8f8
Show file tree
Hide file tree
Showing 29 changed files with 114 additions and 112 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
]
},
"csharpier": {
"version": "0.22.1",
"version": "0.27.2",
"commands": [
"dotnet-csharpier"
]
Expand Down
38 changes: 21 additions & 17 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ csharp_style_prefer_switch_expression = true
csharp_style_conditional_delegate_call = true

# Modifier preferences
csharp_prefer_static_local_function = true
csharp_prefer_static_local_function = true:suggestion
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async
csharp_style_prefer_readonly_struct = true
csharp_style_prefer_readonly_struct_member = true
csharp_style_prefer_readonly_struct = true:suggestion
csharp_style_prefer_readonly_struct_member = true:suggestion

# Code-block preferences
csharp_prefer_braces = false:silent
Expand All @@ -117,19 +117,19 @@ csharp_style_prefer_primary_constructors = true
csharp_style_prefer_top_level_statements = true:silent

# Expression-level preferences
csharp_prefer_simple_default_expression = true
csharp_style_deconstructed_variable_declaration = true
csharp_style_implicit_object_creation_when_type_is_apparent = true
csharp_style_inlined_variable_declaration = true
csharp_style_prefer_index_operator = true
csharp_style_prefer_local_over_anonymous_function = true
csharp_style_prefer_null_check_over_type_check = true
csharp_style_prefer_range_operator = true
csharp_style_prefer_tuple_swap = true
csharp_style_prefer_utf8_string_literals = true
csharp_style_throw_expression = true
csharp_style_unused_value_assignment_preference = discard_variable
csharp_style_unused_value_expression_statement_preference = discard_variable
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_local_over_anonymous_function = true:suggestion
csharp_style_prefer_null_check_over_type_check = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_style_prefer_tuple_swap = true:suggestion
csharp_style_prefer_utf8_string_literals = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion

# 'using' directive preferences
csharp_using_directive_placement = outside_namespace:silent
Expand Down Expand Up @@ -302,4 +302,8 @@ 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
dotnet_style_readonly_field = true:suggestion
dotnet_style_readonly_field = true:suggestion
dotnet_style_predefined_type_for_member_access = true:silent
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
dotnet_style_allow_multiple_blank_lines_experimental = false:silent
2 changes: 1 addition & 1 deletion src/corePackages
Submodule corePackages updated 28 files
+2 −2 Core.Application/Pipelines/Authorization/AuthorizationBehavior.cs
+3 −3 Core.Application/Pipelines/Caching/CacheRemovingBehavior.cs
+3 −3 Core.Application/Pipelines/Caching/CachingBehavior.cs
+2 −2 Core.Application/Pipelines/Logging/LoggingBehavior.cs
+2 −2 Core.Application/Pipelines/Performance/PerformanceBehavior.cs
+2 −2 Core.Application/Pipelines/Transaction/TransactionScopeBehavior.cs
+2 −2 Core.CrossCuttingConcerns/Exceptions/ExceptionMiddleware.cs
+2 −2 Core.CrossCuttingConcerns/Exceptions/Extensions/ProblemDetailsExtensions.cs
+2 −2 Core.CrossCuttingConcerns/Exceptions/Types/ValidationException.cs
+2 −2 Core.CrossCuttingConcerns/Logging/Serilog/Logger/ElasticSearchLogger.cs
+2 −2 Core.CrossCuttingConcerns/Logging/Serilog/Logger/FileLogger.cs
+2 −2 Core.CrossCuttingConcerns/Logging/Serilog/Logger/GraylogLogger.cs
+2 −2 Core.CrossCuttingConcerns/Logging/Serilog/Logger/MongoDbLogger.cs
+2 −2 Core.CrossCuttingConcerns/Logging/Serilog/Logger/MsSqlLogger.cs
+2 −2 Core.CrossCuttingConcerns/Logging/Serilog/Logger/PostgreSqlLogger.cs
+2 −2 Core.CrossCuttingConcerns/Logging/Serilog/Logger/RabbitMQLogger.cs
+26 −29 Core.ElasticSearch/ElasticSearchManager.cs
+2 −2 Core.Localization.Resource.Yaml.DependencyInjection/ServiceCollectionResourceLocalizationManagerExtension.cs
+2 −2 Core.Localization.Resource.Yaml/ResourceLocalizationManager.cs
+2 −2 Core.Localization.Translation/TranslateLocalizationManager.cs
+2 −2 Core.Localization.WebApi/LocalizationMiddleware.cs
+8 −9 Core.Persistence/Repositories/EfRepositoryBase.cs
+2 −2 Core.Persistence/Repositories/IAsyncRepository.cs
+2 −2 Core.Persistence/Repositories/IRepository.cs
+2 −2 Core.Security/Encryption/SecurityKeyHelper.cs
+4 −4 Core.Security/JWT/JwtHelper.cs
+23 −31 Core.Test/Application/Helpers/MockRepositoryHelper.cs
+3 −3 Core.Translation.AmazonTranslate.DependencyInjection/ServiceCollectionAmazonTranslateLocalizationExtension.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Application.Services.AuthenticatorService;
using System.Reflection;
using Application.Services.AuthenticatorService;
using Application.Services.AuthService;
using Application.Services.UsersService;
using Core.Application.Pipelines.Authorization;
Expand All @@ -15,7 +16,6 @@
using Core.Mailing.MailKitImplementations;
using FluentValidation;
using Microsoft.Extensions.DependencyInjection;
using System.Reflection;

namespace Application;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Application.Features.Auth.Rules;
using System.Web;
using Application.Features.Auth.Rules;
using Application.Services.AuthenticatorService;
using Application.Services.Repositories;
using Application.Services.UsersService;
Expand All @@ -8,7 +9,6 @@
using Core.Security.Enums;
using MediatR;
using MimeKit;
using System.Web;

namespace Application.Features.Auth.Commands.EnableEmailAuthenticator;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Application.Features.Auth.Commands.EnableOtpAuthenticator;

public class EnableOtpAuthenticatorCommand : IRequest<EnabledOtpAuthenticatorResponse> , ISecuredRequest
public class EnableOtpAuthenticatorCommand : IRequest<EnabledOtpAuthenticatorResponse>, ISecuredRequest
{
public int UserId { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public async Task UserShouldNotHasOperationClaimAlreadyWhenInsert(int userId, in

public async Task UserShouldNotHasOperationClaimAlreadyWhenUpdated(int id, int userId, int operationClaimId)
{
bool doesExist = await _userOperationClaimRepository.AnyAsync(
predicate: uoc => uoc.Id == id && uoc.UserId == userId && uoc.OperationClaimId == operationClaimId
bool doesExist = await _userOperationClaimRepository.AnyAsync(predicate: uoc =>
uoc.Id == id && uoc.UserId == userId && uoc.OperationClaimId == operationClaimId
);
if (doesExist)
await throwBusinessException(UserOperationClaimsMessages.UserOperationClaimAlreadyExists);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using FluentValidation;
using System.Text.RegularExpressions;
using System.Text.RegularExpressions;
using FluentValidation;

namespace Application.Features.Users.Commands.UpdateFromAuth;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Core.Persistence.Paging;
using System.Linq.Expressions;
using Core.Persistence.Paging;
using Core.Security.Entities;
using Microsoft.EntityFrameworkCore.Query;
using System.Linq.Expressions;

namespace Application.Services.OperationClaims;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Application.Features.OperationClaims.Rules;
using System.Linq.Expressions;
using Application.Features.OperationClaims.Rules;
using Application.Services.Repositories;
using Core.Persistence.Paging;
using Core.Security.Entities;
using Microsoft.EntityFrameworkCore.Query;
using System.Linq.Expressions;

namespace Application.Services.OperationClaims;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Core.Persistence.Paging;
using System.Linq.Expressions;
using Core.Persistence.Paging;
using Core.Security.Entities;
using Microsoft.EntityFrameworkCore.Query;
using System.Linq.Expressions;

namespace Application.Services.UserOperationClaims;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Application.Features.UserOperationClaims.Rules;
using System.Linq.Expressions;
using Application.Features.UserOperationClaims.Rules;
using Application.Services.Repositories;
using Core.Persistence.Paging;
using Core.Security.Entities;
using Microsoft.EntityFrameworkCore.Query;
using System.Linq.Expressions;

namespace Application.Services.UserOperationClaims;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Core.Persistence.Paging;
using System.Linq.Expressions;
using Core.Persistence.Paging;
using Core.Security.Entities;
using Microsoft.EntityFrameworkCore.Query;
using System.Linq.Expressions;

namespace Application.Services.UsersService;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Application.Features.Users.Rules;
using System.Linq.Expressions;
using Application.Features.Users.Rules;
using Application.Services.Repositories;
using Core.Persistence.Paging;
using Core.Security.Entities;
using Microsoft.EntityFrameworkCore.Query;
using System.Linq.Expressions;

namespace Application.Services.UsersService;

Expand Down
4 changes: 2 additions & 2 deletions src/starterProject/Persistence/Contexts/BaseDbContext.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Core.Security.Entities;
using System.Reflection;
using Core.Security.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using System.Reflection;

namespace Persistence.Contexts;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System.Reflection;
using Application;
using Application.Features.OperationClaims.Constants;
using Core.Security.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System.Reflection;

namespace Persistence.EntityConfigurations;

Expand Down Expand Up @@ -38,21 +38,22 @@ private IEnumerable<OperationClaim> _seeds
IEnumerable<Type> featureOperationClaimsTypes = Assembly
.GetAssembly(typeof(ApplicationServiceRegistration))!
.GetTypes()
.Where(
type =>
(type.Namespace?.Contains("Features") == true)
&& (type.Namespace?.Contains("Constants") == true)
&& type.IsClass
&& type.Name.EndsWith("OperationClaims")
.Where(type =>
(type.Namespace?.Contains("Features") == true)
&& (type.Namespace?.Contains("Constants") == true)
&& type.IsClass
&& type.Name.EndsWith("OperationClaims")
);
foreach (Type type in featureOperationClaimsTypes)
{
FieldInfo[] typeFields = type.GetFields(BindingFlags.Public | BindingFlags.Static);
IEnumerable<string> typeFieldsValues = typeFields.Select(field => field.GetValue(null)!.ToString()!);

IEnumerable<OperationClaim> featureOperationClaimsToAdd = typeFieldsValues.Select(
value => new OperationClaim { Id = ++id, Name = value }
);
IEnumerable<OperationClaim> featureOperationClaimsToAdd = typeFieldsValues.Select(value => new OperationClaim
{
Id = ++id,
Name = value
});
foreach (OperationClaim featureOperationClaim in featureOperationClaimsToAdd)
yield return featureOperationClaim;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ public async Task<List<RefreshToken>> GetOldRefreshTokensAsync(int userID, int r
{
List<RefreshToken> tokens = await Query()
.AsNoTracking()
.Where(
r =>
r.UserId == userID
&& r.Revoked == null
&& r.Expires >= DateTime.UtcNow
&& r.CreatedDate.AddDays(refreshTokenTTL) <= DateTime.UtcNow
.Where(r =>
r.UserId == userID
&& r.Revoked == null
&& r.Expires >= DateTime.UtcNow
&& r.CreatedDate.AddDays(refreshTokenTTL) <= DateTime.UtcNow
)
.ToListAsync();

Expand Down
17 changes: 8 additions & 9 deletions src/starterProject/WebAPI/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Application;
using Core.CrossCuttingConcerns.Exceptions.Extensions;
using Core.Persistence.WebApi;
using Core.Localization.WebApi;
using Core.Persistence.WebApi;
using Core.Security;
using Core.Security.Encryption;
using Core.Security.JWT;
Expand Down Expand Up @@ -29,8 +29,8 @@
TokenOptions tokenOptions =
builder.Configuration.GetSection(tokenOptionsConfigurationSection).Get<TokenOptions>()
?? throw new InvalidOperationException($"\"{tokenOptionsConfigurationSection}\" section cannot found in configuration.");
builder.Services
.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
builder
.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
options.TokenValidationParameters = new TokenValidationParameters
Expand All @@ -51,12 +51,11 @@

// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddCors(
opt =>
opt.AddDefaultPolicy(p =>
{
_ = p.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader();
})
builder.Services.AddCors(opt =>
opt.AddDefaultPolicy(p =>
{
_ = p.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader();
})
);
builder.Services.AddSwaggerGen(opt =>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using Application.Features.Users.Commands.Create;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Application.Features.Users.Commands.Create;
using Core.CrossCuttingConcerns.Exceptions.Types;
using Core.Test.Application.Constants;
using FluentValidation.Results;
using StarterProject.Application.Tests.Mocks.FakeDatas;
using StarterProject.Application.Tests.Mocks.Repositories;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
using static Application.Features.Users.Commands.Create.CreateUserCommand;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Application.Features.Users.Commands.Delete;
using System.Threading;
using System.Threading.Tasks;
using Application.Features.Users.Commands.Delete;
using Core.CrossCuttingConcerns.Exceptions.Types;
using StarterProject.Application.Tests.Mocks.FakeDatas;
using StarterProject.Application.Tests.Mocks.Repositories;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
using static Application.Features.Users.Commands.Delete.DeleteUserCommand;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using Application.Features.Users.Commands.Update;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Application.Features.Users.Commands.Update;
using Core.CrossCuttingConcerns.Exceptions.Types;
using Core.Test.Application.Constants;
using FluentValidation.Results;
using StarterProject.Application.Tests.Mocks.FakeDatas;
using StarterProject.Application.Tests.Mocks.Repositories;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
using static Application.Features.Users.Commands.Update.UpdateUserCommand;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Application.Features.Users.Queries.GetById;
using System.Threading;
using System.Threading.Tasks;
using Application.Features.Users.Queries.GetById;
using Core.CrossCuttingConcerns.Exceptions.Types;
using StarterProject.Application.Tests.Mocks.FakeDatas;
using StarterProject.Application.Tests.Mocks.Repositories;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
using static Application.Features.Users.Queries.GetById.GetByIdUserQuery;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Application.Features.Users.Queries.GetList;
using System.Threading;
using System.Threading.Tasks;
using Application.Features.Users.Queries.GetList;
using Core.Application.Requests;
using Core.Application.Responses;
using StarterProject.Application.Tests.Mocks.FakeDatas;
using StarterProject.Application.Tests.Mocks.Repositories;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
using static Application.Features.Users.Queries.GetList.GetListUserQuery;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Microsoft.Extensions.Configuration;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;

namespace StarterProject.Application.Tests.Mocks.Configurations
{
Expand Down
Loading

0 comments on commit bbaa8f8

Please sign in to comment.