From e03db76496459eb2003debe19fc05e4f75e675e1 Mon Sep 17 00:00:00 2001 From: csimonapastore Date: Thu, 19 Jun 2025 19:29:05 +0200 Subject: [PATCH] Fixing sonarcloud issues --- .editorconfig | 23 ++++++++ .../Controllers/AuthController_Tests.cs | 10 ++-- .../Controllers/RoleController_Tests.cs | 52 +++++++++---------- .../Controllers/UserController_Tests.cs | 28 +++++----- .../JwtAuthorizationAttribute_Tests.cs | 2 +- .../Models/Api/Common/Role/UserRole_Tests.cs | 2 +- .../Common/User/AuthenticatedUser_Tests.cs | 2 +- .../Services/UserService_Tests.cs | 6 +-- .../TestsUtils/ExceptionSqlServerContext.cs | 2 +- MainProject.Tests/TestsUtils/ModelsInit.cs | 2 +- MainProject/Controllers/AuthController.cs | 2 +- MainProject/Controllers/BaseController.cs | 2 +- MainProject/Controllers/RoleController.cs | 12 ++--- MainProject/Controllers/RootController.cs | 2 +- MainProject/Controllers/UserController.cs | 30 +++++------ MainProject/Controllers/VersionController.cs | 2 +- ...alidateModelStateAutomaticallyAttribute.cs | 2 +- MainProject/Core/Database/SqlServerContext.cs | 2 +- .../Core/Filters/ValidationActionFilter.cs | 4 +- .../20240904211920_InitialCreate.cs | 2 +- MainProject/Migrations/20241129231345_Try.cs | 2 +- .../20250311195750_AlterTableUser.cs | 2 +- ...12234517_AlterTableUserMaxLengthIndexes.cs | 2 +- ...20250316014620_AlterTablesUsersAndRoles.cs | 2 +- ...AlterBaseUpdateTimeDeletionTimeNullable.cs | 2 +- ...212722_AlterTableRoleAddedIsNotEditable.cs | 2 +- .../20250426183010_AddingPermissionsTables.cs | 2 +- ...12_AlterTableUsersForPasswordEncryption.cs | 2 +- .../Models/Api/Common/Role/UserRole.cs | 2 +- .../Api/Data/Role/CreateRoleRequestData.cs | 2 +- .../Api/Request/Role/CreateRoleRequest.cs | 2 +- .../Api/Response/Auth/AuthenticateResponse.cs | 2 +- .../Models/Api/Response/BaseResponse.cs | 2 +- .../Api/Response/Role/GetRoleResponse.cs | 2 +- .../Api/Response/User/GetUserResponse.cs | 2 +- MainProject/Models/Common/OperationInfo.cs | 4 +- MainProject/Models/Common/PermissionInfo.cs | 4 +- MainProject/Models/Common/PermissionsFile.cs | 2 +- .../Common/RolePermissionModuleOperation.cs | 2 +- MainProject/Models/Database/Mongo/Log.cs | 2 +- .../Database/SqlServer/PermissionModule.cs | 2 +- .../Database/SqlServer/PermissionOperation.cs | 2 +- .../Database/SqlServer/PermissionSystem.cs | 2 +- .../SqlServer/PermissionSystemModule.cs | 2 +- .../PermissionSystemModuleOperation.cs | 2 +- .../RolePermissionSystemModuleOperation.cs | 2 +- MainProject/Models/Settings/AppSettings.cs | 2 +- .../Models/Settings/DatabaseConnection.cs | 2 +- .../Models/Settings/DatabaseSettings.cs | 2 +- .../Models/Settings/EncryptionSettings.cs | 2 +- MainProject/Models/Settings/JwtSettings.cs | 2 +- .../Models/Settings/OpenApiSettings.cs | 2 +- .../Models/Settings/OpenApiSettingsDetails.cs | 2 +- .../Models/Settings/PermissionsSettings.cs | 2 +- .../Models/Settings/PrivateSettings.cs | 2 +- MainProject/Models/Settings/Settings.cs | 2 +- MainProject/Program.cs | 4 +- MainProject/Services/PermissionService.cs | 2 +- MainProject/Services/UserService.cs | 2 +- MainProject/Utils/FileUtils.cs | 2 +- MainProject/Utils/PasswordUtils.cs | 2 +- MainProject/Utils/ProgramUtils.cs | 4 +- 62 files changed, 152 insertions(+), 129 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c9d40fe --- /dev/null +++ b/.editorconfig @@ -0,0 +1,23 @@ +# top-most EditorConfig file +root = true + +# Core EditorConfig properties +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + + +[*.cs] +dotnet_naming_style.pascal_case.capitalization = pascal_case +dotnet_naming_rule.types.symbols = types +dotnet_naming_rule.types.style = pascal_case +dotnet_naming_rule.types.severity = warning + + +csharp_prefer_braced_block = true:suggestion +csharp_preserve_single_line_blocks = true +csharp_style_expression_bodied_methods = when_on_single_line:suggestion diff --git a/MainProject.Tests/Controllers/AuthController_Tests.cs b/MainProject.Tests/Controllers/AuthController_Tests.cs index cf06461..5c26ea1 100644 --- a/MainProject.Tests/Controllers/AuthController_Tests.cs +++ b/MainProject.Tests/Controllers/AuthController_Tests.cs @@ -66,7 +66,7 @@ public class AuthController_Tests var result = (BaseResponse)response.Value; if (result != null) { - Assert.IsTrue(result.Status == StatusCodes.Status200OK); + Assert.AreEqual(StatusCodes.Status200OK, result.Status); Assert.IsInstanceOfType(result.Data, typeof(AuthenticatedUser)); } else @@ -103,7 +103,7 @@ public class AuthController_Tests // var result = (BaseResponse)response.Value; // if (result != null) // { - // Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest); + // Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status); // Assert.IsTrue(result.Message == "Request is not well formed"); // } // else @@ -173,7 +173,7 @@ public class AuthController_Tests // var result = (BaseResponse)response.Value; // if (result != null) // { - // Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest); + // Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status); // Assert.IsTrue(result.Message == "Request is not well formed"); // } // else @@ -212,8 +212,8 @@ public class AuthController_Tests var result = (BaseResponse)response.Value; if (result != null) { - Assert.IsTrue(result.Status == StatusCodes.Status500InternalServerError); - Assert.AreEqual("Something went wrong. Unexpected error", result.Message ); + Assert.AreEqual(StatusCodes.Status500InternalServerError, result.Status); + Assert.AreEqual("Something went wrong. Unexpected error", result.Message); } else { diff --git a/MainProject.Tests/Controllers/RoleController_Tests.cs b/MainProject.Tests/Controllers/RoleController_Tests.cs index 30320a0..ce2d797 100644 --- a/MainProject.Tests/Controllers/RoleController_Tests.cs +++ b/MainProject.Tests/Controllers/RoleController_Tests.cs @@ -75,7 +75,7 @@ public class RoleController_Tests var result = (BaseResponse)response.Value; if (result != null) { - Assert.IsTrue(result.Status == StatusCodes.Status200OK); + Assert.AreEqual(StatusCodes.Status200OK, result.Status); Assert.IsInstanceOfType(result.Data, typeof(RoleDto)); } else @@ -110,7 +110,7 @@ public class RoleController_Tests // var result = (BaseResponse)response.Value; // if (result != null) // { - // Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest); + // Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status); // Assert.IsTrue(result.Message == "Request is not well formed"); // } // else @@ -172,7 +172,7 @@ public class RoleController_Tests // var result = (BaseResponse)response.Value; // if (result != null) // { - // Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest); + // Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status); // Assert.IsTrue(result.Message == "Request is not well formed"); // } // else @@ -207,8 +207,8 @@ public class RoleController_Tests var result = (BaseResponse)response.Value; if (result != null) { - Assert.IsTrue(result.Status == StatusCodes.Status500InternalServerError); - Assert.AreEqual("Something went wrong. Unexpected error", result.Message ); + Assert.AreEqual(StatusCodes.Status500InternalServerError, result.Status); + Assert.AreEqual("Something went wrong. Unexpected error", result.Message); } else { @@ -260,7 +260,7 @@ public class RoleController_Tests var result = (BaseResponse)response.Value; if (result != null) { - Assert.IsTrue(result.Status == StatusCodes.Status200OK); + Assert.AreEqual(StatusCodes.Status200OK, result.Status); Assert.IsInstanceOfType(result.Data, typeof(RoleDto)); } else @@ -302,8 +302,8 @@ public class RoleController_Tests var result = (BaseResponse)response.Value; if (result != null) { - Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest); - Assert.AreEqual("Invalid name", result.Message ); + Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status); + Assert.AreEqual("Invalid name", result.Message); } else { @@ -346,7 +346,7 @@ public class RoleController_Tests // var result = (BaseResponse)response.Value; // if (result != null) // { - // Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest); + // Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status); // Assert.IsTrue(result.Message == "Request is not well formed"); // } // else @@ -396,8 +396,8 @@ public class RoleController_Tests var result = (BaseResponse)response.Value; if (result != null) { - Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest); - Assert.IsTrue(result.Message == "Not created"); + Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status); + Assert.AreEqual("Not created", result.Message); } else { @@ -446,7 +446,7 @@ public class RoleController_Tests // var result = (BaseResponse)response.Value; // if (result != null) // { - // Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest); + // Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status); // Assert.IsTrue(result.Message == "Request is not well formed"); // } // else @@ -499,8 +499,8 @@ public class RoleController_Tests var result = (BaseResponse)response.Value; if (result != null) { - Assert.IsTrue(result.Status == StatusCodes.Status500InternalServerError); - Assert.AreEqual("Something went wrong. Unexpected error", result.Message ); + Assert.AreEqual(StatusCodes.Status500InternalServerError, result.Status); + Assert.AreEqual("Something went wrong. Unexpected error", result.Message); } else { @@ -560,7 +560,7 @@ public class RoleController_Tests // var result = (BaseResponse)response.Value; // if (result != null) // { - // Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest); + // Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status); // Assert.IsTrue(result.Message == "Request is not well formed"); // } // else @@ -622,7 +622,7 @@ public class RoleController_Tests // var result = (BaseResponse)response.Value; // if (result != null) // { - // Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest); + // Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status); // Assert.IsTrue(result.Message == "Request is not well formed"); // } // else @@ -657,8 +657,8 @@ public class RoleController_Tests var result = (BaseResponse)response.Value; if (result != null) { - Assert.IsTrue(result.Status == StatusCodes.Status500InternalServerError); - Assert.AreEqual("Something went wrong. Unexpected error", result.Message ); + Assert.AreEqual(StatusCodes.Status500InternalServerError, result.Status); + Assert.AreEqual("Something went wrong. Unexpected error", result.Message); } else { @@ -713,7 +713,7 @@ public class RoleController_Tests var result = (BaseResponse)response.Value; if (result != null) { - Assert.IsTrue(result.Status == StatusCodes.Status200OK); + Assert.AreEqual(StatusCodes.Status200OK, result.Status); Assert.IsInstanceOfType(result.Data, typeof(RoleDto)); } else @@ -791,8 +791,8 @@ public class RoleController_Tests var result = (BaseResponse)response.Value; if (result != null) { - Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest); - Assert.AreEqual("Invalid name", result.Message ); + Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status); + Assert.AreEqual("Invalid name", result.Message); } else { @@ -837,7 +837,7 @@ public class RoleController_Tests var result = (BaseResponse)response.Value; if (result != null) { - Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest); + Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status); Assert.IsTrue(result.Message == "This role is not editable"); } else @@ -879,7 +879,7 @@ public class RoleController_Tests // var result = (BaseResponse)response.Value; // if (result != null) // { - // Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest); + // Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status); // Assert.IsTrue(result.Message == "Request is not well formed"); // } // else @@ -927,7 +927,7 @@ public class RoleController_Tests // var result = (BaseResponse)response.Value; // if (result != null) // { - // Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest); + // Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status); // Assert.IsTrue(result.Message == "Request is not well formed"); // } // else @@ -981,8 +981,8 @@ public class RoleController_Tests var result = (BaseResponse)response.Value; if (result != null) { - Assert.IsTrue(result.Status == StatusCodes.Status500InternalServerError); - Assert.AreEqual("Something went wrong. Unexpected error", result.Message ); + Assert.AreEqual(StatusCodes.Status500InternalServerError, result.Status); + Assert.AreEqual("Something went wrong. Unexpected error", result.Message); } else { diff --git a/MainProject.Tests/Controllers/UserController_Tests.cs b/MainProject.Tests/Controllers/UserController_Tests.cs index 3e383c3..71ef327 100644 --- a/MainProject.Tests/Controllers/UserController_Tests.cs +++ b/MainProject.Tests/Controllers/UserController_Tests.cs @@ -85,7 +85,7 @@ public class UserController_Tests var result = (BaseResponse)response.Value; if (result != null) { - Assert.IsTrue(result.Status == StatusCodes.Status200OK); + Assert.AreEqual(StatusCodes.Status200OK, result.Status); Assert.IsInstanceOfType(result.Data, typeof(UserDto)); } else @@ -120,7 +120,7 @@ public class UserController_Tests // var result = (BaseResponse)response.Value; // if (result != null) // { - // Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest); + // Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status); // Assert.IsTrue(result.Message == "Request is not well formed"); // } // else @@ -182,7 +182,7 @@ public class UserController_Tests // var result = (BaseResponse)response.Value; // if (result != null) // { - // Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest); + // Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status); // Assert.IsTrue(result.Message == "Request is not well formed"); // } // else @@ -217,8 +217,8 @@ public class UserController_Tests var result = (BaseResponse)response.Value; if (result != null) { - Assert.IsTrue(result.Status == StatusCodes.Status500InternalServerError); - Assert.AreEqual("Something went wrong. Unexpected error", result.Message ); + Assert.AreEqual(StatusCodes.Status500InternalServerError, result.Status); + Assert.AreEqual("Something went wrong. Unexpected error", result.Message); } else { @@ -270,7 +270,7 @@ public class UserController_Tests var result = (BaseResponse)response.Value; if (result != null) { - Assert.IsTrue(result.Status == StatusCodes.Status200OK); + Assert.AreEqual(StatusCodes.Status200OK, result.Status); Assert.IsInstanceOfType(result.Data, typeof(UserDto)); } else @@ -316,7 +316,7 @@ public class UserController_Tests var result = (BaseResponse)response.Value; if (result != null) { - Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest); + Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status); Assert.IsTrue(result.Message == "Invalid email"); } else @@ -367,7 +367,7 @@ public class UserController_Tests var result = (BaseResponse)response.Value; if (result != null) { - Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest); + Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status); Assert.IsTrue(result.Message == "Role not found"); } else @@ -412,7 +412,7 @@ public class UserController_Tests // var result = (BaseResponse)response.Value; // if (result != null) // { - // Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest); + // Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status); // Assert.IsTrue(result.Message == "Request is not well formed"); // } // else @@ -467,8 +467,8 @@ public class UserController_Tests var result = (BaseResponse)response.Value; if (result != null) { - Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest); - Assert.IsTrue(result.Message == "Not created"); + Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status); + Assert.AreEqual("Not created", result.Message); } else { @@ -520,7 +520,7 @@ public class UserController_Tests // var result = (BaseResponse)response.Value; // if (result != null) // { - // Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest); + // Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status); // Console.WriteLine(JsonConvert.SerializeObject(result)); // Assert.IsTrue(result.Message == "Request is not well formed"); // } @@ -582,8 +582,8 @@ public class UserController_Tests var result = (BaseResponse)response.Value; if (result != null) { - Assert.IsTrue(result.Status == StatusCodes.Status500InternalServerError); - Assert.AreEqual("Something went wrong. Unexpected error", result.Message ); + Assert.AreEqual(StatusCodes.Status500InternalServerError, result.Status); + Assert.AreEqual("Something went wrong. Unexpected error", result.Message); } else { diff --git a/MainProject.Tests/Core/Attributes/JwtAuthorizationAttribute_Tests.cs b/MainProject.Tests/Core/Attributes/JwtAuthorizationAttribute_Tests.cs index 1523008..5e1c3fe 100644 --- a/MainProject.Tests/Core/Attributes/JwtAuthorizationAttribute_Tests.cs +++ b/MainProject.Tests/Core/Attributes/JwtAuthorizationAttribute_Tests.cs @@ -143,4 +143,4 @@ public class JwtAuthorizationAttribute_Tests Assert.IsNotInstanceOfType(context.Result, typeof(UnauthorizedResult)); } -} \ No newline at end of file +} diff --git a/MainProject.Tests/Models/Api/Common/Role/UserRole_Tests.cs b/MainProject.Tests/Models/Api/Common/Role/UserRole_Tests.cs index aaa4fb6..f719dab 100644 --- a/MainProject.Tests/Models/Api/Common/Role/UserRole_Tests.cs +++ b/MainProject.Tests/Models/Api/Common/Role/UserRole_Tests.cs @@ -33,4 +33,4 @@ public class UserRole_Tests Assert.Fail($"An exception was thrown: {ex}"); } } -} \ No newline at end of file +} diff --git a/MainProject.Tests/Models/Api/Common/User/AuthenticatedUser_Tests.cs b/MainProject.Tests/Models/Api/Common/User/AuthenticatedUser_Tests.cs index 3d22813..0ef3de1 100644 --- a/MainProject.Tests/Models/Api/Common/User/AuthenticatedUser_Tests.cs +++ b/MainProject.Tests/Models/Api/Common/User/AuthenticatedUser_Tests.cs @@ -36,4 +36,4 @@ public class AuthenticatedUser_Tests Assert.Fail($"An exception was thrown: {ex}"); } } -} \ No newline at end of file +} diff --git a/MainProject.Tests/Services/UserService_Tests.cs b/MainProject.Tests/Services/UserService_Tests.cs index a68ec55..910eec4 100644 --- a/MainProject.Tests/Services/UserService_Tests.cs +++ b/MainProject.Tests/Services/UserService_Tests.cs @@ -34,7 +34,7 @@ public class UserService_Tests Console.WriteLine(ex.InnerException); Assert.Fail($"An exception was thrown: {ex.Message}"); } - } + } [TestMethod] public async Task CheckIfEmailIsValid_EmailNotExists() @@ -366,7 +366,7 @@ public class UserService_Tests var user = await _userService.UpdateUserPasswordAsync(_user!, "this-is-a-new-password"); Assert.IsInstanceOfType(user, typeof(User)); Assert.IsNotNull(user); - Assert.IsTrue(user.Password != oldPassword); + Assert.AreNotEqual(user.Password, oldPassword); } else { @@ -424,7 +424,7 @@ public class UserService_Tests var user = await _userService.UpdateUserRoleAsync(_user!, role); Assert.IsInstanceOfType(user, typeof(User)); Assert.IsNotNull(user); - Assert.IsTrue(user.Role?.Id != oldRole?.Id); + Assert.AreNotEqual(user.Role?.Id, oldRole?.Id); } else { diff --git a/MainProject.Tests/TestsUtils/ExceptionSqlServerContext.cs b/MainProject.Tests/TestsUtils/ExceptionSqlServerContext.cs index 7587a75..465bcbd 100644 --- a/MainProject.Tests/TestsUtils/ExceptionSqlServerContext.cs +++ b/MainProject.Tests/TestsUtils/ExceptionSqlServerContext.cs @@ -21,4 +21,4 @@ public class ExceptionSqlServerContext : SqlServerContext } return base.SaveChangesAsync(cancellationToken); } -} \ No newline at end of file +} diff --git a/MainProject.Tests/TestsUtils/ModelsInit.cs b/MainProject.Tests/TestsUtils/ModelsInit.cs index d97f11b..bcbf9a9 100644 --- a/MainProject.Tests/TestsUtils/ModelsInit.cs +++ b/MainProject.Tests/TestsUtils/ModelsInit.cs @@ -33,4 +33,4 @@ public static class ModelsInit }; return role; } -} \ No newline at end of file +} diff --git a/MainProject/Controllers/AuthController.cs b/MainProject/Controllers/AuthController.cs index 9011ee8..9367729 100644 --- a/MainProject/Controllers/AuthController.cs +++ b/MainProject/Controllers/AuthController.cs @@ -53,4 +53,4 @@ namespace BasicDotnetTemplate.MainProject.Controllers } } -} \ No newline at end of file +} diff --git a/MainProject/Controllers/BaseController.cs b/MainProject/Controllers/BaseController.cs index 45c8e75..491b3f5 100644 --- a/MainProject/Controllers/BaseController.cs +++ b/MainProject/Controllers/BaseController.cs @@ -74,4 +74,4 @@ namespace BasicDotnetTemplate.MainProject.Controllers #nullable disable } -} \ No newline at end of file +} diff --git a/MainProject/Controllers/RoleController.cs b/MainProject/Controllers/RoleController.cs index 966f168..226e960 100644 --- a/MainProject/Controllers/RoleController.cs +++ b/MainProject/Controllers/RoleController.cs @@ -67,9 +67,9 @@ namespace BasicDotnetTemplate.MainProject.Controllers { try { - if (await this._roleService.CheckIfNameIsValid(request.Data.Name)) + if (await this._roleService.CheckIfNameIsValid(request!.Data!.Name)) { - var role = await this._roleService.CreateRoleAsync(request.Data); + var role = await this._roleService.CreateRoleAsync(request!.Data); if (role == null || String.IsNullOrEmpty(role.Guid)) { @@ -121,8 +121,8 @@ namespace BasicDotnetTemplate.MainProject.Controllers } if ( - await this._roleService.CheckIfNameIsValid(request.Data.Name) || - await this._roleService.CheckIfNameIsValid(request.Data.Name, guid) + await this._roleService.CheckIfNameIsValid(request!.Data!.Name) || + await this._roleService.CheckIfNameIsValid(request!.Data!.Name, guid) ) { role = await this._roleService.UpdateRoleAsync(request.Data, role); @@ -167,7 +167,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers return NotFound(); } - await this._roleService.DeleteRoleAsync(role); + await this._roleService.DeleteRoleAsync(role); return Success(String.Empty); } @@ -185,4 +185,4 @@ namespace BasicDotnetTemplate.MainProject.Controllers } -} \ No newline at end of file +} diff --git a/MainProject/Controllers/RootController.cs b/MainProject/Controllers/RootController.cs index f48b1b0..9d38eca 100644 --- a/MainProject/Controllers/RootController.cs +++ b/MainProject/Controllers/RootController.cs @@ -15,4 +15,4 @@ namespace BasicDotnetTemplate.MainProject.Controllers return Ok(); } } -} \ No newline at end of file +} diff --git a/MainProject/Controllers/UserController.cs b/MainProject/Controllers/UserController.cs index e20c4b8..72b46a7 100644 --- a/MainProject/Controllers/UserController.cs +++ b/MainProject/Controllers/UserController.cs @@ -25,7 +25,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers this._userService = userService; this._roleService = roleService; } - + [JwtAuthorization()] [ModelStateValidationHandledByFilterAttribute] @@ -73,13 +73,13 @@ namespace BasicDotnetTemplate.MainProject.Controllers { if (await this._userService.CheckIfEmailIsValid(request!.Data!.Email)) { - var role = await this._roleService.GetRoleForUser(request.Data.RoleGuid); + var role = await this._roleService.GetRoleForUser(request!.Data!.RoleGuid); if (role == null) { return BadRequest("Role not found"); } - var user = await this._userService.CreateUserAsync(request.Data, role); + var user = await this._userService.CreateUserAsync(request!.Data, role); if (user == null || String.IsNullOrEmpty(user.Guid)) { @@ -119,7 +119,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers try { var user = await this._userService.GetUserByGuidAsync(guid); - if(user == null) + if (user == null) { return NotFound(); } @@ -129,7 +129,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers var userDto = _mapper?.Map(user); return Success(String.Empty, userDto); - + } catch (Exception exception) { @@ -141,7 +141,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers return InternalServerError(message); } - } + } [JwtAuthorization()] [ModelStateValidationHandledByFilterAttribute] @@ -154,7 +154,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers try { var user = await this._userService.GetUserByGuidAsync(guid); - if(user == null) + if (user == null) { return NotFound(); } @@ -164,7 +164,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers var userDto = _mapper?.Map(user); return Success(String.Empty, userDto); - + } catch (Exception exception) { @@ -176,7 +176,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers return InternalServerError(message); } - } + } [JwtAuthorization()] [ModelStateValidationHandledByFilterAttribute] @@ -195,7 +195,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers } var user = await this._userService.GetUserByGuidAsync(guid); - if(user == null) + if (user == null) { return NotFound(); } @@ -205,7 +205,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers var userDto = _mapper?.Map(user); return Success(String.Empty, userDto); - + } catch (Exception exception) { @@ -217,8 +217,8 @@ namespace BasicDotnetTemplate.MainProject.Controllers return InternalServerError(message); } - } - + } + [JwtAuthorization()] [ModelStateValidationHandledByFilterAttribute] [HttpDelete("{guid}")] @@ -239,7 +239,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers await this._userService.DeleteUserAsync(user); - return Success(String.Empty); + return Success(String.Empty); } catch (Exception exception) { @@ -254,4 +254,4 @@ namespace BasicDotnetTemplate.MainProject.Controllers } } -} \ No newline at end of file +} diff --git a/MainProject/Controllers/VersionController.cs b/MainProject/Controllers/VersionController.cs index ee527ed..3d81653 100644 --- a/MainProject/Controllers/VersionController.cs +++ b/MainProject/Controllers/VersionController.cs @@ -16,4 +16,4 @@ namespace BasicDotnetTemplate.MainProject.Controllers return Success(String.Empty, _appSettings?.Settings?.Version); } } -} \ No newline at end of file +} diff --git a/MainProject/Core/Attributes/ValidateModelStateAutomaticallyAttribute.cs b/MainProject/Core/Attributes/ValidateModelStateAutomaticallyAttribute.cs index 72c8d08..ad8cd1b 100644 --- a/MainProject/Core/Attributes/ValidateModelStateAutomaticallyAttribute.cs +++ b/MainProject/Core/Attributes/ValidateModelStateAutomaticallyAttribute.cs @@ -9,4 +9,4 @@ namespace BasicDotnetTemplate.MainProject.Core.Attributes [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)] public class ModelStateValidationHandledByFilterAttribute : Attribute { } -} \ No newline at end of file +} diff --git a/MainProject/Core/Database/SqlServerContext.cs b/MainProject/Core/Database/SqlServerContext.cs index f36d364..16b0ae9 100644 --- a/MainProject/Core/Database/SqlServerContext.cs +++ b/MainProject/Core/Database/SqlServerContext.cs @@ -18,7 +18,7 @@ namespace BasicDotnetTemplate.MainProject.Core.Database public DbSet PermissionOperations { get; set; } public DbSet PermissionSystems { get; set; } public DbSet PermissionSystemModules { get; set; } - public DbSet PermissionSystemModuleOperations { get; set; } + public DbSet PermissionSystemModuleOperations { get; set; } public DbSet RolePermissionSystemModuleOperations { get; set; } public DbSet Roles { get; set; } public DbSet Users { get; set; } diff --git a/MainProject/Core/Filters/ValidationActionFilter.cs b/MainProject/Core/Filters/ValidationActionFilter.cs index 16f942a..a5c6fc9 100644 --- a/MainProject/Core/Filters/ValidationActionFilter.cs +++ b/MainProject/Core/Filters/ValidationActionFilter.cs @@ -13,7 +13,7 @@ namespace BasicDotnetTemplate.MainProject.Core.Filters if (!context.ModelState.IsValid) { context.Result = new BadRequestObjectResult(new { message = _requestNotWellFormedMessage, errors = context.ModelState }); - return; + return; } var requestBody = context.ActionArguments.Values.FirstOrDefault(arg => arg != null && !arg.GetType().IsPrimitive && !(arg is string)); @@ -27,4 +27,4 @@ namespace BasicDotnetTemplate.MainProject.Core.Filters await next(); } } -} \ No newline at end of file +} diff --git a/MainProject/Migrations/20240904211920_InitialCreate.cs b/MainProject/Migrations/20240904211920_InitialCreate.cs index ed4ccbc..d7cf0c6 100644 --- a/MainProject/Migrations/20240904211920_InitialCreate.cs +++ b/MainProject/Migrations/20240904211920_InitialCreate.cs @@ -1,4 +1,4 @@ -using System; +using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/MainProject/Migrations/20241129231345_Try.cs b/MainProject/Migrations/20241129231345_Try.cs index 46addf6..29573f2 100644 --- a/MainProject/Migrations/20241129231345_Try.cs +++ b/MainProject/Migrations/20241129231345_Try.cs @@ -1,4 +1,4 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/MainProject/Migrations/20250311195750_AlterTableUser.cs b/MainProject/Migrations/20250311195750_AlterTableUser.cs index 26df65b..b846699 100644 --- a/MainProject/Migrations/20250311195750_AlterTableUser.cs +++ b/MainProject/Migrations/20250311195750_AlterTableUser.cs @@ -1,4 +1,4 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/MainProject/Migrations/20250312234517_AlterTableUserMaxLengthIndexes.cs b/MainProject/Migrations/20250312234517_AlterTableUserMaxLengthIndexes.cs index 862a803..ca6e66d 100644 --- a/MainProject/Migrations/20250312234517_AlterTableUserMaxLengthIndexes.cs +++ b/MainProject/Migrations/20250312234517_AlterTableUserMaxLengthIndexes.cs @@ -1,4 +1,4 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/MainProject/Migrations/20250316014620_AlterTablesUsersAndRoles.cs b/MainProject/Migrations/20250316014620_AlterTablesUsersAndRoles.cs index b3192e0..bae0d5a 100644 --- a/MainProject/Migrations/20250316014620_AlterTablesUsersAndRoles.cs +++ b/MainProject/Migrations/20250316014620_AlterTablesUsersAndRoles.cs @@ -1,4 +1,4 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/MainProject/Migrations/20250316212343_AlterBaseUpdateTimeDeletionTimeNullable.cs b/MainProject/Migrations/20250316212343_AlterBaseUpdateTimeDeletionTimeNullable.cs index 5c7c4c9..1d789d6 100644 --- a/MainProject/Migrations/20250316212343_AlterBaseUpdateTimeDeletionTimeNullable.cs +++ b/MainProject/Migrations/20250316212343_AlterBaseUpdateTimeDeletionTimeNullable.cs @@ -1,4 +1,4 @@ -using System; +using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/MainProject/Migrations/20250316212722_AlterTableRoleAddedIsNotEditable.cs b/MainProject/Migrations/20250316212722_AlterTableRoleAddedIsNotEditable.cs index 423f594..ecb0ae0 100644 --- a/MainProject/Migrations/20250316212722_AlterTableRoleAddedIsNotEditable.cs +++ b/MainProject/Migrations/20250316212722_AlterTableRoleAddedIsNotEditable.cs @@ -1,4 +1,4 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/MainProject/Migrations/20250426183010_AddingPermissionsTables.cs b/MainProject/Migrations/20250426183010_AddingPermissionsTables.cs index 3390e0d..7edef53 100644 --- a/MainProject/Migrations/20250426183010_AddingPermissionsTables.cs +++ b/MainProject/Migrations/20250426183010_AddingPermissionsTables.cs @@ -1,4 +1,4 @@ -using System; +using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/MainProject/Migrations/20250617183212_AlterTableUsersForPasswordEncryption.cs b/MainProject/Migrations/20250617183212_AlterTableUsersForPasswordEncryption.cs index 3fd90e8..585901a 100644 --- a/MainProject/Migrations/20250617183212_AlterTableUsersForPasswordEncryption.cs +++ b/MainProject/Migrations/20250617183212_AlterTableUsersForPasswordEncryption.cs @@ -1,4 +1,4 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable diff --git a/MainProject/Models/Api/Common/Role/UserRole.cs b/MainProject/Models/Api/Common/Role/UserRole.cs index b568ca7..b5b6097 100644 --- a/MainProject/Models/Api/Common/Role/UserRole.cs +++ b/MainProject/Models/Api/Common/Role/UserRole.cs @@ -9,7 +9,7 @@ public class UserRole public string? Name { get; set; } #nullable disable - public UserRole() {} + public UserRole() { } public UserRole(DatabaseSqlServer.Role role) { diff --git a/MainProject/Models/Api/Data/Role/CreateRoleRequestData.cs b/MainProject/Models/Api/Data/Role/CreateRoleRequestData.cs index 9cff830..0a6a1a9 100644 --- a/MainProject/Models/Api/Data/Role/CreateRoleRequestData.cs +++ b/MainProject/Models/Api/Data/Role/CreateRoleRequestData.cs @@ -8,4 +8,4 @@ public class CreateRoleRequestData public required string Name { get; set; } public required bool IsNotEditable { get; set; } -} \ No newline at end of file +} diff --git a/MainProject/Models/Api/Request/Role/CreateRoleRequest.cs b/MainProject/Models/Api/Request/Role/CreateRoleRequest.cs index d83636a..3d2df0c 100644 --- a/MainProject/Models/Api/Request/Role/CreateRoleRequest.cs +++ b/MainProject/Models/Api/Request/Role/CreateRoleRequest.cs @@ -7,4 +7,4 @@ public class CreateRoleRequest #nullable enable public CreateRoleRequestData? Data { get; set; } #nullable disable -} \ No newline at end of file +} diff --git a/MainProject/Models/Api/Response/Auth/AuthenticateResponse.cs b/MainProject/Models/Api/Response/Auth/AuthenticateResponse.cs index 8d36f75..8827d00 100644 --- a/MainProject/Models/Api/Response/Auth/AuthenticateResponse.cs +++ b/MainProject/Models/Api/Response/Auth/AuthenticateResponse.cs @@ -5,4 +5,4 @@ namespace BasicDotnetTemplate.MainProject.Models.Api.Response.Auth; public class AuthenticateResponse : BaseResponse { public AuthenticateResponse(int status, string? message, AuthenticatedUser? data) : base(status, message, data) { } -} \ No newline at end of file +} diff --git a/MainProject/Models/Api/Response/BaseResponse.cs b/MainProject/Models/Api/Response/BaseResponse.cs index 2b87876..70c7e99 100644 --- a/MainProject/Models/Api/Response/BaseResponse.cs +++ b/MainProject/Models/Api/Response/BaseResponse.cs @@ -16,4 +16,4 @@ public class BaseResponse public virtual dynamic? Data { get; set; } #nullable disable -} \ No newline at end of file +} diff --git a/MainProject/Models/Api/Response/Role/GetRoleResponse.cs b/MainProject/Models/Api/Response/Role/GetRoleResponse.cs index 957646c..a061159 100644 --- a/MainProject/Models/Api/Response/Role/GetRoleResponse.cs +++ b/MainProject/Models/Api/Response/Role/GetRoleResponse.cs @@ -5,4 +5,4 @@ namespace BasicDotnetTemplate.MainProject.Models.Api.Response.Role; public class GetRoleResponse : BaseResponse { public GetRoleResponse(int status, string? message, RoleDto? data) : base(status, message, data) { } -} \ No newline at end of file +} diff --git a/MainProject/Models/Api/Response/User/GetUserResponse.cs b/MainProject/Models/Api/Response/User/GetUserResponse.cs index b1979fa..b0989a6 100644 --- a/MainProject/Models/Api/Response/User/GetUserResponse.cs +++ b/MainProject/Models/Api/Response/User/GetUserResponse.cs @@ -5,4 +5,4 @@ namespace BasicDotnetTemplate.MainProject.Models.Api.Response.User; public class GetUserResponse : BaseResponse { public GetUserResponse(int status, string? message, UserDto? data) : base(status, message, data) { } -} \ No newline at end of file +} diff --git a/MainProject/Models/Common/OperationInfo.cs b/MainProject/Models/Common/OperationInfo.cs index 7e9a9a8..eb3a0dd 100644 --- a/MainProject/Models/Common/OperationInfo.cs +++ b/MainProject/Models/Common/OperationInfo.cs @@ -4,6 +4,6 @@ public class OperationInfo { #nullable enable public string? Operation { get; set; } - public List? Roles {get; set; } + public List? Roles { get; set; } #nullable disable -} \ No newline at end of file +} diff --git a/MainProject/Models/Common/PermissionInfo.cs b/MainProject/Models/Common/PermissionInfo.cs index 558fc5d..369f2d6 100644 --- a/MainProject/Models/Common/PermissionInfo.cs +++ b/MainProject/Models/Common/PermissionInfo.cs @@ -4,6 +4,6 @@ public class PermissionInfo { #nullable enable public string? System { get; set; } - public List? RolePermissionModuleOperations {get; set; } + public List? RolePermissionModuleOperations { get; set; } #nullable disable -} \ No newline at end of file +} diff --git a/MainProject/Models/Common/PermissionsFile.cs b/MainProject/Models/Common/PermissionsFile.cs index f5a4d7b..c515d92 100644 --- a/MainProject/Models/Common/PermissionsFile.cs +++ b/MainProject/Models/Common/PermissionsFile.cs @@ -5,4 +5,4 @@ public class PermissionsFile #nullable enable public List? PermissionInfos { get; set; } #nullable disable -} \ No newline at end of file +} diff --git a/MainProject/Models/Common/RolePermissionModuleOperation.cs b/MainProject/Models/Common/RolePermissionModuleOperation.cs index 6d132e5..3af3e33 100644 --- a/MainProject/Models/Common/RolePermissionModuleOperation.cs +++ b/MainProject/Models/Common/RolePermissionModuleOperation.cs @@ -6,4 +6,4 @@ public class RolePermissionModuleOperation public string? Module { get; set; } public List? Operations { get; set; } #nullable disable -} \ No newline at end of file +} diff --git a/MainProject/Models/Database/Mongo/Log.cs b/MainProject/Models/Database/Mongo/Log.cs index f3d4e92..7694b26 100644 --- a/MainProject/Models/Database/Mongo/Log.cs +++ b/MainProject/Models/Database/Mongo/Log.cs @@ -8,4 +8,4 @@ namespace BasicDotnetTemplate.MainProject.Models.Database.Mongo [BsonId] public ObjectId Id { get; set; } } -} \ No newline at end of file +} diff --git a/MainProject/Models/Database/SqlServer/PermissionModule.cs b/MainProject/Models/Database/SqlServer/PermissionModule.cs index dba3a92..72baa47 100644 --- a/MainProject/Models/Database/SqlServer/PermissionModule.cs +++ b/MainProject/Models/Database/SqlServer/PermissionModule.cs @@ -8,4 +8,4 @@ namespace BasicDotnetTemplate.MainProject.Models.Database.SqlServer public required string Name { get; set; } public required bool Enabled { get; set; } } -} \ No newline at end of file +} diff --git a/MainProject/Models/Database/SqlServer/PermissionOperation.cs b/MainProject/Models/Database/SqlServer/PermissionOperation.cs index 4080277..7770331 100644 --- a/MainProject/Models/Database/SqlServer/PermissionOperation.cs +++ b/MainProject/Models/Database/SqlServer/PermissionOperation.cs @@ -7,4 +7,4 @@ namespace BasicDotnetTemplate.MainProject.Models.Database.SqlServer [MaxLength(100)] public required string Name { get; set; } } -} \ No newline at end of file +} diff --git a/MainProject/Models/Database/SqlServer/PermissionSystem.cs b/MainProject/Models/Database/SqlServer/PermissionSystem.cs index 7b28d33..8f5e185 100644 --- a/MainProject/Models/Database/SqlServer/PermissionSystem.cs +++ b/MainProject/Models/Database/SqlServer/PermissionSystem.cs @@ -8,4 +8,4 @@ namespace BasicDotnetTemplate.MainProject.Models.Database.SqlServer public required string Name { get; set; } public required bool Enabled { get; set; } } -} \ No newline at end of file +} diff --git a/MainProject/Models/Database/SqlServer/PermissionSystemModule.cs b/MainProject/Models/Database/SqlServer/PermissionSystemModule.cs index 84eef1f..2ce3eae 100644 --- a/MainProject/Models/Database/SqlServer/PermissionSystemModule.cs +++ b/MainProject/Models/Database/SqlServer/PermissionSystemModule.cs @@ -10,4 +10,4 @@ namespace BasicDotnetTemplate.MainProject.Models.Database.SqlServer public required PermissionModule PermissionModule { get; set; } public required bool Enabled { get; set; } } -} \ No newline at end of file +} diff --git a/MainProject/Models/Database/SqlServer/PermissionSystemModuleOperation.cs b/MainProject/Models/Database/SqlServer/PermissionSystemModuleOperation.cs index deb5d8b..f716058 100644 --- a/MainProject/Models/Database/SqlServer/PermissionSystemModuleOperation.cs +++ b/MainProject/Models/Database/SqlServer/PermissionSystemModuleOperation.cs @@ -10,4 +10,4 @@ namespace BasicDotnetTemplate.MainProject.Models.Database.SqlServer public required PermissionSystemModule PermissionSystemModule { get; set; } public required PermissionOperation PermissionOperation { get; set; } } -} \ No newline at end of file +} diff --git a/MainProject/Models/Database/SqlServer/RolePermissionSystemModuleOperation.cs b/MainProject/Models/Database/SqlServer/RolePermissionSystemModuleOperation.cs index d42be00..d1f437a 100644 --- a/MainProject/Models/Database/SqlServer/RolePermissionSystemModuleOperation.cs +++ b/MainProject/Models/Database/SqlServer/RolePermissionSystemModuleOperation.cs @@ -10,4 +10,4 @@ namespace BasicDotnetTemplate.MainProject.Models.Database.SqlServer public required Role Role { get; set; } public required PermissionSystemModuleOperation PermissionSystemModuleOperation { get; set; } } -} \ No newline at end of file +} diff --git a/MainProject/Models/Settings/AppSettings.cs b/MainProject/Models/Settings/AppSettings.cs index 3df03e9..b337c1b 100644 --- a/MainProject/Models/Settings/AppSettings.cs +++ b/MainProject/Models/Settings/AppSettings.cs @@ -11,4 +11,4 @@ public class AppSettings public EncryptionSettings? EncryptionSettings { get; set; } public PermissionsSettings? PermissionsSettings { get; set; } #nullable disable -} \ No newline at end of file +} diff --git a/MainProject/Models/Settings/DatabaseConnection.cs b/MainProject/Models/Settings/DatabaseConnection.cs index e6d867d..09ba894 100644 --- a/MainProject/Models/Settings/DatabaseConnection.cs +++ b/MainProject/Models/Settings/DatabaseConnection.cs @@ -7,4 +7,4 @@ public class DatabaseConnection public string? Postgres { get; set; } public string? Mongodb { get; set; } #nullable disable -} \ No newline at end of file +} diff --git a/MainProject/Models/Settings/DatabaseSettings.cs b/MainProject/Models/Settings/DatabaseSettings.cs index 3ac3be2..ead53f7 100644 --- a/MainProject/Models/Settings/DatabaseSettings.cs +++ b/MainProject/Models/Settings/DatabaseSettings.cs @@ -7,4 +7,4 @@ public class DatabaseSettings public string? MongoDbConnectionString { get; set; } public string? PostgreSQLConnectionString { get; set; } #nullable disable -} \ No newline at end of file +} diff --git a/MainProject/Models/Settings/EncryptionSettings.cs b/MainProject/Models/Settings/EncryptionSettings.cs index 0a03110..910d911 100644 --- a/MainProject/Models/Settings/EncryptionSettings.cs +++ b/MainProject/Models/Settings/EncryptionSettings.cs @@ -7,4 +7,4 @@ public class EncryptionSettings public string? Salt { get; set; } public int? Iterations { get; set; } #nullable disable -} \ No newline at end of file +} diff --git a/MainProject/Models/Settings/JwtSettings.cs b/MainProject/Models/Settings/JwtSettings.cs index 23f3690..a578085 100644 --- a/MainProject/Models/Settings/JwtSettings.cs +++ b/MainProject/Models/Settings/JwtSettings.cs @@ -9,4 +9,4 @@ public class JwtSettings public int? ExpiredAfterMinsOfInactivity { get; set; } #nullable disable -} \ No newline at end of file +} diff --git a/MainProject/Models/Settings/OpenApiSettings.cs b/MainProject/Models/Settings/OpenApiSettings.cs index 35aa38d..6a909c8 100644 --- a/MainProject/Models/Settings/OpenApiSettings.cs +++ b/MainProject/Models/Settings/OpenApiSettings.cs @@ -7,4 +7,4 @@ public class OpenApiSettings public OpenApiSettingsDetails? OpenApiContact { get; set; } public OpenApiSettingsDetails? OpenApiLicense { get; set; } #nullable disable -} \ No newline at end of file +} diff --git a/MainProject/Models/Settings/OpenApiSettingsDetails.cs b/MainProject/Models/Settings/OpenApiSettingsDetails.cs index 08d5d97..dd2ea10 100644 --- a/MainProject/Models/Settings/OpenApiSettingsDetails.cs +++ b/MainProject/Models/Settings/OpenApiSettingsDetails.cs @@ -6,4 +6,4 @@ public class OpenApiSettingsDetails public string? Name { get; set; } public string? Url { get; set; } #nullable disable -} \ No newline at end of file +} diff --git a/MainProject/Models/Settings/PermissionsSettings.cs b/MainProject/Models/Settings/PermissionsSettings.cs index 495dc9a..82c485f 100644 --- a/MainProject/Models/Settings/PermissionsSettings.cs +++ b/MainProject/Models/Settings/PermissionsSettings.cs @@ -5,4 +5,4 @@ public class PermissionsSettings #nullable enable public string? FilePath { get; set; } #nullable disable -} \ No newline at end of file +} diff --git a/MainProject/Models/Settings/PrivateSettings.cs b/MainProject/Models/Settings/PrivateSettings.cs index 0ad3b8b..ffd9ebf 100644 --- a/MainProject/Models/Settings/PrivateSettings.cs +++ b/MainProject/Models/Settings/PrivateSettings.cs @@ -5,4 +5,4 @@ public class PrivateSettings #nullable enable public DatabaseConnection? DatabaseConnection { get; set; } #nullable disable -} \ No newline at end of file +} diff --git a/MainProject/Models/Settings/Settings.cs b/MainProject/Models/Settings/Settings.cs index 2932223..001b510 100644 --- a/MainProject/Models/Settings/Settings.cs +++ b/MainProject/Models/Settings/Settings.cs @@ -7,4 +7,4 @@ public class Settings public string? Version { get; set; } public string? Description { get; set; } #nullable disable -} \ No newline at end of file +} diff --git a/MainProject/Program.cs b/MainProject/Program.cs index e6213b2..b887e91 100644 --- a/MainProject/Program.cs +++ b/MainProject/Program.cs @@ -1,4 +1,4 @@ -using NLog; +using NLog; using BasicDotnetTemplate.MainProject.Models.Settings; using System.Reflection; using BasicDotnetTemplate.MainProject.Utils; @@ -60,4 +60,4 @@ internal static class Program NLog.LogManager.Shutdown(); // Flush and close down internal threads and timers } -} \ No newline at end of file +} diff --git a/MainProject/Services/PermissionService.cs b/MainProject/Services/PermissionService.cs index 8ab2923..bc695b5 100644 --- a/MainProject/Services/PermissionService.cs +++ b/MainProject/Services/PermissionService.cs @@ -1275,4 +1275,4 @@ public class PermissionService : BaseService, IPermissionService -} \ No newline at end of file +} diff --git a/MainProject/Services/UserService.cs b/MainProject/Services/UserService.cs index 2f04ce5..ac6f01b 100644 --- a/MainProject/Services/UserService.cs +++ b/MainProject/Services/UserService.cs @@ -191,7 +191,7 @@ public class UserService : BaseService, IUserService user.PasswordSalt = salt; user.PasswordPepper = pepper; - user.PasswordIterations = iterations; + user.PasswordIterations = iterations; user.Password = CryptUtils.GeneratePassword(newPassword, salt, iterations, pepper); user.UpdateTime = DateTime.UtcNow; user.UpdateUserId = this.GetCurrentUserId(); diff --git a/MainProject/Utils/FileUtils.cs b/MainProject/Utils/FileUtils.cs index 5c7be6e..6c84819 100644 --- a/MainProject/Utils/FileUtils.cs +++ b/MainProject/Utils/FileUtils.cs @@ -39,4 +39,4 @@ public static class FileUtils } } -} \ No newline at end of file +} diff --git a/MainProject/Utils/PasswordUtils.cs b/MainProject/Utils/PasswordUtils.cs index b1cd1fc..f61ad80 100644 --- a/MainProject/Utils/PasswordUtils.cs +++ b/MainProject/Utils/PasswordUtils.cs @@ -29,7 +29,7 @@ public static partial class PasswordUtils private static partial Regex RegexSpecial(); private static readonly Regex RegexIdenticalChars = new( - @"(\S)\1{2,}", + @"(\S)\1{2,}", RegexOptions.IgnoreCase | RegexOptions.Compiled, TimeSpan.FromMilliseconds(100) ); diff --git a/MainProject/Utils/ProgramUtils.cs b/MainProject/Utils/ProgramUtils.cs index 0ab8959..b2cd6a0 100644 --- a/MainProject/Utils/ProgramUtils.cs +++ b/MainProject/Utils/ProgramUtils.cs @@ -142,7 +142,7 @@ public static class ProgramUtils builder.Services.AddAuthorization(); builder.Services.AddControllers(options => { - options.Filters.Add(); + options.Filters.Add(); }); builder.Services.AddEndpointsApiExplorer(); @@ -295,4 +295,4 @@ public static class ProgramUtils } } -} \ No newline at end of file +}