From 9a938cb25c9adc68e5b3dbcca3149c44aeea7998 Mon Sep 17 00:00:00 2001 From: Bram1903 <70259613+Bram1903@users.noreply.github.com> Date: Mon, 24 Apr 2023 21:21:43 +0200 Subject: [PATCH 1/7] Removed: Unnecessary Usings --- .../Behaviours/AuthorizationBehaviour.cs | 1 - .../Common/Behaviours/MemoryCacheBehaviour.cs | 2 -- .../Behaviours/UnhandledExceptionBehaviour.cs | 2 -- .../ExceptionHandlers/DbExceptionHandler.cs | 10 +------ .../ValidationExceptionHandler.cs | 9 +----- .../Common/Extensions/DataRowExtensions.cs | 2 -- .../DescriptionAttributeExtensions.cs | 5 +--- .../Common/Extensions/ExpressionExtensions.cs | 5 ---- .../Common/Helper/ConstantStringLocalizer.cs | 1 - .../Interfaces/IApplicationDbContext.cs | 1 - .../Common/Interfaces/IMailService.cs | 1 - .../Common/Interfaces/ISpecification.cs | 1 - .../Interfaces/Identity/IUserDataProvider.cs | 1 - .../DefaultJsonSerializerOptions.cs | 1 - .../Common/Mappings/MappingProfile.cs | 2 -- .../ParallelNoWaitPublisher.cs | 8 +----- .../RegisterFormModelFluentValidator.cs | 2 -- .../Common/Specification/Specification.cs | 1 - src/Application/Constants/ConstantString.cs | 8 +----- .../Constants/Permission/Permissions.cs | 3 -- src/Application/DependencyInjection.cs | 3 -- .../AuditTrails/DTOs/AuditTrailDto.cs | 1 - .../AuditTrailsWithPaginationQuery.cs | 4 --- .../AddEdit/AddEditCustomerCommand.cs | 3 +- .../Commands/Create/CreateCustomerCommand.cs | 4 +-- .../Commands/Delete/DeleteCustomerCommand.cs | 2 -- .../Commands/Import/ImportCustomersCommand.cs | 2 +- .../Commands/Update/UpdateCustomerCommand.cs | 4 +-- .../Features/Customers/DTOs/CustomerDto.cs | 1 - .../Queries/GetAll/GetAllCustomersQuery.cs | 2 +- .../Queries/GetById/GetCustomerByIdQuery.cs | 2 +- .../Pagination/CustomersPaginationQuery.cs | 2 +- .../AddEdit/AddEditDocumentCommand.cs | 3 +- .../Commands/Upload/UploadDocumentCommand.cs | 1 - .../DocumentCreatedEventHandler.cs | 1 - .../DocumentDeletedEventHandler.cs | 5 ---- .../GetFileStream/GetFileStreamQuery.cs | 2 -- .../DocumentsWithPaginationQuery.cs | 4 +-- .../Notification/UpdateUserProfileCommand.cs | 8 +----- .../AddEditKeyValueCommandValidator.cs | 2 -- .../Commands/Import/ImportKeyValuesCommand.cs | 1 - .../KeyValuesWithPaginationQuery.cs | 3 +- .../Commands/Clear/ClearLogsCommand.cs | 3 -- .../LogsWithPaginationQuery.cs | 3 -- .../Commands/AddEdit/AddEditProductCommand.cs | 1 - .../Commands/Delete/DeleteProductCommand.cs | 1 - .../Features/Products/DTOs/ProductDto.cs | 3 -- .../Pagination/ProductsPaginationQuery.cs | 3 -- .../SearchProductSpecification.cs | 3 -- .../Commands/AddEdit/AddEditTenantCommand.cs | 3 +- .../Commands/Delete/DeleteTenantCommand.cs | 2 -- .../Queries/GetAll/GetAllTenantsQuery.cs | 2 +- .../Pagination/TenantsPaginationQuery.cs | 3 +- .../Services/MultiTenant/TenantService.cs | 1 - .../Services/PaddleOCR/IDocumentOcrJob.cs | 7 ----- .../Services/Picklist/PicklistService.cs | 3 -- .../Components/Common/CustomError.razor | 1 - .../Components/Common/CustomValidation.cs | 1 - .../Components/Common/DataGridExtensions.cs | 1 + .../Components/Common/ErrorHandler.razor.cs | 2 -- .../Components/Common/MudEnumSelect.razor | 8 ++---- .../Common/PickSuperiorIdAutocomplete.cs | 2 -- .../Components/Common/PickUserAutocomplete.cs | 2 -- .../Components/Common/PicklistAutocomplete.cs | 4 --- .../Localization/LanguageSelector.razor | 4 +-- .../Components/Shared/LandingSection.razor | 2 -- .../Components/Shared/NavMenu.razor.cs | 2 -- .../Shared/NotificationMenu.razor.cs | 2 -- .../Components/Shared/SideMenu.razor | 2 +- .../Shared/Themes/ThemesButton.razor.cs | 1 - .../Components/Shared/Themes/ThemesMenu.razor | 2 +- .../Shared/Themes/ThemesMenu.razor.cs | 2 -- .../Components/Shared/UserMenu.razor | 2 +- .../Components/Shared/UserMenu.razor.cs | 2 -- src/Blazor.Server.UI/ConfigureServices.cs | 8 ++---- .../EndPoints/AuthController.cs | 1 - .../Models/Notification/NotificationModel.cs | 2 -- .../Pages/Authentication/Forgot.razor | 6 ++-- .../Pages/Authentication/Login.razor | 12 +++----- .../Pages/Authentication/Register.razor | 10 ++----- .../Pages/Customers/Customers.razor | 9 +++--- .../Pages/Customers/_CustomerFormDialog.razor | 1 - .../Pages/Documents/Documents.razor | 19 ++++++------- .../Pages/Documents/_DocumentFormDialog.razor | 3 -- .../Documents/_UploadFilesFormDialog.razor | 6 +--- .../Pages/Identity/Roles/RoleDtoValidator.cs | 1 - .../Pages/Identity/Roles/Roles.razor | 13 +++------ .../Identity/Roles/_RoleFormDialog.razor | 2 +- .../Identity/Users/ChangePasswordModel.cs | 4 +-- .../Pages/Identity/Users/OrgItem.cs | 3 -- .../Pages/Identity/Users/Profile.razor | 4 --- .../Pages/Identity/Users/Profile.razor.cs | 9 +++--- .../Identity/Users/ResetPasswordFormModel.cs | 2 -- .../Pages/Identity/Users/UserDtoValidator.cs | 3 -- .../Pages/Identity/Users/Users.razor | 28 +++++++------------ .../Pages/Identity/Users/_UserForm.razor | 8 +----- .../Identity/Users/_UserFormDialog.razor | 2 +- src/Blazor.Server.UI/Pages/Index.razor | 5 ++-- .../Pages/Products/Products.razor | 10 +++---- .../Pages/Products/_ProductFormDialog.razor | 3 -- .../Pages/SystemManagement/AuditTrails.razor | 2 +- .../Components/LogsLineCharts.razor | 5 ++-- .../Pages/SystemManagement/Dictionaries.razor | 11 +++----- .../Pages/SystemManagement/Logs.razor | 2 +- .../_CreatePicklistDialog.razor | 5 +--- .../Pages/Tenants/Tenants.razor | 8 ++---- .../Pages/Tenants/_TenantFormDialog.razor | 3 -- src/Blazor.Server.UI/Pages/_Layout.cshtml | 1 - src/Blazor.Server.UI/Program.cs | 11 +++----- .../Services/JsInterop/InputClear.cs | 4 +-- .../Services/JsInterop/OrgChart.cs | 4 +-- .../Services/Layout/LayoutService.cs | 2 -- .../Services/Navigation/MenuService.cs | 2 -- .../InMemoryNotificationService.cs | 2 -- .../Shared/MainLayout.razor.cs | 4 --- .../Shared/UserLoginState.razor | 5 ---- src/Blazor.Server.UI/Theme/DefaultTheme.cs | 2 -- src/Blazor.Server.UI/appsettings.json | 2 +- src/Domain/Common/IMustHaveTenant.cs | 6 ---- src/Domain/Entities/Audit/AuditTrail.cs | 1 - src/Domain/Entities/Tenant.cs | 6 ---- src/Domain/Enums/DocumentType.cs | 6 ---- src/Domain/Enums/ExportType.cs | 8 +----- src/Domain/Enums/JobStatus.cs | 6 ---- src/Domain/Identity/ApplicationUser.cs | 1 - src/Infrastructure/DependencyInjection.cs | 4 +-- .../ApplicationBuilderExtensions.cs | 2 -- ...thenticationServiceCollectionExtensions.cs | 3 -- .../HangfireServiceCollectionExtensions.cs | 4 --- .../HttpClientServiceCollectionExtensions.cs | 3 +- .../Extensions/MediatorExtensions.cs | 5 ---- .../MessageServiceCollectionExtensions.cs | 1 - src/Infrastructure/Hubs/HubClient.cs | 3 -- src/Infrastructure/Hubs/SignalRHub.cs | 3 -- .../ExceptionHandlingMiddleware.cs | 1 - .../HangfireDashboardAuthorizationFilter.cs | 7 +---- .../Persistence/ApplicationDbContext.cs | 2 -- .../Configurations/AuditTrailConfiguration.cs | 2 -- .../Configurations/CustomerConfiguration.cs | 2 -- .../Configurations/ProductConfiguration.cs | 4 --- .../Conversions/ValueConversionExtensions.cs | 7 +---- .../AuditableEntitySaveChangesInterceptor.cs | 5 ---- .../ApplicationClaimsIdentityFactory.cs | 2 -- .../Services/CurrentUserService.cs | 5 ---- src/Infrastructure/Services/ExcelService.cs | 2 +- .../Services/Identity/IdentityService.cs | 8 ++---- .../Services/Identity/UserDataProvider.cs | 1 - .../Services/InMemoryTicketStore.cs | 2 +- .../Services/JWT/AccessTokenProvider.cs | 2 +- .../Services/JWT/BlazorAuthStateProvider.cs | 8 +----- src/Infrastructure/Services/MailService.cs | 4 --- src/Infrastructure/Services/PDFService.cs | 1 - .../Services/PaddleOCR/DocumentOcrJob.cs | 9 ------ .../Serialization/SystemTextJsonSerializer.cs | 3 -- .../Commands/AddEditKeyValueCommandTests.cs | 8 +----- .../KeyValues/Commands/DeleteKeyValueTests.cs | 8 +++--- .../Queries/ExportKeyValuesQueryTests.cs | 7 +---- .../KeyValuesWithPaginationQueryTests.cs | 7 +---- .../Commands/AddEditProductCommandTests.cs | 7 +---- .../Commands/DeleteProductCommandTests.cs | 7 +---- .../Commands/ImportProductsCommandTests.cs | 6 +--- .../Queries/ExportProductsQueryTests.cs | 7 +---- .../Queries/GetAllProductsQueryTests.cs | 7 +---- .../Queries/ProductsPaginationQueryTests.cs | 7 +---- .../Services/PicklistServiceTests.cs | 6 +--- .../Services/TenantsServiceTests.cs | 6 +--- .../Application.IntegrationTests/TestBase.cs | 4 +-- tests/Application.IntegrationTests/Testing.cs | 10 +++---- .../Common/Behaviours/RequestLoggerTests.cs | 4 +-- .../Exceptions/ValidationExceptionTests.cs | 3 +- .../Common/Mappings/MappingTests.cs | 9 +++--- .../Constants/ConstantStringTests.cs | 7 +---- 172 files changed, 145 insertions(+), 569 deletions(-) diff --git a/src/Application/Common/Behaviours/AuthorizationBehaviour.cs b/src/Application/Common/Behaviours/AuthorizationBehaviour.cs index 640e43758..efef45ea7 100644 --- a/src/Application/Common/Behaviours/AuthorizationBehaviour.cs +++ b/src/Application/Common/Behaviours/AuthorizationBehaviour.cs @@ -3,7 +3,6 @@ using CleanArchitecture.Blazor.Application.Common.Interfaces.Identity; using CleanArchitecture.Blazor.Application.Common.Security; -using System.Reflection; namespace CleanArchitecture.Blazor.Application.Common.Behaviours; diff --git a/src/Application/Common/Behaviours/MemoryCacheBehaviour.cs b/src/Application/Common/Behaviours/MemoryCacheBehaviour.cs index 8bcc8d290..a76968df3 100644 --- a/src/Application/Common/Behaviours/MemoryCacheBehaviour.cs +++ b/src/Application/Common/Behaviours/MemoryCacheBehaviour.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using LazyCache; - namespace CleanArchitecture.Blazor.Application.Common.Behaviours; public class MemoryCacheBehaviour : IPipelineBehavior diff --git a/src/Application/Common/Behaviours/UnhandledExceptionBehaviour.cs b/src/Application/Common/Behaviours/UnhandledExceptionBehaviour.cs index 3e478ff72..91edfa10d 100644 --- a/src/Application/Common/Behaviours/UnhandledExceptionBehaviour.cs +++ b/src/Application/Common/Behaviours/UnhandledExceptionBehaviour.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Threading; - namespace CleanArchitecture.Blazor.Application.Common.Behaviours; public class UnhandledExceptionBehaviour : IPipelineBehavior where TRequest : IRequest diff --git a/src/Application/Common/ExceptionHandlers/DbExceptionHandler.cs b/src/Application/Common/ExceptionHandlers/DbExceptionHandler.cs index fc67c66d2..ed47937fb 100644 --- a/src/Application/Common/ExceptionHandlers/DbExceptionHandler.cs +++ b/src/Application/Common/ExceptionHandlers/DbExceptionHandler.cs @@ -1,12 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net.NetworkInformation; -using System.Text; -using System.Threading.Tasks; -using CleanArchitecture.Blazor.Application.Features.Products.Commands.AddEdit; -using Microsoft.Data.SqlClient; -using Microsoft.EntityFrameworkCore; +using Microsoft.Data.SqlClient; namespace CleanArchitecture.Blazor.Application.Common.ExceptionHandlers; public class DbExceptionHandler : IRequestExceptionHandler diff --git a/src/Application/Common/ExceptionHandlers/ValidationExceptionHandler.cs b/src/Application/Common/ExceptionHandlers/ValidationExceptionHandler.cs index 4d34db154..219b62142 100644 --- a/src/Application/Common/ExceptionHandlers/ValidationExceptionHandler.cs +++ b/src/Application/Common/ExceptionHandlers/ValidationExceptionHandler.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; - -namespace CleanArchitecture.Blazor.Application.Common.ExceptionHandlers; +namespace CleanArchitecture.Blazor.Application.Common.ExceptionHandlers; public class ValidationExceptionHandler : IRequestExceptionHandler where TRequest : IRequest where TException : ValidationException diff --git a/src/Application/Common/Extensions/DataRowExtensions.cs b/src/Application/Common/Extensions/DataRowExtensions.cs index 83a9a8944..b7aac1624 100644 --- a/src/Application/Common/Extensions/DataRowExtensions.cs +++ b/src/Application/Common/Extensions/DataRowExtensions.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Text; - namespace CleanArchitecture.Blazor.Application.Common.Extensions; public static class DataRowExtensions diff --git a/src/Application/Common/Extensions/DescriptionAttributeExtensions.cs b/src/Application/Common/Extensions/DescriptionAttributeExtensions.cs index 71d643a0e..a630b5e73 100644 --- a/src/Application/Common/Extensions/DescriptionAttributeExtensions.cs +++ b/src/Application/Common/Extensions/DescriptionAttributeExtensions.cs @@ -1,7 +1,4 @@ -using System.ComponentModel; -using System.Reflection; - -namespace CleanArchitecture.Blazor.Application.Common.Extensions; +namespace CleanArchitecture.Blazor.Application.Common.Extensions; public static class DescriptionAttributeExtensions { public static string GetDescription(this Enum e) diff --git a/src/Application/Common/Extensions/ExpressionExtensions.cs b/src/Application/Common/Extensions/ExpressionExtensions.cs index bf7d7fa4d..babea0629 100644 --- a/src/Application/Common/Extensions/ExpressionExtensions.cs +++ b/src/Application/Common/Extensions/ExpressionExtensions.cs @@ -1,12 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Linq.Expressions; using System.Text.Json.Serialization; -using System.Text.Json; -using System.ComponentModel; -using System.Globalization; -using System.Reflection; namespace CleanArchitecture.Blazor.Application.Common.Extensions; #nullable disable diff --git a/src/Application/Common/Helper/ConstantStringLocalizer.cs b/src/Application/Common/Helper/ConstantStringLocalizer.cs index 2e06f95d5..7d828924f 100644 --- a/src/Application/Common/Helper/ConstantStringLocalizer.cs +++ b/src/Application/Common/Helper/ConstantStringLocalizer.cs @@ -1,4 +1,3 @@ -using System.Globalization; using System.Resources; namespace CleanArchitecture.Blazor.Application.Common.Helper; diff --git a/src/Application/Common/Interfaces/IApplicationDbContext.cs b/src/Application/Common/Interfaces/IApplicationDbContext.cs index 618a53de6..9cb28c2ef 100644 --- a/src/Application/Common/Interfaces/IApplicationDbContext.cs +++ b/src/Application/Common/Interfaces/IApplicationDbContext.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.EntityFrameworkCore.ChangeTracking; namespace CleanArchitecture.Blazor.Application.Common.Interfaces; diff --git a/src/Application/Common/Interfaces/IMailService.cs b/src/Application/Common/Interfaces/IMailService.cs index 228aa981d..ebc270985 100644 --- a/src/Application/Common/Interfaces/IMailService.cs +++ b/src/Application/Common/Interfaces/IMailService.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using CleanArchitecture.Blazor.Application.Settings; using FluentEmail.Core.Models; namespace CleanArchitecture.Blazor.Application.Common.Interfaces; diff --git a/src/Application/Common/Interfaces/ISpecification.cs b/src/Application/Common/Interfaces/ISpecification.cs index cb1de4d29..3d2c63dfb 100644 --- a/src/Application/Common/Interfaces/ISpecification.cs +++ b/src/Application/Common/Interfaces/ISpecification.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Linq.Expressions; using CleanArchitecture.Blazor.Domain.Common; using Microsoft.EntityFrameworkCore.Query; diff --git a/src/Application/Common/Interfaces/Identity/IUserDataProvider.cs b/src/Application/Common/Interfaces/Identity/IUserDataProvider.cs index 8385c8a37..0f880f7e9 100644 --- a/src/Application/Common/Interfaces/Identity/IUserDataProvider.cs +++ b/src/Application/Common/Interfaces/Identity/IUserDataProvider.cs @@ -1,6 +1,5 @@ -using CleanArchitecture.Blazor.Application.Common.Interfaces.Identity.DTOs; using CleanArchitecture.Blazor.Application.Features.Identity.Dto; namespace CleanArchitecture.Blazor.Application.Common.Interfaces.Identity; diff --git a/src/Application/Common/Interfaces/Serialization/DefaultJsonSerializerOptions.cs b/src/Application/Common/Interfaces/Serialization/DefaultJsonSerializerOptions.cs index 7ef86e35c..1e5dddd64 100644 --- a/src/Application/Common/Interfaces/Serialization/DefaultJsonSerializerOptions.cs +++ b/src/Application/Common/Interfaces/Serialization/DefaultJsonSerializerOptions.cs @@ -1,6 +1,5 @@ using System.Text.Encodings.Web; using System.Text.Json.Serialization; -using System.Text.Json; using System.Text.Unicode; namespace CleanArchitecture.Blazor.Application.Common.Interfaces.Serialization; diff --git a/src/Application/Common/Mappings/MappingProfile.cs b/src/Application/Common/Mappings/MappingProfile.cs index b5fa52313..27eba7436 100644 --- a/src/Application/Common/Mappings/MappingProfile.cs +++ b/src/Application/Common/Mappings/MappingProfile.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Reflection; - namespace CleanArchitecture.Blazor.Application.Common.Mappings; public class MappingProfile : Profile diff --git a/src/Application/Common/PublishStrategies/ParallelNoWaitPublisher.cs b/src/Application/Common/PublishStrategies/ParallelNoWaitPublisher.cs index 2f53d030a..27d73ecf0 100644 --- a/src/Application/Common/PublishStrategies/ParallelNoWaitPublisher.cs +++ b/src/Application/Common/PublishStrategies/ParallelNoWaitPublisher.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CleanArchitecture.Blazor.Application.Common.PublishStrategies; +namespace CleanArchitecture.Blazor.Application.Common.PublishStrategies; public class ParallelNoWaitPublisher : INotificationPublisher { public Task Publish(IEnumerable handlerExecutors, INotification notification, CancellationToken cancellationToken) diff --git a/src/Application/Common/Security/RegisterFormModelFluentValidator.cs b/src/Application/Common/Security/RegisterFormModelFluentValidator.cs index def9527eb..871a2348f 100644 --- a/src/Application/Common/Security/RegisterFormModelFluentValidator.cs +++ b/src/Application/Common/Security/RegisterFormModelFluentValidator.cs @@ -1,5 +1,3 @@ -using CleanArchitecture.Blazor.Application.Features.Products.Queries.Export; - namespace CleanArchitecture.Blazor.Application.Common.Security; public class RegisterFormModelFluentValidator : AbstractValidator diff --git a/src/Application/Common/Specification/Specification.cs b/src/Application/Common/Specification/Specification.cs index a34338409..cc7d15b5f 100644 --- a/src/Application/Common/Specification/Specification.cs +++ b/src/Application/Common/Specification/Specification.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Linq.Expressions; using CleanArchitecture.Blazor.Domain.Common; using Microsoft.EntityFrameworkCore.Query; diff --git a/src/Application/Constants/ConstantString.cs b/src/Application/Constants/ConstantString.cs index 8dabbeae6..a2d91a99b 100644 --- a/src/Application/Constants/ConstantString.cs +++ b/src/Application/Constants/ConstantString.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CleanArchitecture.Blazor.Application.Constants; +namespace CleanArchitecture.Blazor.Application.Constants; public static class ConstantString { //==========================================================// diff --git a/src/Application/Constants/Permission/Permissions.cs b/src/Application/Constants/Permission/Permissions.cs index b50515daf..c7ee7abbf 100644 --- a/src/Application/Constants/Permission/Permissions.cs +++ b/src/Application/Constants/Permission/Permissions.cs @@ -1,9 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.ComponentModel; -using System.Reflection; - namespace CleanArchitecture.Blazor.Application.Constants; public static class Permissions diff --git a/src/Application/DependencyInjection.cs b/src/Application/DependencyInjection.cs index 14446b9ec..d6445e605 100644 --- a/src/Application/DependencyInjection.cs +++ b/src/Application/DependencyInjection.cs @@ -7,10 +7,7 @@ using CleanArchitecture.Blazor.Application.Common.Security; using CleanArchitecture.Blazor.Application.Services.MultiTenant; using CleanArchitecture.Blazor.Application.Services.Picklist; -using MediatR; -using MediatR.Pipeline; using Microsoft.Extensions.DependencyInjection; -using System.Reflection; namespace CleanArchitecture.Blazor.Application; diff --git a/src/Application/Features/AuditTrails/DTOs/AuditTrailDto.cs b/src/Application/Features/AuditTrails/DTOs/AuditTrailDto.cs index 954c71ff5..ce974630d 100644 --- a/src/Application/Features/AuditTrails/DTOs/AuditTrailDto.cs +++ b/src/Application/Features/AuditTrails/DTOs/AuditTrailDto.cs @@ -4,7 +4,6 @@ using CleanArchitecture.Blazor.Application.Common.Interfaces.Serialization; using CleanArchitecture.Blazor.Application.Features.Identity.Dto; - namespace CleanArchitecture.Blazor.Application.Features.AuditTrails.DTOs; [Description("Audit Trails")] public class AuditTrailDto : IMapFrom diff --git a/src/Application/Features/AuditTrails/Queries/PaginationQuery/AuditTrailsWithPaginationQuery.cs b/src/Application/Features/AuditTrails/Queries/PaginationQuery/AuditTrailsWithPaginationQuery.cs index 512257f2c..1a52655d3 100644 --- a/src/Application/Features/AuditTrails/Queries/PaginationQuery/AuditTrailsWithPaginationQuery.cs +++ b/src/Application/Features/AuditTrails/Queries/PaginationQuery/AuditTrailsWithPaginationQuery.cs @@ -1,12 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Globalization; -using System.Linq.Expressions; -using System.Reflection; using CleanArchitecture.Blazor.Application.Features.AuditTrails.Caching; using CleanArchitecture.Blazor.Application.Features.AuditTrails.DTOs; -using CleanArchitecture.Blazor.Application.Features.Products.Queries; namespace CleanArchitecture.Blazor.Application.Features.AuditTrails.Queries.PaginationQuery; diff --git a/src/Application/Features/Customers/Commands/AddEdit/AddEditCustomerCommand.cs b/src/Application/Features/Customers/Commands/AddEdit/AddEditCustomerCommand.cs index 38d1d2ecf..a17a2a677 100644 --- a/src/Application/Features/Customers/Commands/AddEdit/AddEditCustomerCommand.cs +++ b/src/Application/Features/Customers/Commands/AddEdit/AddEditCustomerCommand.cs @@ -1,8 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using CleanArchitecture.Blazor.Application.Features.Customers.DTOs; using CleanArchitecture.Blazor.Application.Features.Customers.Caching; +using CleanArchitecture.Blazor.Application.Features.Customers.DTOs; + namespace CleanArchitecture.Blazor.Application.Features.Customers.Commands.AddEdit; public class AddEditCustomerCommand: IMapFrom,ICacheInvalidatorRequest> diff --git a/src/Application/Features/Customers/Commands/Create/CreateCustomerCommand.cs b/src/Application/Features/Customers/Commands/Create/CreateCustomerCommand.cs index f307ff44a..62e99c20a 100644 --- a/src/Application/Features/Customers/Commands/Create/CreateCustomerCommand.cs +++ b/src/Application/Features/Customers/Commands/Create/CreateCustomerCommand.cs @@ -1,8 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.ComponentModel; -using CleanArchitecture.Blazor.Application.Features.Customers.DTOs; + using CleanArchitecture.Blazor.Application.Features.Customers.Caching; +using CleanArchitecture.Blazor.Application.Features.Customers.DTOs; namespace CleanArchitecture.Blazor.Application.Features.Customers.Commands.Create; diff --git a/src/Application/Features/Customers/Commands/Delete/DeleteCustomerCommand.cs b/src/Application/Features/Customers/Commands/Delete/DeleteCustomerCommand.cs index 8ce8d94d5..c9dbfdc74 100644 --- a/src/Application/Features/Customers/Commands/Delete/DeleteCustomerCommand.cs +++ b/src/Application/Features/Customers/Commands/Delete/DeleteCustomerCommand.cs @@ -1,10 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using CleanArchitecture.Blazor.Application.Features.Customers.DTOs; using CleanArchitecture.Blazor.Application.Features.Customers.Caching; - namespace CleanArchitecture.Blazor.Application.Features.Customers.Commands.Delete; public class DeleteCustomerCommand: FilterBase, ICacheInvalidatorRequest> diff --git a/src/Application/Features/Customers/Commands/Import/ImportCustomersCommand.cs b/src/Application/Features/Customers/Commands/Import/ImportCustomersCommand.cs index 947cf963d..fae4146a7 100644 --- a/src/Application/Features/Customers/Commands/Import/ImportCustomersCommand.cs +++ b/src/Application/Features/Customers/Commands/Import/ImportCustomersCommand.cs @@ -1,8 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using CleanArchitecture.Blazor.Application.Features.Customers.DTOs; using CleanArchitecture.Blazor.Application.Features.Customers.Caching; +using CleanArchitecture.Blazor.Application.Features.Customers.DTOs; namespace CleanArchitecture.Blazor.Application.Features.Customers.Commands.Import; diff --git a/src/Application/Features/Customers/Commands/Update/UpdateCustomerCommand.cs b/src/Application/Features/Customers/Commands/Update/UpdateCustomerCommand.cs index 8051c012f..a757a9fad 100644 --- a/src/Application/Features/Customers/Commands/Update/UpdateCustomerCommand.cs +++ b/src/Application/Features/Customers/Commands/Update/UpdateCustomerCommand.cs @@ -1,8 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.ComponentModel; -using CleanArchitecture.Blazor.Application.Features.Customers.DTOs; + using CleanArchitecture.Blazor.Application.Features.Customers.Caching; +using CleanArchitecture.Blazor.Application.Features.Customers.DTOs; namespace CleanArchitecture.Blazor.Application.Features.Customers.Commands.Update; diff --git a/src/Application/Features/Customers/DTOs/CustomerDto.cs b/src/Application/Features/Customers/DTOs/CustomerDto.cs index dd3b2b2e6..e5b346647 100644 --- a/src/Application/Features/Customers/DTOs/CustomerDto.cs +++ b/src/Application/Features/Customers/DTOs/CustomerDto.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.ComponentModel; namespace CleanArchitecture.Blazor.Application.Features.Customers.DTOs; [Description("Customers")] diff --git a/src/Application/Features/Customers/Queries/GetAll/GetAllCustomersQuery.cs b/src/Application/Features/Customers/Queries/GetAll/GetAllCustomersQuery.cs index 2f251257a..68a66a287 100644 --- a/src/Application/Features/Customers/Queries/GetAll/GetAllCustomersQuery.cs +++ b/src/Application/Features/Customers/Queries/GetAll/GetAllCustomersQuery.cs @@ -1,8 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using CleanArchitecture.Blazor.Application.Features.Customers.DTOs; using CleanArchitecture.Blazor.Application.Features.Customers.Caching; +using CleanArchitecture.Blazor.Application.Features.Customers.DTOs; namespace CleanArchitecture.Blazor.Application.Features.Customers.Queries.GetAll; diff --git a/src/Application/Features/Customers/Queries/GetById/GetCustomerByIdQuery.cs b/src/Application/Features/Customers/Queries/GetById/GetCustomerByIdQuery.cs index 834e8b3c8..7610a03f0 100644 --- a/src/Application/Features/Customers/Queries/GetById/GetCustomerByIdQuery.cs +++ b/src/Application/Features/Customers/Queries/GetById/GetCustomerByIdQuery.cs @@ -1,8 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using CleanArchitecture.Blazor.Application.Features.Customers.DTOs; using CleanArchitecture.Blazor.Application.Features.Customers.Caching; +using CleanArchitecture.Blazor.Application.Features.Customers.DTOs; namespace CleanArchitecture.Blazor.Application.Features.Customers.Queries.GetById; diff --git a/src/Application/Features/Customers/Queries/Pagination/CustomersPaginationQuery.cs b/src/Application/Features/Customers/Queries/Pagination/CustomersPaginationQuery.cs index c2e432dc2..241da77eb 100644 --- a/src/Application/Features/Customers/Queries/Pagination/CustomersPaginationQuery.cs +++ b/src/Application/Features/Customers/Queries/Pagination/CustomersPaginationQuery.cs @@ -1,8 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using CleanArchitecture.Blazor.Application.Features.Customers.DTOs; using CleanArchitecture.Blazor.Application.Features.Customers.Caching; +using CleanArchitecture.Blazor.Application.Features.Customers.DTOs; namespace CleanArchitecture.Blazor.Application.Features.Customers.Queries.Pagination; diff --git a/src/Application/Features/Documents/Commands/AddEdit/AddEditDocumentCommand.cs b/src/Application/Features/Documents/Commands/AddEdit/AddEditDocumentCommand.cs index 59d147b5b..73617cd7d 100644 --- a/src/Application/Features/Documents/Commands/AddEdit/AddEditDocumentCommand.cs +++ b/src/Application/Features/Documents/Commands/AddEdit/AddEditDocumentCommand.cs @@ -1,9 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using CleanArchitecture.Blazor.Application.Features.Documents.DTOs; using CleanArchitecture.Blazor.Application.Features.Documents.Caching; -using CleanArchitecture.Blazor.Application.Features.Identity.Dto; +using CleanArchitecture.Blazor.Application.Features.Documents.DTOs; namespace CleanArchitecture.Blazor.Application.Features.Documents.Commands.AddEdit; diff --git a/src/Application/Features/Documents/Commands/Upload/UploadDocumentCommand.cs b/src/Application/Features/Documents/Commands/Upload/UploadDocumentCommand.cs index 997802563..d65a33f89 100644 --- a/src/Application/Features/Documents/Commands/Upload/UploadDocumentCommand.cs +++ b/src/Application/Features/Documents/Commands/Upload/UploadDocumentCommand.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using CleanArchitecture.Blazor.Application.Features.Documents.DTOs; using CleanArchitecture.Blazor.Application.Features.Documents.Caching; namespace CleanArchitecture.Blazor.Application.Features.Documents.Commands.Upload; diff --git a/src/Application/Features/Documents/EventHandlers/DocumentCreatedEventHandler.cs b/src/Application/Features/Documents/EventHandlers/DocumentCreatedEventHandler.cs index a72466381..35d4c0626 100644 --- a/src/Application/Features/Documents/EventHandlers/DocumentCreatedEventHandler.cs +++ b/src/Application/Features/Documents/EventHandlers/DocumentCreatedEventHandler.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. - using CleanArchitecture.Blazor.Application.Services.PaddleOCR; using Hangfire; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Application/Features/Documents/EventHandlers/DocumentDeletedEventHandler.cs b/src/Application/Features/Documents/EventHandlers/DocumentDeletedEventHandler.cs index 9b7afb282..1ebd6ace2 100644 --- a/src/Application/Features/Documents/EventHandlers/DocumentDeletedEventHandler.cs +++ b/src/Application/Features/Documents/EventHandlers/DocumentDeletedEventHandler.cs @@ -2,11 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. - -using CleanArchitecture.Blazor.Application.Services.PaddleOCR; -using Hangfire; -using MediatR; - namespace CleanArchitecture.Blazor.Application.Features.Documents.EventHandlers; public class DocumentDeletedEventHandler : INotificationHandler> diff --git a/src/Application/Features/Documents/Queries/GetFileStream/GetFileStreamQuery.cs b/src/Application/Features/Documents/Queries/GetFileStream/GetFileStreamQuery.cs index d90800c05..e6da9b840 100644 --- a/src/Application/Features/Documents/Queries/GetFileStream/GetFileStreamQuery.cs +++ b/src/Application/Features/Documents/Queries/GetFileStream/GetFileStreamQuery.cs @@ -1,9 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using CleanArchitecture.Blazor.Application.Features.Documents.DTOs; using CleanArchitecture.Blazor.Application.Features.Documents.Caching; -using CleanArchitecture.Blazor.Application.Common.Interfaces.MultiTenant; namespace CleanArchitecture.Blazor.Application.Features.Documents.Queries.PaginationQuery; diff --git a/src/Application/Features/Documents/Queries/PaginationQuery/DocumentsWithPaginationQuery.cs b/src/Application/Features/Documents/Queries/PaginationQuery/DocumentsWithPaginationQuery.cs index 11c1b73e7..6b63de53b 100644 --- a/src/Application/Features/Documents/Queries/PaginationQuery/DocumentsWithPaginationQuery.cs +++ b/src/Application/Features/Documents/Queries/PaginationQuery/DocumentsWithPaginationQuery.cs @@ -1,10 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using CleanArchitecture.Blazor.Application.Features.Documents.DTOs; using CleanArchitecture.Blazor.Application.Features.Documents.Caching; -using DocumentFormat.OpenXml.Wordprocessing; -using Document = CleanArchitecture.Blazor.Domain.Entities.Document; +using CleanArchitecture.Blazor.Application.Features.Documents.DTOs; namespace CleanArchitecture.Blazor.Application.Features.Documents.Queries.PaginationQuery; diff --git a/src/Application/Features/Identity/Notification/UpdateUserProfileCommand.cs b/src/Application/Features/Identity/Notification/UpdateUserProfileCommand.cs index 6cb7fa00a..dcba0bc5a 100644 --- a/src/Application/Features/Identity/Notification/UpdateUserProfileCommand.cs +++ b/src/Application/Features/Identity/Notification/UpdateUserProfileCommand.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CleanArchitecture.Blazor.Application.Features.Identity.Notification; +namespace CleanArchitecture.Blazor.Application.Features.Identity.Notification; public class UpdateUserProfileCommand:INotification { public UserProfile UserProfile { get; set; } = null!; diff --git a/src/Application/Features/KeyValues/Commands/AddEdit/AddEditKeyValueCommandValidator.cs b/src/Application/Features/KeyValues/Commands/AddEdit/AddEditKeyValueCommandValidator.cs index d9f1bc201..37b73c076 100644 --- a/src/Application/Features/KeyValues/Commands/AddEdit/AddEditKeyValueCommandValidator.cs +++ b/src/Application/Features/KeyValues/Commands/AddEdit/AddEditKeyValueCommandValidator.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using CleanArchitecture.Blazor.Application.Features.Tenants.Commands.AddEdit; - namespace CleanArchitecture.Blazor.Application.Features.KeyValues.Commands.AddEdit; public class AddEditKeyValueCommandValidator : AbstractValidator diff --git a/src/Application/Features/KeyValues/Commands/Import/ImportKeyValuesCommand.cs b/src/Application/Features/KeyValues/Commands/Import/ImportKeyValuesCommand.cs index 6d19dc1ee..f6a961dca 100644 --- a/src/Application/Features/KeyValues/Commands/Import/ImportKeyValuesCommand.cs +++ b/src/Application/Features/KeyValues/Commands/Import/ImportKeyValuesCommand.cs @@ -3,7 +3,6 @@ using CleanArchitecture.Blazor.Application.Features.KeyValues.Caching; using CleanArchitecture.Blazor.Application.Features.KeyValues.Commands.AddEdit; -using CleanArchitecture.Blazor.Application.Features.KeyValues.DTOs; namespace CleanArchitecture.Blazor.Application.Features.KeyValues.Commands.Import; diff --git a/src/Application/Features/KeyValues/Queries/PaginationQuery/KeyValuesWithPaginationQuery.cs b/src/Application/Features/KeyValues/Queries/PaginationQuery/KeyValuesWithPaginationQuery.cs index 9a8e1eae7..0766c9b67 100644 --- a/src/Application/Features/KeyValues/Queries/PaginationQuery/KeyValuesWithPaginationQuery.cs +++ b/src/Application/Features/KeyValues/Queries/PaginationQuery/KeyValuesWithPaginationQuery.cs @@ -1,9 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using CleanArchitecture.Blazor.Application.Features.KeyValues.DTOs; using CleanArchitecture.Blazor.Application.Features.KeyValues.Caching; -using CleanArchitecture.Blazor.Application.Features.AuditTrails.DTOs; +using CleanArchitecture.Blazor.Application.Features.KeyValues.DTOs; namespace CleanArchitecture.Blazor.Application.Features.KeyValues.Queries.PaginationQuery; diff --git a/src/Application/Features/Loggers/Commands/Clear/ClearLogsCommand.cs b/src/Application/Features/Loggers/Commands/Clear/ClearLogsCommand.cs index 05af7d2f4..196ba78ee 100644 --- a/src/Application/Features/Loggers/Commands/Clear/ClearLogsCommand.cs +++ b/src/Application/Features/Loggers/Commands/Clear/ClearLogsCommand.cs @@ -2,10 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. - -using CleanArchitecture.Blazor.Application.Common.Interfaces; using CleanArchitecture.Blazor.Application.Features.Loggers.Caching; -using static CleanArchitecture.Blazor.Application.Constants.Permissions; namespace CleanArchitecture.Blazor.Application.Features.Loggers.Commands.Delete; diff --git a/src/Application/Features/Loggers/Queries/PaginationQuery/LogsWithPaginationQuery.cs b/src/Application/Features/Loggers/Queries/PaginationQuery/LogsWithPaginationQuery.cs index 10fd782a4..aa193a213 100644 --- a/src/Application/Features/Loggers/Queries/PaginationQuery/LogsWithPaginationQuery.cs +++ b/src/Application/Features/Loggers/Queries/PaginationQuery/LogsWithPaginationQuery.cs @@ -1,9 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Globalization; -using System.Linq.Expressions; -using System.Reflection; using CleanArchitecture.Blazor.Application.Features.Loggers.Caching; using CleanArchitecture.Blazor.Application.Features.Loggers.DTOs; diff --git a/src/Application/Features/Products/Commands/AddEdit/AddEditProductCommand.cs b/src/Application/Features/Products/Commands/AddEdit/AddEditProductCommand.cs index b186a74e4..408fac4a9 100644 --- a/src/Application/Features/Products/Commands/AddEdit/AddEditProductCommand.cs +++ b/src/Application/Features/Products/Commands/AddEdit/AddEditProductCommand.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. -using CleanArchitecture.Blazor.Application.Features.Documents.DTOs; using CleanArchitecture.Blazor.Application.Features.Products.Caching; using CleanArchitecture.Blazor.Application.Features.Products.DTOs; using Microsoft.AspNetCore.Components.Forms; diff --git a/src/Application/Features/Products/Commands/Delete/DeleteProductCommand.cs b/src/Application/Features/Products/Commands/Delete/DeleteProductCommand.cs index 353d4f7b0..fb624bbbb 100644 --- a/src/Application/Features/Products/Commands/Delete/DeleteProductCommand.cs +++ b/src/Application/Features/Products/Commands/Delete/DeleteProductCommand.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. - using CleanArchitecture.Blazor.Application.Features.Products.Caching; namespace CleanArchitecture.Blazor.Application.Features.Products.Commands.Delete; diff --git a/src/Application/Features/Products/DTOs/ProductDto.cs b/src/Application/Features/Products/DTOs/ProductDto.cs index 45987b69e..0bdc0c06e 100644 --- a/src/Application/Features/Products/DTOs/ProductDto.cs +++ b/src/Application/Features/Products/DTOs/ProductDto.cs @@ -1,9 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using CleanArchitecture.Blazor.Application.Features.Documents.DTOs; -using Microsoft.AspNetCore.Components.Forms; - namespace CleanArchitecture.Blazor.Application.Features.Products.DTOs; [Description("Products")] diff --git a/src/Application/Features/Products/Queries/Pagination/ProductsPaginationQuery.cs b/src/Application/Features/Products/Queries/Pagination/ProductsPaginationQuery.cs index d48068682..73179fbda 100644 --- a/src/Application/Features/Products/Queries/Pagination/ProductsPaginationQuery.cs +++ b/src/Application/Features/Products/Queries/Pagination/ProductsPaginationQuery.cs @@ -4,9 +4,6 @@ using CleanArchitecture.Blazor.Application.Features.Products.Caching; using CleanArchitecture.Blazor.Application.Features.Products.DTOs; -using CleanArchitecture.Blazor.Application.Features.Products.Queries; -using DocumentFormat.OpenXml.Wordprocessing; -using Microsoft.AspNetCore.Mvc; namespace CleanArchitecture.Blazor.Application.Features.Products.Queries.Pagination; diff --git a/src/Application/Features/Products/Queries/Specification/SearchProductSpecification.cs b/src/Application/Features/Products/Queries/Specification/SearchProductSpecification.cs index d32114f62..406302e56 100644 --- a/src/Application/Features/Products/Queries/Specification/SearchProductSpecification.cs +++ b/src/Application/Features/Products/Queries/Specification/SearchProductSpecification.cs @@ -1,6 +1,3 @@ -using System.Globalization; -using System.Linq.Expressions; -using System.Reflection; using CleanArchitecture.Blazor.Application.Features.Products.Queries.Pagination; namespace CleanArchitecture.Blazor.Application.Features.Products.Queries; diff --git a/src/Application/Features/Tenants/Commands/AddEdit/AddEditTenantCommand.cs b/src/Application/Features/Tenants/Commands/AddEdit/AddEditTenantCommand.cs index 4fd733aea..0fd009215 100644 --- a/src/Application/Features/Tenants/Commands/AddEdit/AddEditTenantCommand.cs +++ b/src/Application/Features/Tenants/Commands/AddEdit/AddEditTenantCommand.cs @@ -2,8 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. -using CleanArchitecture.Blazor.Application.Features.Tenants.DTOs; using CleanArchitecture.Blazor.Application.Features.Tenants.Caching; +using CleanArchitecture.Blazor.Application.Features.Tenants.DTOs; + namespace CleanArchitecture.Blazor.Application.Features.Tenants.Commands.AddEdit; public class AddEditTenantCommand : IMapFrom, ICacheInvalidatorRequest> diff --git a/src/Application/Features/Tenants/Commands/Delete/DeleteTenantCommand.cs b/src/Application/Features/Tenants/Commands/Delete/DeleteTenantCommand.cs index ddd9521cd..348d72886 100644 --- a/src/Application/Features/Tenants/Commands/Delete/DeleteTenantCommand.cs +++ b/src/Application/Features/Tenants/Commands/Delete/DeleteTenantCommand.cs @@ -1,10 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using CleanArchitecture.Blazor.Application.Features.Tenants.DTOs; using CleanArchitecture.Blazor.Application.Features.Tenants.Caching; - namespace CleanArchitecture.Blazor.Application.Features.Tenants.Commands.Delete; public class DeleteTenantCommand : ICacheInvalidatorRequest> diff --git a/src/Application/Features/Tenants/Queries/GetAll/GetAllTenantsQuery.cs b/src/Application/Features/Tenants/Queries/GetAll/GetAllTenantsQuery.cs index 6e7601b8e..2351b6ac6 100644 --- a/src/Application/Features/Tenants/Queries/GetAll/GetAllTenantsQuery.cs +++ b/src/Application/Features/Tenants/Queries/GetAll/GetAllTenantsQuery.cs @@ -1,8 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using CleanArchitecture.Blazor.Application.Features.Tenants.DTOs; using CleanArchitecture.Blazor.Application.Features.Tenants.Caching; +using CleanArchitecture.Blazor.Application.Features.Tenants.DTOs; namespace CleanArchitecture.Blazor.Application.Features.Tenants.Queries.GetAll; diff --git a/src/Application/Features/Tenants/Queries/Pagination/TenantsPaginationQuery.cs b/src/Application/Features/Tenants/Queries/Pagination/TenantsPaginationQuery.cs index 18b1674e0..9520de410 100644 --- a/src/Application/Features/Tenants/Queries/Pagination/TenantsPaginationQuery.cs +++ b/src/Application/Features/Tenants/Queries/Pagination/TenantsPaginationQuery.cs @@ -1,9 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using CleanArchitecture.Blazor.Application.Features.Tenants.DTOs; using CleanArchitecture.Blazor.Application.Features.Tenants.Caching; - +using CleanArchitecture.Blazor.Application.Features.Tenants.DTOs; namespace CleanArchitecture.Blazor.Application.Features.Tenants.Queries.Pagination; diff --git a/src/Application/Services/MultiTenant/TenantService.cs b/src/Application/Services/MultiTenant/TenantService.cs index 36bf1e6a2..4dca4f97b 100644 --- a/src/Application/Services/MultiTenant/TenantService.cs +++ b/src/Application/Services/MultiTenant/TenantService.cs @@ -1,7 +1,6 @@ using CleanArchitecture.Blazor.Application.Common.Interfaces.MultiTenant; using CleanArchitecture.Blazor.Application.Features.Tenants.Caching; using CleanArchitecture.Blazor.Application.Features.Tenants.DTOs; -using LazyCache; namespace CleanArchitecture.Blazor.Application.Services.MultiTenant; diff --git a/src/Application/Services/PaddleOCR/IDocumentOcrJob.cs b/src/Application/Services/PaddleOCR/IDocumentOcrJob.cs index 274a15012..7165e80a9 100644 --- a/src/Application/Services/PaddleOCR/IDocumentOcrJob.cs +++ b/src/Application/Services/PaddleOCR/IDocumentOcrJob.cs @@ -1,13 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - namespace CleanArchitecture.Blazor.Application.Services.PaddleOCR; public interface IDocumentOcrJob diff --git a/src/Application/Services/Picklist/PicklistService.cs b/src/Application/Services/Picklist/PicklistService.cs index 929087253..75955ec5d 100644 --- a/src/Application/Services/Picklist/PicklistService.cs +++ b/src/Application/Services/Picklist/PicklistService.cs @@ -1,8 +1,5 @@ -using AutoMapper; -using AutoMapper.QueryableExtensions; using CleanArchitecture.Blazor.Application.Features.KeyValues.Caching; using CleanArchitecture.Blazor.Application.Features.KeyValues.DTOs; -using LazyCache; namespace CleanArchitecture.Blazor.Application.Services.Picklist; diff --git a/src/Blazor.Server.UI/Components/Common/CustomError.razor b/src/Blazor.Server.UI/Components/Common/CustomError.razor index 4ed991d34..d900c52b2 100644 --- a/src/Blazor.Server.UI/Components/Common/CustomError.razor +++ b/src/Blazor.Server.UI/Components/Common/CustomError.razor @@ -1,4 +1,3 @@ -@using CleanArchitecture.Blazor.Application.Common.Exceptions @using System.Net @statusCode diff --git a/src/Blazor.Server.UI/Components/Common/CustomValidation.cs b/src/Blazor.Server.UI/Components/Common/CustomValidation.cs index 0bd3a9cb3..c7f2d6440 100644 --- a/src/Blazor.Server.UI/Components/Common/CustomValidation.cs +++ b/src/Blazor.Server.UI/Components/Common/CustomValidation.cs @@ -1,4 +1,3 @@ -using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Forms; namespace Blazor.Server.UI.Components.Common; diff --git a/src/Blazor.Server.UI/Components/Common/DataGridExtensions.cs b/src/Blazor.Server.UI/Components/Common/DataGridExtensions.cs index 0b851d6db..d3f96c6e8 100644 --- a/src/Blazor.Server.UI/Components/Common/DataGridExtensions.cs +++ b/src/Blazor.Server.UI/Components/Common/DataGridExtensions.cs @@ -1,4 +1,5 @@ using System.Linq.Expressions; + namespace Blazor.Server.UI; public static class DataGridExtensions { diff --git a/src/Blazor.Server.UI/Components/Common/ErrorHandler.razor.cs b/src/Blazor.Server.UI/Components/Common/ErrorHandler.razor.cs index 09f7acdf7..09a24176b 100644 --- a/src/Blazor.Server.UI/Components/Common/ErrorHandler.razor.cs +++ b/src/Blazor.Server.UI/Components/Common/ErrorHandler.razor.cs @@ -1,5 +1,3 @@ -using MudBlazor; - namespace Blazor.Server.UI.Components.Common; public partial class ErrorHandler diff --git a/src/Blazor.Server.UI/Components/Common/MudEnumSelect.razor b/src/Blazor.Server.UI/Components/Common/MudEnumSelect.razor index d2aff131f..abba2a17b 100644 --- a/src/Blazor.Server.UI/Components/Common/MudEnumSelect.razor +++ b/src/Blazor.Server.UI/Components/Common/MudEnumSelect.razor @@ -1,9 +1,7 @@ -@using MudBlazor -@using System.ComponentModel -@using System.Reflection; -@using MudBlazor.Extensions; -@typeparam TEnum +@typeparam TEnum +@using System.Reflection +@using System.ComponentModel @inherits MudSelect @{ base.BuildRenderTree(__builder); diff --git a/src/Blazor.Server.UI/Components/Common/PickSuperiorIdAutocomplete.cs b/src/Blazor.Server.UI/Components/Common/PickSuperiorIdAutocomplete.cs index 7314a32c4..98c9986e1 100644 --- a/src/Blazor.Server.UI/Components/Common/PickSuperiorIdAutocomplete.cs +++ b/src/Blazor.Server.UI/Components/Common/PickSuperiorIdAutocomplete.cs @@ -1,7 +1,5 @@ using CleanArchitecture.Blazor.Application.Common.Interfaces.Identity; -using CleanArchitecture.Blazor.Application.Common.Interfaces.Identity.DTOs; using CleanArchitecture.Blazor.Application.Features.Identity.Dto; -using IdentityModel.Client; namespace Blazor.Server.UI.Components.Common; diff --git a/src/Blazor.Server.UI/Components/Common/PickUserAutocomplete.cs b/src/Blazor.Server.UI/Components/Common/PickUserAutocomplete.cs index 979319f02..66e9906eb 100644 --- a/src/Blazor.Server.UI/Components/Common/PickUserAutocomplete.cs +++ b/src/Blazor.Server.UI/Components/Common/PickUserAutocomplete.cs @@ -1,7 +1,5 @@ using CleanArchitecture.Blazor.Application.Common.Interfaces.Identity; -using CleanArchitecture.Blazor.Application.Common.Interfaces.Identity.DTOs; using CleanArchitecture.Blazor.Application.Features.Identity.Dto; -using IdentityModel.Client; namespace Blazor.Server.UI.Components.Common; diff --git a/src/Blazor.Server.UI/Components/Common/PicklistAutocomplete.cs b/src/Blazor.Server.UI/Components/Common/PicklistAutocomplete.cs index f85bb5484..4db56e1cd 100644 --- a/src/Blazor.Server.UI/Components/Common/PicklistAutocomplete.cs +++ b/src/Blazor.Server.UI/Components/Common/PicklistAutocomplete.cs @@ -1,7 +1,3 @@ -using CleanArchitecture.Blazor.Application.Common.Interfaces; -using Microsoft.AspNetCore.Components; -using MudBlazor; - namespace Blazor.Server.UI.Components.Common; public class PicklistAutocomplete : MudAutocomplete diff --git a/src/Blazor.Server.UI/Components/Localization/LanguageSelector.razor b/src/Blazor.Server.UI/Components/Localization/LanguageSelector.razor index 197ddd9f3..8f46cd101 100644 --- a/src/Blazor.Server.UI/Components/Localization/LanguageSelector.razor +++ b/src/Blazor.Server.UI/Components/Localization/LanguageSelector.razor @@ -1,8 +1,6 @@ -@using Microsoft.Extensions.Options -@using Blazor.Server.UI.Models.Localization @using System.Globalization +@using Microsoft.Extensions.Options @using Blazor.Server.UI.Services - @if (SupportedLanguages is not null) diff --git a/src/Blazor.Server.UI/Components/Shared/LandingSection.razor b/src/Blazor.Server.UI/Components/Shared/LandingSection.razor index f0b0e5e74..9f82363b2 100644 --- a/src/Blazor.Server.UI/Components/Shared/LandingSection.razor +++ b/src/Blazor.Server.UI/Components/Shared/LandingSection.razor @@ -1,6 +1,4 @@ @using MudBlazor.Utilities - -
diff --git a/src/Blazor.Server.UI/Components/Shared/NavMenu.razor.cs b/src/Blazor.Server.UI/Components/Shared/NavMenu.razor.cs index 39745743e..107aaec20 100644 --- a/src/Blazor.Server.UI/Components/Shared/NavMenu.razor.cs +++ b/src/Blazor.Server.UI/Components/Shared/NavMenu.razor.cs @@ -1,5 +1,3 @@ -using Microsoft.AspNetCore.Components; -using CleanArchitecture.Blazor.Application.Common.Models; using Microsoft.AspNetCore.Components.Web; namespace Blazor.Server.UI.Components.Shared; diff --git a/src/Blazor.Server.UI/Components/Shared/NotificationMenu.razor.cs b/src/Blazor.Server.UI/Components/Shared/NotificationMenu.razor.cs index 1957315f9..796c45414 100644 --- a/src/Blazor.Server.UI/Components/Shared/NotificationMenu.razor.cs +++ b/src/Blazor.Server.UI/Components/Shared/NotificationMenu.razor.cs @@ -1,5 +1,3 @@ -using Microsoft.AspNetCore.Components; -using MudBlazor; using Blazor.Server.UI.Services.Notifications; namespace Blazor.Server.UI.Components.Shared; diff --git a/src/Blazor.Server.UI/Components/Shared/SideMenu.razor b/src/Blazor.Server.UI/Components/Shared/SideMenu.razor index 52b30d7c2..63b4e1c34 100644 --- a/src/Blazor.Server.UI/Components/Shared/SideMenu.razor +++ b/src/Blazor.Server.UI/Components/Shared/SideMenu.razor @@ -1,5 +1,5 @@ -@using Blazor.Server.UI.Models.SideMenu @inject IStringLocalizer L +@using Blazor.Server.UI.Models.SideMenu @inherits UserProfileStateComponent L @using Blazor.Server.UI.Services +@inject IStringLocalizer L L @inject AccessTokenProvider TokenProvider +@using CleanArchitecture.Blazor.Infrastructure.Services.JWT @inherits UserProfileStateComponent L @attribute [AllowAnonymous] +@using FluentEmail.Core.Models +@using Blazor.Server.UI.Pages.Identity.Users @inherits OwningComponentBase @Title diff --git a/src/Blazor.Server.UI/Pages/Authentication/Login.razor b/src/Blazor.Server.UI/Pages/Authentication/Login.razor index e38b9d154..c906a86f2 100644 --- a/src/Blazor.Server.UI/Pages/Authentication/Login.razor +++ b/src/Blazor.Server.UI/Pages/Authentication/Login.razor @@ -1,15 +1,11 @@ @page "/pages/authentication/login" -@using System.Text.RegularExpressions -@using Blazor.Server.UI.Pages.Identity.Users -@using CleanArchitecture.Blazor.Application.Common.Security -@using CleanArchitecture.Blazor.Infrastructure.Services.JWT; -@using Microsoft.AspNetCore.Authentication -@using Microsoft.AspNetCore.DataProtection -@using Microsoft.AspNetCore.Identity -@using System.Security.Claims @inject AccessTokenProvider TokenProvider @inject IJSRuntime JS @inherits OwningComponentBase +@using CleanArchitecture.Blazor.Infrastructure.Services.JWT +@using Microsoft.AspNetCore.DataProtection +@using CleanArchitecture.Blazor.Application.Common.Security +@using Blazor.Server.UI.Pages.Identity.Users @implements IDisposable @inject IStringLocalizer L diff --git a/src/Blazor.Server.UI/Pages/Authentication/Register.razor b/src/Blazor.Server.UI/Pages/Authentication/Register.razor index cfd97f38a..1da1cbc92 100644 --- a/src/Blazor.Server.UI/Pages/Authentication/Register.razor +++ b/src/Blazor.Server.UI/Pages/Authentication/Register.razor @@ -1,14 +1,8 @@ @page "/pages/authentication/register" -@using System.Text.RegularExpressions -@using CleanArchitecture.Blazor.Application.Common.Security -@using FluentEmail.Core -@using FluentEmail.Core.Models -@using Microsoft.AspNetCore.Identity -@using System.ComponentModel.DataAnnotations -@using System.Security.Claims -@using FluentValidation; @inject IStringLocalizer L @attribute [AllowAnonymous] +@using CleanArchitecture.Blazor.Application.Common.Security +@using FluentEmail.Core.Models @inherits OwningComponentBase @Title diff --git a/src/Blazor.Server.UI/Pages/Customers/Customers.razor b/src/Blazor.Server.UI/Pages/Customers/Customers.razor index a58bba181..20c5a17cd 100644 --- a/src/Blazor.Server.UI/Pages/Customers/Customers.razor +++ b/src/Blazor.Server.UI/Pages/Customers/Customers.razor @@ -1,13 +1,12 @@ @page "/pages/Customers" - -@using BlazorDownloadFile -@using CleanArchitecture.Blazor.Application.Features.Customers.Caching @using CleanArchitecture.Blazor.Application.Features.Customers.DTOs -@using CleanArchitecture.Blazor.Application.Features.Customers.Commands.Delete -@using CleanArchitecture.Blazor.Application.Features.Customers.Commands.Import @using CleanArchitecture.Blazor.Application.Features.Customers.Queries.Export @using CleanArchitecture.Blazor.Application.Features.Customers.Queries.Pagination +@using BlazorDownloadFile +@using CleanArchitecture.Blazor.Application.Features.Customers.Caching @using CleanArchitecture.Blazor.Application.Features.Customers.Commands.AddEdit +@using CleanArchitecture.Blazor.Application.Features.Customers.Commands.Delete +@using CleanArchitecture.Blazor.Application.Features.Customers.Commands.Import @inject IJSRuntime JS @inject IStringLocalizer L diff --git a/src/Blazor.Server.UI/Pages/Customers/_CustomerFormDialog.razor b/src/Blazor.Server.UI/Pages/Customers/_CustomerFormDialog.razor index 6db478b62..a785c9152 100644 --- a/src/Blazor.Server.UI/Pages/Customers/_CustomerFormDialog.razor +++ b/src/Blazor.Server.UI/Pages/Customers/_CustomerFormDialog.razor @@ -1,5 +1,4 @@ @using CleanArchitecture.Blazor.Application.Features.Customers.Commands.AddEdit - @inherits MudComponentBase @inject IStringLocalizer L diff --git a/src/Blazor.Server.UI/Pages/Documents/Documents.razor b/src/Blazor.Server.UI/Pages/Documents/Documents.razor index 0fbadeb49..8a1418f4c 100644 --- a/src/Blazor.Server.UI/Pages/Documents/Documents.razor +++ b/src/Blazor.Server.UI/Pages/Documents/Documents.razor @@ -1,19 +1,16 @@ @page "/pages/documents" -@using AutoMapper; -@using Blazor.Server.UI.Services.JsInterop; -@using BlazorDownloadFile -@using CleanArchitecture.Blazor.Application.Common.Interfaces.MultiTenant -@using CleanArchitecture.Blazor.Application.Features.Documents.Caching; -@using CleanArchitecture.Blazor.Application.Features.Documents.Commands.Delete -@using CleanArchitecture.Blazor.Application.Features.Documents.DTOs -@using CleanArchitecture.Blazor.Application.Features.Documents.Commands.AddEdit -@using CleanArchitecture.Blazor.Application.Features.Documents.Queries.PaginationQuery -@using CleanArchitecture.Blazor.Infrastructure.Hubs - @inject IJSRuntime JS @inject IStringLocalizer L @inherits UserProfileStateComponent +@using CleanArchitecture.Blazor.Application.Features.Documents.DTOs +@using CleanArchitecture.Blazor.Application.Features.Documents.Queries.PaginationQuery +@using CleanArchitecture.Blazor.Infrastructure.Hubs +@using BlazorDownloadFile +@using CleanArchitecture.Blazor.Application.Features.Documents.Caching +@using CleanArchitecture.Blazor.Application.Features.Documents.Commands.AddEdit +@using CleanArchitecture.Blazor.Application.Features.Documents.Commands.Delete +@using Blazor.Server.UI.Services.JsInterop @implements IDisposable @attribute [Authorize(Policy = Permissions.Documents.View)] @Title diff --git a/src/Blazor.Server.UI/Pages/Documents/_DocumentFormDialog.razor b/src/Blazor.Server.UI/Pages/Documents/_DocumentFormDialog.razor index 389625bc7..6cf49bbdc 100644 --- a/src/Blazor.Server.UI/Pages/Documents/_DocumentFormDialog.razor +++ b/src/Blazor.Server.UI/Pages/Documents/_DocumentFormDialog.razor @@ -1,7 +1,4 @@ @using CleanArchitecture.Blazor.Application.Features.Documents.Commands.AddEdit -@using SixLabors.ImageSharp -@using SixLabors.ImageSharp.Formats -@using SixLabors.ImageSharp.Processing @inherits MudComponentBase @inject IStringLocalizer L diff --git a/src/Blazor.Server.UI/Pages/Documents/_UploadFilesFormDialog.razor b/src/Blazor.Server.UI/Pages/Documents/_UploadFilesFormDialog.razor index 948faa3d5..2156cafee 100644 --- a/src/Blazor.Server.UI/Pages/Documents/_UploadFilesFormDialog.razor +++ b/src/Blazor.Server.UI/Pages/Documents/_UploadFilesFormDialog.razor @@ -1,10 +1,6 @@ -@using Blazor.Server.UI.Services.JsInterop; @using CleanArchitecture.Blazor.Application.Features.Documents.Commands.AddEdit @using CleanArchitecture.Blazor.Application.Features.Documents.Commands.Upload -@using SixLabors.ImageSharp -@using SixLabors.ImageSharp.Formats -@using SixLabors.ImageSharp.Processing - +@using Blazor.Server.UI.Services.JsInterop @inherits MudComponentBase @inject IStringLocalizer L diff --git a/src/Blazor.Server.UI/Pages/Identity/Roles/RoleDtoValidator.cs b/src/Blazor.Server.UI/Pages/Identity/Roles/RoleDtoValidator.cs index b676e8013..14a2f4702 100644 --- a/src/Blazor.Server.UI/Pages/Identity/Roles/RoleDtoValidator.cs +++ b/src/Blazor.Server.UI/Pages/Identity/Roles/RoleDtoValidator.cs @@ -1,5 +1,4 @@ using CleanArchitecture.Blazor.Application.Features.Identity.Dto; -using FluentValidation; namespace Blazor.Server.UI.Pages.Identity.Roles; diff --git a/src/Blazor.Server.UI/Pages/Identity/Roles/Roles.razor b/src/Blazor.Server.UI/Pages/Identity/Roles/Roles.razor index 1f1f2d214..c999fd4a6 100644 --- a/src/Blazor.Server.UI/Pages/Identity/Roles/Roles.razor +++ b/src/Blazor.Server.UI/Pages/Identity/Roles/Roles.razor @@ -1,15 +1,10 @@ -@inherits OwningComponentBase -@page "/identity/roles" -@using Blazor.Server.UI.Components.Dialogs -@using CleanArchitecture.Blazor.Application.Common.Exceptions +@using LazyCache @using CleanArchitecture.Blazor.Application.Features.Identity.Dto -@using CleanArchitecture.Blazor.Infrastructure.Constants -@using CleanArchitecture.Blazor.Application.Common.Security -@using LazyCache; -@using Microsoft.AspNetCore.Identity +@using System.Security.Claims @using System.ComponentModel @using System.Reflection -@using System.Security.Claims +@inherits OwningComponentBase +@page "/identity/roles" @attribute [Authorize(Policy = Permissions.Roles.View)] @inject IStringLocalizer L diff --git a/src/Blazor.Server.UI/Pages/Identity/Roles/_RoleFormDialog.razor b/src/Blazor.Server.UI/Pages/Identity/Roles/_RoleFormDialog.razor index 5da8a3fbc..3373472f8 100644 --- a/src/Blazor.Server.UI/Pages/Identity/Roles/_RoleFormDialog.razor +++ b/src/Blazor.Server.UI/Pages/Identity/Roles/_RoleFormDialog.razor @@ -1,4 +1,4 @@ -@using CleanArchitecture.Blazor.Application.Features.Identity.Dto; +@using CleanArchitecture.Blazor.Application.Features.Identity.Dto @inherits MudComponentBase @inject IStringLocalizer L diff --git a/src/Blazor.Server.UI/Pages/Identity/Users/ChangePasswordModel.cs b/src/Blazor.Server.UI/Pages/Identity/Users/ChangePasswordModel.cs index 7a1b1a280..26e923360 100644 --- a/src/Blazor.Server.UI/Pages/Identity/Users/ChangePasswordModel.cs +++ b/src/Blazor.Server.UI/Pages/Identity/Users/ChangePasswordModel.cs @@ -1,6 +1,4 @@ -using FluentValidation; - -namespace Blazor.Server.UI.Pages.Identity.Users; +namespace Blazor.Server.UI.Pages.Identity.Users; public class ChangePasswordModel { diff --git a/src/Blazor.Server.UI/Pages/Identity/Users/OrgItem.cs b/src/Blazor.Server.UI/Pages/Identity/Users/OrgItem.cs index 847374bf3..b34f090cb 100644 --- a/src/Blazor.Server.UI/Pages/Identity/Users/OrgItem.cs +++ b/src/Blazor.Server.UI/Pages/Identity/Users/OrgItem.cs @@ -1,6 +1,3 @@ -using System.ComponentModel.DataAnnotations.Schema; -using FluentValidation; - namespace Blazor.Server.UI.Pages.Identity.Users; public class OrgItem diff --git a/src/Blazor.Server.UI/Pages/Identity/Users/Profile.razor b/src/Blazor.Server.UI/Pages/Identity/Users/Profile.razor index b80f99653..a95075d5a 100644 --- a/src/Blazor.Server.UI/Pages/Identity/Users/Profile.razor +++ b/src/Blazor.Server.UI/Pages/Identity/Users/Profile.razor @@ -1,8 +1,4 @@ @page "/user/profile" -@using CleanArchitecture.Blazor.Application.Common.Interfaces.Identity -@using SixLabors.ImageSharp -@using SixLabors.ImageSharp.Formats -@using SixLabors.ImageSharp.Processing @inherits OwningComponentBase @inject IStringLocalizer L diff --git a/src/Blazor.Server.UI/Pages/Identity/Users/Profile.razor.cs b/src/Blazor.Server.UI/Pages/Identity/Users/Profile.razor.cs index 3d2061572..552391744 100644 --- a/src/Blazor.Server.UI/Pages/Identity/Users/Profile.razor.cs +++ b/src/Blazor.Server.UI/Pages/Identity/Users/Profile.razor.cs @@ -1,10 +1,9 @@ -using Microsoft.AspNetCore.Components.Forms; -using Microsoft.AspNetCore.Components.Authorization; -using Microsoft.AspNetCore.Identity; -using Microsoft.JSInterop; +using Blazor.Server.UI.Services.JsInterop; using CleanArchitecture.Blazor.Application.Common.Interfaces.Identity; using CleanArchitecture.Blazor.Application.Features.Identity.Notification; -using Blazor.Server.UI.Services.JsInterop; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Identity; namespace Blazor.Server.UI.Pages.Identity.Users { diff --git a/src/Blazor.Server.UI/Pages/Identity/Users/ResetPasswordFormModel.cs b/src/Blazor.Server.UI/Pages/Identity/Users/ResetPasswordFormModel.cs index 0d4d5fbeb..bff07d009 100644 --- a/src/Blazor.Server.UI/Pages/Identity/Users/ResetPasswordFormModel.cs +++ b/src/Blazor.Server.UI/Pages/Identity/Users/ResetPasswordFormModel.cs @@ -1,5 +1,3 @@ -using FluentValidation; - namespace Blazor.Server.UI.Pages.Identity.Users; public class ResetPasswordFormModel diff --git a/src/Blazor.Server.UI/Pages/Identity/Users/UserDtoValidator.cs b/src/Blazor.Server.UI/Pages/Identity/Users/UserDtoValidator.cs index 6cfc64524..f059d5909 100644 --- a/src/Blazor.Server.UI/Pages/Identity/Users/UserDtoValidator.cs +++ b/src/Blazor.Server.UI/Pages/Identity/Users/UserDtoValidator.cs @@ -1,6 +1,3 @@ -using System.ComponentModel.DataAnnotations.Schema; -using CleanArchitecture.Blazor.Application.Common.Security; -using FluentValidation; using CleanArchitecture.Blazor.Application.Features.Identity.Dto; namespace Blazor.Server.UI.Pages.Identity.Users; diff --git a/src/Blazor.Server.UI/Pages/Identity/Users/Users.razor b/src/Blazor.Server.UI/Pages/Identity/Users/Users.razor index e5dc6c9f8..fd9fec2c4 100644 --- a/src/Blazor.Server.UI/Pages/Identity/Users/Users.razor +++ b/src/Blazor.Server.UI/Pages/Identity/Users/Users.razor @@ -1,24 +1,16 @@ @inherits OwningComponentBase -@implements IDisposable -@page "/identity/users" -@using Blazor.Server.UI.Components.Dialogs -@using BlazorDownloadFile; -@using CleanArchitecture.Blazor.Application.Common.Exceptions -@using Blazor.Server.UI.Pages.Identity.Roles; +@using LazyCache @using CleanArchitecture.Blazor.Application.Common.Interfaces.Identity @using CleanArchitecture.Blazor.Application.Common.Interfaces.MultiTenant -@using CleanArchitecture.Blazor.Application.Common.Security -@using CleanArchitecture.Blazor.Infrastructure.Constants -@using CleanArchitecture.Blazor.Infrastructure.Services -@using Duende.IdentityServer.Events -@using LazyCache; -@using Microsoft.AspNetCore.Components.Server.Circuits -@using Microsoft.AspNetCore.Identity; -@using CleanArchitecture.Blazor.Application.Features.Identity.Dto; -@using System.ComponentModel; -@using System.Reflection; -@using System.Security.Claims; -@using System.Linq.Expressions; +@using CleanArchitecture.Blazor.Application.Features.Identity.Dto +@using Blazor.Server.UI.Pages.Identity.Roles +@using BlazorDownloadFile +@using System.Security.Claims +@using System.ComponentModel +@using System.Linq.Expressions +@using System.Reflection +@implements IDisposable +@page "/identity/users" @inject IStringLocalizer L @attribute [Authorize(Policy = Permissions.Users.View)] @Title diff --git a/src/Blazor.Server.UI/Pages/Identity/Users/_UserForm.razor b/src/Blazor.Server.UI/Pages/Identity/Users/_UserForm.razor index 572b3fb61..e1d7e172d 100644 --- a/src/Blazor.Server.UI/Pages/Identity/Users/_UserForm.razor +++ b/src/Blazor.Server.UI/Pages/Identity/Users/_UserForm.razor @@ -1,11 +1,5 @@ -@using CleanArchitecture.Blazor.Application.Common.Interfaces.Identity; @using CleanArchitecture.Blazor.Application.Common.Interfaces.MultiTenant -@using CleanArchitecture.Blazor.Application.Features.Identity.Dto; -@using Microsoft.AspNetCore.Identity -@using SixLabors.ImageSharp -@using SixLabors.ImageSharp.Formats -@using SixLabors.ImageSharp.Processing - +@using CleanArchitecture.Blazor.Application.Features.Identity.Dto @inherits MudComponentBase @inject IStringLocalizer L diff --git a/src/Blazor.Server.UI/Pages/Identity/Users/_UserFormDialog.razor b/src/Blazor.Server.UI/Pages/Identity/Users/_UserFormDialog.razor index ca7d9af53..528085306 100644 --- a/src/Blazor.Server.UI/Pages/Identity/Users/_UserFormDialog.razor +++ b/src/Blazor.Server.UI/Pages/Identity/Users/_UserFormDialog.razor @@ -1,4 +1,4 @@ -@using CleanArchitecture.Blazor.Application.Features.Identity.Dto; +@using CleanArchitecture.Blazor.Application.Features.Identity.Dto @inherits MudComponentBase @inject IStringLocalizer L diff --git a/src/Blazor.Server.UI/Pages/Index.razor b/src/Blazor.Server.UI/Pages/Index.razor index 3bf928894..59070e6b9 100644 --- a/src/Blazor.Server.UI/Pages/Index.razor +++ b/src/Blazor.Server.UI/Pages/Index.razor @@ -1,7 +1,6 @@ @page "/" -@using Blazor.Server.UI.Models; -@using MudBlazor.Utilities; -@using Microsoft.AspNetCore.Authorization +@using MudBlazor.Utilities +@using Blazor.Server.UI.Models @Title - +
@L[_currentDto.GetClassDescription()] - +
@@ -87,7 +87,7 @@ IconColor="Color.Surface"> @ConstantString.Export - @if (_canSearch) { - } @@ -228,18 +228,18 @@ private bool _loading; private bool _uploading; private bool _exporting; - private bool _pdfexporting; + private bool _pdfExporting; private int _defaultPageSize = 15; [Inject] - private IMediator _mediator { get; set; } = default!; + private IMediator Mediator { get; set; } = default!; [Inject] private IMapper _mapper { get; set; } = default!; [CascadingParameter] - private Task _authState { get; set; } = default!; + private Task AuthState { get; set; } = default!; - private ProductsWithPaginationQuery _query { get; set; } = new(); + private ProductsWithPaginationQuery Query { get; set; } = new(); [Inject] - private IBlazorDownloadFileService _blazorDownloadFileService { get; set; } = null!; + private IBlazorDownloadFileService BlazorDownloadFileService { get; set; } = null!; private bool _canSearch; private bool _canCreate; private bool _canEdit; @@ -249,7 +249,7 @@ protected override async Task OnInitializedAsync() { Title = L[_currentDto.GetClassDescription()]; - var state = await _authState; + var state = await AuthState; _canCreate = (await AuthService.AuthorizeAsync(state.User, Permissions.Products.Create)).Succeeded; _canSearch = (await AuthService.AuthorizeAsync(state.User, Permissions.Products.Search)).Succeeded; _canEdit = (await AuthService.AuthorizeAsync(state.User, Permissions.Products.Edit)).Succeeded; @@ -262,11 +262,11 @@ try { _loading = true; - _query.Sort = state.SortDefinitions.FirstOrDefault()?.SortBy??"Id"; - _query.SortBy = (state.SortDefinitions.FirstOrDefault()?.Descending??true ? AutoFilterer.Enums.Sorting.Descending : AutoFilterer.Enums.Sorting.Ascending); - _query.Page = state.Page + 1; - _query.PerPage = state.PageSize; - var result = await _mediator.Send(_query).ConfigureAwait(false); + Query.Sort = state.SortDefinitions.FirstOrDefault()?.SortBy??"Id"; + Query.SortBy = (state.SortDefinitions.FirstOrDefault()?.Descending??true ? AutoFilterer.Enums.Sorting.Descending : AutoFilterer.Enums.Sorting.Ascending); + Query.Page = state.Page + 1; + Query.PerPage = state.PageSize; + var result = await Mediator.Send(Query).ConfigureAwait(false); return new GridData() { TotalItems = result.TotalItems, Items = result.Items }; } finally @@ -290,19 +290,19 @@ private async Task OnSearch(string text) { _selectedItems = new(); - _query.Keyword = text; + Query.Keyword = text; await _table.ReloadServerData(); } private async Task OnChangedListView(ProductListView listview) { - _query.ListView = listview; + Query.ListView = listview; await _table.ReloadServerData(); } private async Task OnRefresh() { ProductCacheKey.Refresh(); _selectedItems = new(); - _query.Keyword = string.Empty; + Query.Keyword = string.Empty; await _table.ReloadServerData(); } private async Task OnCreate() @@ -310,7 +310,7 @@ var command = new AddEditProductCommand() { Pictures=new List() }; var parameters = new DialogParameters { - { nameof(_ProductFormDialog.model),command }, + { nameof(_ProductFormDialog.Model),command }, }; var options = new DialogOptions { CloseButton = true, MaxWidth = MaxWidth.Medium, FullWidth = true }; var dialog = DialogService.Show<_ProductFormDialog> @@ -326,7 +326,7 @@ var command = _mapper.Map(dto); var parameters = new DialogParameters { - { nameof(_ProductFormDialog.model),command }, + { nameof(_ProductFormDialog.Model),command }, }; var options = new DialogOptions { CloseButton = true, MaxWidth = MaxWidth.Medium, FullWidth = true }; var dialog = DialogService.Show<_ProductFormDialog> @@ -379,19 +379,19 @@ _exporting = true; var request = new ExportProductsQuery() { - Brand = _query.Brand, - Name = _query.Name, - Price = _query.Price, - Unit = _query.Unit, - Keyword = _query.Keyword, - ListView = _query.ListView, + Brand = Query.Brand, + Name = Query.Name, + Price = Query.Price, + Unit = Query.Unit, + Keyword = Query.Keyword, + ListView = Query.ListView, Sort = _table.SortDefinitions.Values.FirstOrDefault()?.SortBy ?? "Id", SortBy = (_table.SortDefinitions.Values.FirstOrDefault()?.Descending??false) ? AutoFilterer.Enums.Sorting.Ascending : AutoFilterer.Enums.Sorting.Descending }; - var result = await _mediator.Send(request); + var result = await Mediator.Send(request); if (result.Succeeded) { - var downloadresult = await _blazorDownloadFileService.DownloadFile($"{L["Products"]}.xlsx", result.Data, contentType: "application/octet-stream"); + var downloadResult = await BlazorDownloadFileService.DownloadFile($"{L["Products"]}.xlsx", result.Data, contentType: "application/octet-stream"); Snackbar.Add($"{ConstantString.ExportSuccess}", MudBlazor.Severity.Info); } else @@ -402,30 +402,30 @@ } private async Task OnExportPDF() { - _pdfexporting = true; + _pdfExporting = true; var request = new ExportProductsQuery() { - Brand = _query.Brand, - Name = _query.Name, - Price = _query.Price, - Unit = _query.Unit, - Keyword = _query.Keyword, - ListView = _query.ListView, + Brand = Query.Brand, + Name = Query.Name, + Price = Query.Price, + Unit = Query.Unit, + Keyword = Query.Keyword, + ListView = Query.ListView, Sort = _table.SortDefinitions.Values.FirstOrDefault()?.SortBy ?? "Id", SortBy = (_table.SortDefinitions.Values.FirstOrDefault()?.Descending ?? false) ? AutoFilterer.Enums.Sorting.Ascending : AutoFilterer.Enums.Sorting.Descending, ExportType = ExportType.PDF }; - var result = await _mediator.Send(request); + var result = await Mediator.Send(request); if (result.Succeeded) { - var downloadresult = await _blazorDownloadFileService.DownloadFile($"{L["Products"]}.pdf", result.Data, contentType: "application/octet-stream"); + var downloadResult = await BlazorDownloadFileService.DownloadFile($"{L["Products"]}.pdf", result.Data, contentType: "application/octet-stream"); Snackbar.Add($"{ConstantString.ExportSuccess}", MudBlazor.Severity.Info); } else { Snackbar.Add($"{result.ErrorMessage}", MudBlazor.Severity.Error); } - _pdfexporting = false; + _pdfExporting = false; } private async Task OnImportData(IBrowserFile file) { @@ -434,7 +434,7 @@ await file.OpenReadStream(GlobalVariable.MaxAllowedSize).CopyToAsync(stream); var command = new ImportProductsCommand(file.Name, stream.ToArray()); - var result = await _mediator.Send(command); + var result = await Mediator.Send(command); if (result.Succeeded) { await _table.ReloadServerData(); diff --git a/src/Blazor.Server.UI/Pages/Products/_ProductFormDialog.razor b/src/Blazor.Server.UI/Pages/Products/_ProductFormDialog.razor index 20d4f3512..eb3cc1c73 100644 --- a/src/Blazor.Server.UI/Pages/Products/_ProductFormDialog.razor +++ b/src/Blazor.Server.UI/Pages/Products/_ProductFormDialog.razor @@ -4,11 +4,11 @@ @inject IStringLocalizer L - + - @@ -16,16 +16,16 @@ + For="@(() => Model.Description)" + @bind-Value="Model.Description"> + @bind-Value="Model.Brand"> @@ -35,17 +35,17 @@ + @bind-Value="Model.Price"> + @bind-Value="Model.Unit"> @@ -55,7 +55,7 @@
+ @bind-Files="Model.UploadPictures" OnFilesChanged="UploadFiles" For="@(() => Model.UploadPictures)"> @L["The recommended size for uploading images is 640X320"]
- @if (model.Pictures is not null) + @if (Model.Pictures is not null) { - foreach (var img in model.Pictures) + foreach (var img in Model.Pictures) {
- +
@@ -101,17 +101,18 @@ private bool _saving = false; [CascadingParameter] MudDialogInstance MudDialog { get; set; } = default!; - [Inject] private IUploadService _uploadService { get; set; } = default!; + [Inject] private IUploadService UploadService { get; set; } = default!; [Inject] - private IMediator _mediator { get; set; } = default!; - AddEditProductCommandValidator _modelValidator = new(); - [EditorRequired][Parameter] public AddEditProductCommand model { get; set; } = default!; - const long MAXALLOWEDSIZE = 3145728; + private IMediator Mediator { get; set; } = default!; + + readonly AddEditProductCommandValidator _modelValidator = new(); + [EditorRequired][Parameter] public AddEditProductCommand Model { get; set; } = default!; + const long MaxAllowedSize = 3145728; bool _uploading; private async Task DeleteImage(ProductImage picture) { - if (model.Pictures != null) + if (Model.Pictures != null) { var parameters = new DialogParameters { @@ -123,11 +124,11 @@ if (!state.Canceled) { - model.Pictures.Remove(picture); + Model.Pictures.Remove(picture); } } } - private async Task previewImage(string url, List imgs) + private async Task PreviewImage(string url, List imgs) { await JS.InvokeVoidAsync("previewImage", url, imgs.Select(x=>x.Url).ToArray()); } @@ -142,12 +143,12 @@ try { var filestream = file.OpenReadStream(GlobalVariable.MaxAllowedSize); - var imgstream = new MemoryStream(); - await filestream.CopyToAsync(imgstream); - imgstream.Position = 0; + var imgStream = new MemoryStream(); + await filestream.CopyToAsync(imgStream); + imgStream.Position = 0; using (var outStream = new MemoryStream()) { - using (var image = Image.Load(imgstream)) + using (var image = Image.Load(imgStream)) { image.Mutate( i => i.Resize(new ResizeOptions() { Mode = SixLabors.ImageSharp.Processing.ResizeMode.Crop, Size = new SixLabors.ImageSharp.Size(640, 320) })); @@ -155,7 +156,7 @@ var filename = file.Name; var fi = new FileInfo(filename); var ext = fi.Extension; - var result = await _uploadService.UploadAsync(new UploadRequest(Guid.NewGuid().ToString() + ext, UploadType.Product, outStream.ToArray())); + var result = await UploadService.UploadAsync(new UploadRequest(Guid.NewGuid().ToString() + ext, UploadType.Product, outStream.ToArray())); list.Add(new ProductImage() { Name = filename, Size = outStream.Length, Url = result }); } } @@ -167,10 +168,10 @@ } Snackbar.Add(L["Upload pictures successfully"], MudBlazor.Severity.Info); - if (model.Pictures is null) - model.Pictures = list; + if (Model.Pictures is null) + Model.Pictures = list; else - model.Pictures.AddRange(list); + Model.Pictures.AddRange(list); } finally @@ -187,7 +188,7 @@ if (!_form!.IsValid) return; - var result = await _mediator.Send(model); + var result = await Mediator.Send(Model); if (result.Succeeded) { diff --git a/src/Blazor.Server.UI/Pages/SystemManagement/AuditTrails.razor b/src/Blazor.Server.UI/Pages/SystemManagement/AuditTrails.razor index 7c9656c10..eb56f60e3 100644 --- a/src/Blazor.Server.UI/Pages/SystemManagement/AuditTrails.razor +++ b/src/Blazor.Server.UI/Pages/SystemManagement/AuditTrails.razor @@ -113,16 +113,16 @@ private bool _loading; private int _defaultPageSize = 15; [Inject] - private IMediator _mediator { get; set; } = default!; - private AuditTrailDto _currentDto = new(); - private AuditTrailsWithPaginationQuery _query = new(); + private IMediator Mediator { get; set; } = default!; + private readonly AuditTrailDto _currentDto = new(); + private readonly AuditTrailsWithPaginationQuery _query = new(); [CascadingParameter] - private Task _authState { get; set; } = default!; + private Task AuthState { get; set; } = default!; protected override async Task OnInitializedAsync() { Title = L[_currentDto.GetClassDescription()]; - var state = await _authState; + var state = await AuthState; } private async Task> ServerReload(GridState state) @@ -135,7 +135,7 @@ _query.Page = state.Page + 1; _query.PerPage = state.PageSize; - var result = await _mediator.Send(_query).ConfigureAwait(false); + var result = await Mediator.Send(_query).ConfigureAwait(false); return new GridData() { TotalItems = result.TotalItems, Items = result.Items }; } finally diff --git a/src/Blazor.Server.UI/Pages/SystemManagement/Components/LogsLineCharts.razor b/src/Blazor.Server.UI/Pages/SystemManagement/Components/LogsLineCharts.razor index 4410a7d76..9cee715a6 100644 --- a/src/Blazor.Server.UI/Pages/SystemManagement/Components/LogsLineCharts.razor +++ b/src/Blazor.Server.UI/Pages/SystemManagement/Components/LogsLineCharts.razor @@ -5,8 +5,8 @@ @inject IStringLocalizer L
- - + @@ -22,24 +22,24 @@
@code { - private ApexChart? chart { get; set; } - private ApexChartOptions options { get; set; } = new(); + private ApexChart? Chart { get; set; } + private ApexChartOptions Options { get; set; } = new(); [EditorRequired][Parameter] public List Data { get; set; } = new(); [Inject] - private LayoutService _layoutService { get; set; } = null!; - public string backgroundColor = "background:#fff"; + private LayoutService LayoutService { get; set; } = null!; + public string BackgroundColor = "background:#fff"; protected override void OnInitialized() { - var isdarkmode = _layoutService.IsDarkMode; - var colors = isdarkmode ? new List() { "#0277BD", "#039BE5" } : new List() { "#1976D2", "#90CAF9" }; - backgroundColor = isdarkmode ? "background:rgb(66, 66, 66)" : "background:#fff"; + var isDarkMode = LayoutService.IsDarkMode; + var colors = isDarkMode ? new List() { "#0277BD", "#039BE5" } : new List() { "#1976D2", "#90CAF9" }; + BackgroundColor = isDarkMode ? "background:rgb(66, 66, 66)" : "background:#fff"; - options.Theme = new ApexCharts.Theme() + Options.Theme = new ApexCharts.Theme() { - Mode = (isdarkmode ? Mode.Dark : Mode.Light), + Mode = (isDarkMode ? Mode.Dark : Mode.Light), }; - options.Fill = new Fill + Options.Fill = new Fill { Type = new List { FillType.Gradient }, Gradient = new FillGradient @@ -53,8 +53,8 @@ }, }; - options.Yaxis = new List(); - options.Yaxis.Add(new YAxis + Options.Yaxis = new List(); + Options.Yaxis.Add(new YAxis { Labels = new YAxisLabels { @@ -62,7 +62,7 @@ } } ); - options.Xaxis = new XAxis + Options.Xaxis = new XAxis { Labels = new XAxisLabels { @@ -72,13 +72,13 @@ } }; - options.DataLabels = new DataLabels + Options.DataLabels = new DataLabels { Formatter = @"function(value, opts) { return Number(value).toLocaleString();}" }; - options.Tooltip = new ApexCharts.Tooltip + Options.Tooltip = new ApexCharts.Tooltip { X = new TooltipX { @@ -88,27 +88,27 @@ } }; - _layoutService.MajorUpdateOccured += LayoutServiceOnMajorUpdateOccured; + LayoutService.MajorUpdateOccured += LayoutServiceOnMajorUpdateOccured; } private async void LayoutServiceOnMajorUpdateOccured(object? sender, EventArgs e) { - var isdarkmode = _layoutService.IsDarkMode; - var colors = isdarkmode ? new List() { "#0277BD", "#039BE5" } : new List() { "#1976D2", "#90CAF9" }; - backgroundColor = isdarkmode ? "background:rgb(66, 66, 66)" : "background:#fff"; - options.Theme.Mode = (isdarkmode ? Mode.Dark : Mode.Light); - options.Fill.Gradient.GradientToColors = colors; - await chart!.UpdateOptionsAsync(true, true, false); - await chart!.RenderAsync(); + var isDarkMode = LayoutService.IsDarkMode; + var colors = isDarkMode ? new List() { "#0277BD", "#039BE5" } : new List() { "#1976D2", "#90CAF9" }; + BackgroundColor = isDarkMode ? "background:rgb(66, 66, 66)" : "background:#fff"; + Options.Theme.Mode = (isDarkMode ? Mode.Dark : Mode.Light); + Options.Fill.Gradient.GradientToColors = colors; + await Chart!.UpdateOptionsAsync(true, true, false); + await Chart!.RenderAsync(); StateHasChanged(); } public async Task RenderChart() { - await chart!.UpdateSeriesAsync(true); - await chart!.RenderAsync(); + await Chart!.UpdateSeriesAsync(true); + await Chart!.RenderAsync(); } public void Dispose() { - _layoutService.MajorUpdateOccured -= LayoutServiceOnMajorUpdateOccured; + LayoutService.MajorUpdateOccured -= LayoutServiceOnMajorUpdateOccured; GC.SuppressFinalize(this); } diff --git a/src/Blazor.Server.UI/Pages/SystemManagement/Dictionaries.razor b/src/Blazor.Server.UI/Pages/SystemManagement/Dictionaries.razor index d1452e8de..8ee58f87a 100644 --- a/src/Blazor.Server.UI/Pages/SystemManagement/Dictionaries.razor +++ b/src/Blazor.Server.UI/Pages/SystemManagement/Dictionaries.razor @@ -28,7 +28,7 @@ Hover="true" MultiSelection="true" @bind-SelectedItems="_selectedItems" - @bind-SelectedItem="_selectedItem" + @bind-SelectedItem="SelectedItem" ReadOnly="false" EditMode="DataGridEditMode.Cell" T="KeyValueDto" @@ -152,15 +152,15 @@
- + - - - + + + @@ -185,36 +185,36 @@ public string Title { get; set; } = "Picklist"; private IList _keyValueList = new List(); private HashSet _selectedItems = new HashSet(); - private KeyValueDto _selectedItem { get; set; } = new(); - private KeyValueDto _elementBeforeEdit { get; set; } = new(); + private KeyValueDto SelectedItem { get; set; } = new(); + private KeyValueDto ElementBeforeEdit { get; set; } = new(); private bool _canCancelEdit = true; private string _searchString = string.Empty; private Picklist? _searchPicklist = null; private int _defaultPageSize = 15; private bool _editing; [CascadingParameter] - private Task _authState { get; set; } = default!; + private Task AuthState { get; set; } = default!; [Inject] - private IMapper _mapper { get; set; } = default!; + private IMapper Mapper { get; set; } = default!; [Inject] - private IBlazorDownloadFileService _blazorDownloadFileService { get; set; } = null!; + private IBlazorDownloadFileService BlazorDownloadFileService { get; set; } = null!; [Inject] - private IMediator _mediator { get; set; } = default!; - private KeyValuesWithPaginationQuery request = new(); + private IMediator Mediator { get; set; } = default!; + private KeyValuesWithPaginationQuery _request = new(); private bool _canCreate; private bool _canSearch; private bool _canEdit; private bool _canDelete; private bool _canImport; private bool _canExport; - private bool _readonly => !_canCreate || !_canEdit; + private bool Readonly => !_canCreate || !_canEdit; private bool _loading; private bool _uploading; private bool _downloading; protected override async Task OnInitializedAsync() { - Title = L[_selectedItem.GetClassDescription()]; - var state = await _authState; + Title = L[SelectedItem.GetClassDescription()]; + var state = await AuthState; _canCreate = (await AuthService.AuthorizeAsync(state.User, Permissions.Dictionaries.Create)).Succeeded; _canSearch = (await AuthService.AuthorizeAsync(state.User, Permissions.Dictionaries.Search)).Succeeded; _canEdit = (await AuthService.AuthorizeAsync(state.User, Permissions.Dictionaries.Edit)).Succeeded; @@ -237,7 +237,7 @@ Page = state.Page + 1, PerPage = state.PageSize }; - var result = await _mediator.Send(request).ConfigureAwait(false); + var result = await Mediator.Send(request).ConfigureAwait(false); return new GridData() { TotalItems = result.TotalItems, Items = result.Items }; } finally @@ -266,8 +266,8 @@ { InvokeAsync(async () => { - var command = _mapper.Map(item); - var result = await _mediator.Send(command); + var command = Mapper.Map(item); + var result = await Mediator.Send(command); if (!result.Succeeded) { Snackbar.Add($"{result.ErrorMessage}", MudBlazor.Severity.Error); @@ -304,7 +304,7 @@ if (!state.Canceled) { var command = new DeleteKeyValueCommand(_selectedItems.Select(x => x.Id).ToArray()); - var result = await _mediator.Send(command); + var result = await Mediator.Send(command); await _table.ReloadServerData(); Snackbar.Add($"{ConstantString.DeleteSuccess}", MudBlazor.Severity.Info); } @@ -313,8 +313,8 @@ { var command = new AddEditKeyValueCommand() { - Name = _selectedItem.Name, - Description = _selectedItem?.Description, + Name = SelectedItem.Name, + Description = SelectedItem?.Description, }; var parameters = new DialogParameters { @@ -338,8 +338,8 @@ { Keyword = _searchString, }; - var result = await _mediator.Send(request); - var downloadresult = await _blazorDownloadFileService.DownloadFile($"{L["Picklist"]}.xlsx", result, contentType: "application/octet-stream"); + var result = await Mediator.Send(request); + var downloadResult = await BlazorDownloadFileService.DownloadFile($"{L["Picklist"]}.xlsx", result, contentType: "application/octet-stream"); Snackbar.Add($"{ConstantString.ExportSuccess}", MudBlazor.Severity.Info); _downloading = false; @@ -350,7 +350,7 @@ var stream = new MemoryStream(); await e.File.OpenReadStream(GlobalVariable.MaxAllowedSize).CopyToAsync(stream); var command = new ImportKeyValuesCommand(e.File.Name, stream.ToArray()); - var result = await _mediator.Send(command); + var result = await Mediator.Send(command); if (result.Succeeded) { await OnRefresh(); diff --git a/src/Blazor.Server.UI/Pages/SystemManagement/Logs.razor b/src/Blazor.Server.UI/Pages/SystemManagement/Logs.razor index 7bbaf336e..f80361c2b 100644 --- a/src/Blazor.Server.UI/Pages/SystemManagement/Logs.razor +++ b/src/Blazor.Server.UI/Pages/SystemManagement/Logs.razor @@ -16,7 +16,7 @@ - + @code { - private LogsLineCharts? chartcomponent; + private LogsLineCharts? _chartComponent; public string Title { get; private set; } = "Logs"; private string _searchString = string.Empty; private MudDataGrid _table = default!; - private LogDto _currentDto = new(); + private readonly LogDto _currentDto = new(); private int _defaultPageSize = 15; - public List _data { get; set; } = new(); + public List Data { get; set; } = new(); [CascadingParameter] - private Task _authState { get; set; } = default!; + private Task AuthState { get; set; } = default!; private bool _loading; private bool _clearing; [Inject] - private IMediator _mediator { get; set; } = default!; + private IMediator Mediator { get; set; } = default!; private bool _canPurge; - private LogsWithPaginationQuery _query = new(); + private readonly LogsWithPaginationQuery _query = new(); protected override async void OnInitialized() { Title = L["Logs"]; - var state = await _authState; + var state = await AuthState; _canPurge = (await AuthService.AuthorizeAsync(state.User, Permissions.Logs.Purge)).Succeeded; } protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) { - _data = await _mediator.Send(new LogsTimeLineChatDataQuery()); + Data = await Mediator.Send(new LogsTimeLineChatDataQuery()); StateHasChanged(); - await chartcomponent!.RenderChart(); + await _chartComponent!.RenderChart(); } } @@ -184,7 +184,7 @@ _query.SortBy = (state.SortDefinitions.FirstOrDefault()?.Descending == false ? AutoFilterer.Enums.Sorting.Ascending : AutoFilterer.Enums.Sorting.Descending); _query.Page = state.Page + 1; _query.PerPage = state.PageSize; - var result = await _mediator.Send(_query).ConfigureAwait(false); + var result = await Mediator.Send(_query).ConfigureAwait(false); return new GridData() { TotalItems = result.TotalItems, Items = result.Items }; } finally @@ -233,7 +233,7 @@ try { var command = new ClearLogsCommand(); - var result = await _mediator.Send(command); + var result = await Mediator.Send(command); await _table.ReloadServerData(); Snackbar.Add(L["Logs are erased"], MudBlazor.Severity.Info); } diff --git a/src/Blazor.Server.UI/Pages/Tenants/Tenants.razor b/src/Blazor.Server.UI/Pages/Tenants/Tenants.razor index 23d11f090..68033fb32 100644 --- a/src/Blazor.Server.UI/Pages/Tenants/Tenants.razor +++ b/src/Blazor.Server.UI/Pages/Tenants/Tenants.razor @@ -156,13 +156,13 @@ private bool _loading; [Inject] - private IMediator _mediator { get; set; } = default!; + private IMediator Mediator { get; set; } = default!; [Inject] - private IMapper _mapper { get; set; } = default!; + private IMapper Mapper { get; set; } = default!; [CascadingParameter] - private Task _authState { get; set; } = default!; + private Task AuthState { get; set; } = default!; - private TenantsWithPaginationQuery _query { get; set; } = new(); + private TenantsWithPaginationQuery Query { get; set; } = new(); private bool _canSearch; private bool _canCreate; @@ -172,7 +172,7 @@ protected override async Task OnInitializedAsync() { Title = L[_currentDto.GetClassDescription()]; - var state = await _authState; + var state = await AuthState; _canCreate = (await AuthService.AuthorizeAsync(state.User, Permissions.Tenants.Create)).Succeeded; _canSearch = (await AuthService.AuthorizeAsync(state.User, Permissions.Tenants.Search)).Succeeded; _canEdit = (await AuthService.AuthorizeAsync(state.User, Permissions.Tenants.Edit)).Succeeded; @@ -183,12 +183,12 @@ try { _loading = true; - _query.Keyword = _searchString; - _query.Sort = state.SortDefinitions.FirstOrDefault()?.SortBy; - _query.SortBy = (state.SortDefinitions.FirstOrDefault()?.Descending==false ? AutoFilterer.Enums.Sorting.Ascending : AutoFilterer.Enums.Sorting.Descending); - _query.Page = state.Page + 1; - _query.PerPage = state.PageSize; - var result = await _mediator.Send(_query); + Query.Keyword = _searchString; + Query.Sort = state.SortDefinitions.FirstOrDefault()?.SortBy; + Query.SortBy = (state.SortDefinitions.FirstOrDefault()?.Descending==false ? AutoFilterer.Enums.Sorting.Ascending : AutoFilterer.Enums.Sorting.Descending); + Query.Page = state.Page + 1; + Query.PerPage = state.PageSize; + var result = await Mediator.Send(Query); return new GridData() { TotalItems = result.TotalItems, Items = result.Items }; } finally @@ -216,7 +216,7 @@ var command = new AddEditTenantCommand(); var parameters = new DialogParameters { - { nameof(_TenantFormDialog.model),command }, + { nameof(_TenantFormDialog.Model),command }, }; var options = new DialogOptions { CloseButton = true, MaxWidth = MaxWidth.Small, FullWidth = true }; var dialog = DialogService.Show<_TenantFormDialog> @@ -229,10 +229,10 @@ } private async Task OnEdit(TenantDto dto) { - var command = _mapper.Map(dto); + var command = Mapper.Map(dto); var parameters = new DialogParameters { - { nameof(_TenantFormDialog.model),command }, + { nameof(_TenantFormDialog.Model),command }, }; var options = new DialogOptions { CloseButton = true, MaxWidth = MaxWidth.Small, FullWidth = true }; var dialog = DialogService.Show<_TenantFormDialog> diff --git a/src/Blazor.Server.UI/Pages/Tenants/_TenantFormDialog.razor b/src/Blazor.Server.UI/Pages/Tenants/_TenantFormDialog.razor index 33694fb5b..bdad92ba7 100644 --- a/src/Blazor.Server.UI/Pages/Tenants/_TenantFormDialog.razor +++ b/src/Blazor.Server.UI/Pages/Tenants/_TenantFormDialog.razor @@ -3,26 +3,26 @@ @inject IStringLocalizer L - + - - - + @@ -40,8 +40,9 @@ bool _saving = false; [CascadingParameter] MudDialogInstance MudDialog { get; set; } = default!; - AddEditTenantCommandValidator modelValidator = new AddEditTenantCommandValidator(); - [EditorRequired][Parameter] public AddEditTenantCommand model { get; set; } = default!; + + readonly AddEditTenantCommandValidator _modelValidator = new AddEditTenantCommandValidator(); + [EditorRequired][Parameter] public AddEditTenantCommand Model { get; set; } = default!; [Inject] private IMediator _mediator { get; set; } = default!; async Task Submit() @@ -53,7 +54,7 @@ if (!_form!.IsValid) return; - var result = await _mediator.Send(model); + var result = await _mediator.Send(Model); if (result.Succeeded) { diff --git a/src/Blazor.Server.UI/Program.cs b/src/Blazor.Server.UI/Program.cs index 7f089d594..c39123172 100644 --- a/src/Blazor.Server.UI/Program.cs +++ b/src/Blazor.Server.UI/Program.cs @@ -25,7 +25,7 @@ .WriteTo.Console() ); -builder.Services.AddBlazorUIServices(); +builder.Services.AddBlazorUiServices(); builder.Services.AddInfrastructureServices(builder.Configuration) .AddApplicationServices(); @@ -44,13 +44,13 @@ using (var scope = app.Services.CreateScope()) { - var initialiser = scope.ServiceProvider.GetRequiredService(); - await initialiser.InitialiseAsync(); - await initialiser.SeedAsync(); + var initializer = scope.ServiceProvider.GetRequiredService(); + await initializer.InitialiseAsync(); + await initializer.SeedAsync(); var notificationService = scope.ServiceProvider.GetService(); - if (notificationService is InMemoryNotificationService inmemoryService) + if (notificationService is InMemoryNotificationService inMemoryNotificationService) { - inmemoryService.Preload(); + inMemoryNotificationService.Preload(); } } } diff --git a/src/Blazor.Server.UI/Services/Layout/LayoutService.cs b/src/Blazor.Server.UI/Services/Layout/LayoutService.cs index fb5a4d1ab..a00b8b399 100644 --- a/src/Blazor.Server.UI/Services/Layout/LayoutService.cs +++ b/src/Blazor.Server.UI/Services/Layout/LayoutService.cs @@ -1,10 +1,12 @@ +using Blazor.Server.UI.Services.UserPreferences; + namespace Blazor.Server.UI.Services; public class LayoutService { private bool _systemPreferences; private readonly IUserPreferencesService _userPreferencesService; - private UserPreferences _userPreferences=new(); + private UserPreferences.UserPreferences _userPreferences=new(); public DarkLightMode DarkModeToggle = DarkLightMode.System; public bool IsRTL { get; private set; } = false; public bool IsDarkMode { get; private set; } = false; @@ -25,7 +27,7 @@ public void SetDarkMode(bool value) IsDarkMode = value; } - public async Task ApplyUserPreferences(bool isDarkModeDefaultTheme) + public async Task ApplyUserPreferences(bool isDarkModeDefaultTheme) { _userPreferences = await _userPreferencesService.LoadUserPreferences(); if (_userPreferences != null) @@ -52,7 +54,7 @@ public async Task ApplyUserPreferences(bool isDarkModeDefaultTh else { IsDarkMode = isDarkModeDefaultTheme; - _userPreferences = new UserPreferences { IsDarkMode = IsDarkMode }; + _userPreferences = new UserPreferences.UserPreferences { IsDarkMode = IsDarkMode }; await _userPreferencesService.SaveUserPreferences(_userPreferences); } return _userPreferences; @@ -147,7 +149,7 @@ public async Task SetBorderRadius(double size) await _userPreferencesService.SaveUserPreferences(_userPreferences); OnMajorUpdateOccured(); } - public async Task UpdateUserPreferences(UserPreferences preferences) + public async Task UpdateUserPreferences(UserPreferences.UserPreferences preferences) { _userPreferences = preferences; IsDarkMode = _userPreferences.DarkLightTheme switch diff --git a/src/Blazor.Server.UI/Services/UserPreferences/UserPreferences.cs b/src/Blazor.Server.UI/Services/UserPreferences/UserPreferences.cs index eece981dd..f73fa8f8c 100644 --- a/src/Blazor.Server.UI/Services/UserPreferences/UserPreferences.cs +++ b/src/Blazor.Server.UI/Services/UserPreferences/UserPreferences.cs @@ -2,7 +2,7 @@ // MudBlazor licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -namespace Blazor.Server.UI.Services; +namespace Blazor.Server.UI.Services.UserPreferences; public class UserPreferences { diff --git a/src/Blazor.Server.UI/Services/UserPreferences/UserPreferencesService.cs b/src/Blazor.Server.UI/Services/UserPreferences/UserPreferencesService.cs index 04b63a26f..ce0b8af8b 100644 --- a/src/Blazor.Server.UI/Services/UserPreferences/UserPreferencesService.cs +++ b/src/Blazor.Server.UI/Services/UserPreferences/UserPreferencesService.cs @@ -5,7 +5,7 @@ using System.Security.Cryptography; using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage; -namespace Blazor.Server.UI.Services; +namespace Blazor.Server.UI.Services.UserPreferences; public interface IUserPreferencesService { @@ -13,13 +13,13 @@ public interface IUserPreferencesService /// Saves UserPreferences in local storage /// /// The userPreferences to save in the local storage - public Task SaveUserPreferences(UserPreferences userPreferences); + public Task SaveUserPreferences(Services.UserPreferences.UserPreferences userPreferences); /// /// Loads UserPreferences in local storage /// /// UserPreferences object. Null when no settings were found. - public Task LoadUserPreferences(); + public Task LoadUserPreferences(); } public class UserPreferencesService : IUserPreferencesService @@ -32,26 +32,26 @@ public UserPreferencesService(ProtectedLocalStorage localStorage) _localStorage = localStorage; } - public async Task SaveUserPreferences(UserPreferences userPreferences) + public async Task SaveUserPreferences(Services.UserPreferences.UserPreferences userPreferences) { await _localStorage.SetAsync(Key, userPreferences); } - public async Task LoadUserPreferences() + public async Task LoadUserPreferences() { try { - var result = await _localStorage.GetAsync(Key); + var result = await _localStorage.GetAsync(Key); if (result.Success && result.Value is not null) { return result.Value; } - return new UserPreferences(); + return new Services.UserPreferences.UserPreferences(); } catch (CryptographicException) { await _localStorage.DeleteAsync(Key); - return new UserPreferences(); + return new Services.UserPreferences.UserPreferences(); } } diff --git a/src/Blazor.Server.UI/Shared/MainLayout.razor b/src/Blazor.Server.UI/Shared/MainLayout.razor index a3f5443a7..9287a54d6 100644 --- a/src/Blazor.Server.UI/Shared/MainLayout.razor +++ b/src/Blazor.Server.UI/Shared/MainLayout.razor @@ -1,10 +1,10 @@ @inherits LayoutComponentBase @inject IStringLocalizer L - + - + @@ -23,10 +23,10 @@ + UserPreferences="_userPreferences" + UserPreferencesChanged="LayoutService.UpdateUserPreferences" /> diff --git a/src/Blazor.Server.UI/Shared/MainLayout.razor.cs b/src/Blazor.Server.UI/Shared/MainLayout.razor.cs index 5e6578a81..898d0e835 100644 --- a/src/Blazor.Server.UI/Shared/MainLayout.razor.cs +++ b/src/Blazor.Server.UI/Shared/MainLayout.razor.cs @@ -1,5 +1,6 @@ using Blazor.Server.UI.Components.Shared; using Blazor.Server.UI.Services; +using Blazor.Server.UI.Services.UserPreferences; using Toolbelt.Blazor.HotKeys2; namespace Blazor.Server.UI.Shared; @@ -9,21 +10,21 @@ public partial class MainLayout : LayoutComponentBase, IDisposable private bool _commandPaletteOpen; private HotKeysContext? _hotKeysContext; private bool _sideMenuDrawerOpen = true; - private UserPreferences UserPreferences = new(); + private UserPreferences _userPreferences = new(); [Inject] - private LayoutService _layoutService { get; set; } = null!; + private LayoutService LayoutService { get; set; } = null!; private MudThemeProvider _mudThemeProvider=null!; private bool _themingDrawerOpen; private bool _defaultDarkMode; [Inject] private IDialogService _dialogService { get; set; } = default!; - [Inject] private HotKeys _hotKeys { get; set; } = default!; + [Inject] private HotKeys HotKeys { get; set; } = default!; public void Dispose() { - _layoutService.MajorUpdateOccured -= LayoutServiceOnMajorUpdateOccured; + LayoutService.MajorUpdateOccured -= LayoutServiceOnMajorUpdateOccured; _hotKeysContext?.Dispose(); GC.SuppressFinalize(this); } @@ -41,19 +42,19 @@ protected override async Task OnAfterRenderAsync(bool firstRender) private async Task ApplyUserPreferences() { _defaultDarkMode =await _mudThemeProvider.GetSystemPreference(); - UserPreferences = await _layoutService.ApplyUserPreferences(_defaultDarkMode); + _userPreferences = await LayoutService.ApplyUserPreferences(_defaultDarkMode); } protected override void OnInitialized() { - _layoutService.MajorUpdateOccured += LayoutServiceOnMajorUpdateOccured; - _layoutService.SetBaseTheme(Theme.ApplicationTheme()); - _hotKeysContext = _hotKeys.CreateContext().Add(ModKey.Ctrl, Key.K, async () => await OpenCommandPalette(), "Open command palette."); + LayoutService.MajorUpdateOccured += LayoutServiceOnMajorUpdateOccured; + LayoutService.SetBaseTheme(Theme.Theme.ApplicationTheme()); + _hotKeysContext = HotKeys.CreateContext().Add(ModKey.Ctrl, Key.K, async () => await OpenCommandPalette(), "Open command palette."); } private async Task OnSystemPreferenceChanged(bool newValue) { - await _layoutService.OnSystemPreferenceChanged(newValue); + await LayoutService.OnSystemPreferenceChanged(newValue); } private void LayoutServiceOnMajorUpdateOccured(object? sender, EventArgs e) => StateHasChanged(); diff --git a/src/Blazor.Server.UI/Shared/UserLoginState.razor b/src/Blazor.Server.UI/Shared/UserLoginState.razor index a38297e5b..1b1ea9f2a 100644 --- a/src/Blazor.Server.UI/Shared/UserLoginState.razor +++ b/src/Blazor.Server.UI/Shared/UserLoginState.razor @@ -4,17 +4,17 @@ public void Dispose() { - _client.Login -= _client_Login; - _client.Logout -= _client_Logout; + Client.Login -= _client_Login; + Client.Logout -= _client_Logout; } [Inject] - private HubClient _client { get; set; } = default!; + private HubClient Client { get; set; } = default!; protected override async Task OnInitializedAsync() { - _client.Login += _client_Login; - _client.Logout += _client_Logout; - await _client.StartAsync().ConfigureAwait(false); + Client.Login += _client_Login; + Client.Logout += _client_Logout; + await Client.StartAsync().ConfigureAwait(false); } private void _client_Login(object? sender, string username) diff --git a/src/Blazor.Server.UI/Theme/DefaultTheme.cs b/src/Blazor.Server.UI/Theme/DefaultTheme.cs index 6b5c7d4ed..8945d8c25 100644 --- a/src/Blazor.Server.UI/Theme/DefaultTheme.cs +++ b/src/Blazor.Server.UI/Theme/DefaultTheme.cs @@ -1,4 +1,4 @@ -namespace Blazor.Server.UI; +namespace Blazor.Server.UI.Theme; public class Theme { From 344a19c0ed4dd94aac7cf09c22a0d6b4e26b8593 Mon Sep 17 00:00:00 2001 From: Bram1903 <70259613+Bram1903@users.noreply.github.com> Date: Mon, 24 Apr 2023 22:38:20 +0200 Subject: [PATCH 4/7] Fixed: Namespace namings (Refactored: Domain) --- .../Common/Interfaces/IApplicationDbContext.cs | 1 + src/Application/Common/Models/UploadRequest.cs | 2 ++ .../Features/AuditTrails/DTOs/AuditTrailDto.cs | 1 + .../PaginationQuery/AuditTrailsWithPaginationQuery.cs | 1 + .../Commands/AddEdit/AddEditDocumentCommand.cs | 1 + .../Commands/Upload/UploadDocumentCommand.cs | 1 + .../Features/Documents/DTOs/DocumentDto.cs | 1 + .../EventHandlers/DocumentDeletedEventHandler.cs | 2 ++ .../Commands/AddEdit/AddEditKeyValueCommand.cs | 1 + .../Commands/Import/ImportKeyValuesCommand.cs | 1 + .../Features/KeyValues/DTOs/KeyValueDto.cs | 2 ++ .../KeyValues/Queries/ByName/KeyValuesQueryByName.cs | 1 + .../PaginationQuery/KeyValuesWithPaginationQuery.cs | 1 + src/Application/Features/Loggers/DTOs/LogDto.cs | 2 ++ .../Products/Queries/Export/ExportProductsQuery.cs | 1 + src/Application/_Imports.cs | 1 - .../Components/Common/PicklistAutocomplete.cs | 2 ++ src/Blazor.Server.UI/Pages/Documents/Documents.razor | 1 + .../Pages/Documents/_DocumentFormDialog.razor | 1 + .../Pages/Documents/_UploadFilesFormDialog.razor | 1 + .../Pages/Identity/Users/Profile.razor.cs | 1 + .../Pages/Identity/Users/_UserForm.razor | 1 + .../Products/AdvancedSearchProductsComponent.razor | 1 + src/Blazor.Server.UI/Pages/Products/Products.razor | 1 + .../Pages/Products/_ProductFormDialog.razor | 1 + .../Pages/SystemManagement/AuditTrails.razor | 1 + .../Pages/SystemManagement/Dictionaries.razor | 1 + src/Domain/Entities/Audit/AuditTrail.cs | 1 + src/Domain/Entities/Document.cs | 2 ++ src/Domain/Entities/KeyValue.cs | 2 ++ src/Domain/Entities/Logger/Logger.cs | 2 +- src/Domain/Enums/AuditType.cs | 2 +- src/Domain/Enums/DocumentType.cs | 2 +- src/Domain/Enums/ExportType.cs | 2 +- src/Domain/Enums/JobStatus.cs | 2 +- src/Domain/Enums/PartnerType.cs | 2 +- src/Domain/Enums/Picklist.cs | 2 +- src/Domain/Enums/TrackingState.cs | 2 +- src/Domain/Enums/UploadType.cs | 2 +- .../Persistence/ApplicationDbContext.cs | 1 + .../Persistence/ApplicationDbContextInitialiser.cs | 1 + .../AuditableEntitySaveChangesInterceptor.cs | 1 + .../Services/PaddleOCR/DocumentOcrJob.cs | 1 + src/Infrastructure/_Imports.cs | 1 - .../KeyValues/Commands/AddEditKeyValueCommandTests.cs | 11 ++++++----- .../KeyValues/Commands/DeleteKeyValueTests.cs | 1 + .../KeyValues/Queries/KeyValuesQueryTests.cs | 1 + .../Queries/KeyValuesWithPaginationQueryTests.cs | 11 ++++++----- .../Services/PicklistServiceTests.cs | 11 ++++++----- 49 files changed, 69 insertions(+), 26 deletions(-) diff --git a/src/Application/Common/Interfaces/IApplicationDbContext.cs b/src/Application/Common/Interfaces/IApplicationDbContext.cs index 9cb28c2ef..4291015fb 100644 --- a/src/Application/Common/Interfaces/IApplicationDbContext.cs +++ b/src/Application/Common/Interfaces/IApplicationDbContext.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. +using CleanArchitecture.Blazor.Domain.Entities.Logger; using Microsoft.EntityFrameworkCore.ChangeTracking; namespace CleanArchitecture.Blazor.Application.Common.Interfaces; diff --git a/src/Application/Common/Models/UploadRequest.cs b/src/Application/Common/Models/UploadRequest.cs index a14b48237..b749a4421 100644 --- a/src/Application/Common/Models/UploadRequest.cs +++ b/src/Application/Common/Models/UploadRequest.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using CleanArchitecture.Blazor.Domain.Enums; + namespace CleanArchitecture.Blazor.Application.Common.Models; public class UploadRequest diff --git a/src/Application/Features/AuditTrails/DTOs/AuditTrailDto.cs b/src/Application/Features/AuditTrails/DTOs/AuditTrailDto.cs index ce974630d..077b6e7e1 100644 --- a/src/Application/Features/AuditTrails/DTOs/AuditTrailDto.cs +++ b/src/Application/Features/AuditTrails/DTOs/AuditTrailDto.cs @@ -3,6 +3,7 @@ using CleanArchitecture.Blazor.Application.Common.Interfaces.Serialization; using CleanArchitecture.Blazor.Application.Features.Identity.Dto; +using CleanArchitecture.Blazor.Domain.Enums; namespace CleanArchitecture.Blazor.Application.Features.AuditTrails.DTOs; [Description("Audit Trails")] diff --git a/src/Application/Features/AuditTrails/Queries/PaginationQuery/AuditTrailsWithPaginationQuery.cs b/src/Application/Features/AuditTrails/Queries/PaginationQuery/AuditTrailsWithPaginationQuery.cs index 1a52655d3..49de8ad6d 100644 --- a/src/Application/Features/AuditTrails/Queries/PaginationQuery/AuditTrailsWithPaginationQuery.cs +++ b/src/Application/Features/AuditTrails/Queries/PaginationQuery/AuditTrailsWithPaginationQuery.cs @@ -3,6 +3,7 @@ using CleanArchitecture.Blazor.Application.Features.AuditTrails.Caching; using CleanArchitecture.Blazor.Application.Features.AuditTrails.DTOs; +using CleanArchitecture.Blazor.Domain.Enums; namespace CleanArchitecture.Blazor.Application.Features.AuditTrails.Queries.PaginationQuery; diff --git a/src/Application/Features/Documents/Commands/AddEdit/AddEditDocumentCommand.cs b/src/Application/Features/Documents/Commands/AddEdit/AddEditDocumentCommand.cs index e6bf21040..37869a5de 100644 --- a/src/Application/Features/Documents/Commands/AddEdit/AddEditDocumentCommand.cs +++ b/src/Application/Features/Documents/Commands/AddEdit/AddEditDocumentCommand.cs @@ -4,6 +4,7 @@ using CleanArchitecture.Blazor.Application.Common.ExceptionHandlers; using CleanArchitecture.Blazor.Application.Features.Documents.Caching; using CleanArchitecture.Blazor.Application.Features.Documents.DTOs; +using CleanArchitecture.Blazor.Domain.Enums; namespace CleanArchitecture.Blazor.Application.Features.Documents.Commands.AddEdit; diff --git a/src/Application/Features/Documents/Commands/Upload/UploadDocumentCommand.cs b/src/Application/Features/Documents/Commands/Upload/UploadDocumentCommand.cs index d65a33f89..30d09a34f 100644 --- a/src/Application/Features/Documents/Commands/Upload/UploadDocumentCommand.cs +++ b/src/Application/Features/Documents/Commands/Upload/UploadDocumentCommand.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using CleanArchitecture.Blazor.Application.Features.Documents.Caching; +using CleanArchitecture.Blazor.Domain.Enums; namespace CleanArchitecture.Blazor.Application.Features.Documents.Commands.Upload; diff --git a/src/Application/Features/Documents/DTOs/DocumentDto.cs b/src/Application/Features/Documents/DTOs/DocumentDto.cs index a8df58ce6..6b6549993 100644 --- a/src/Application/Features/Documents/DTOs/DocumentDto.cs +++ b/src/Application/Features/Documents/DTOs/DocumentDto.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using CleanArchitecture.Blazor.Application.Features.Identity.Dto; +using CleanArchitecture.Blazor.Domain.Enums; namespace CleanArchitecture.Blazor.Application.Features.Documents.DTOs; [Description("Documents")] diff --git a/src/Application/Features/Documents/EventHandlers/DocumentDeletedEventHandler.cs b/src/Application/Features/Documents/EventHandlers/DocumentDeletedEventHandler.cs index 1ebd6ace2..9b5bba617 100644 --- a/src/Application/Features/Documents/EventHandlers/DocumentDeletedEventHandler.cs +++ b/src/Application/Features/Documents/EventHandlers/DocumentDeletedEventHandler.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. +using CleanArchitecture.Blazor.Domain.Enums; + namespace CleanArchitecture.Blazor.Application.Features.Documents.EventHandlers; public class DocumentDeletedEventHandler : INotificationHandler> diff --git a/src/Application/Features/KeyValues/Commands/AddEdit/AddEditKeyValueCommand.cs b/src/Application/Features/KeyValues/Commands/AddEdit/AddEditKeyValueCommand.cs index 91ace9b2e..047b1da83 100644 --- a/src/Application/Features/KeyValues/Commands/AddEdit/AddEditKeyValueCommand.cs +++ b/src/Application/Features/KeyValues/Commands/AddEdit/AddEditKeyValueCommand.cs @@ -4,6 +4,7 @@ using CleanArchitecture.Blazor.Application.Common.ExceptionHandlers; using CleanArchitecture.Blazor.Application.Features.KeyValues.Caching; using CleanArchitecture.Blazor.Application.Features.KeyValues.DTOs; +using CleanArchitecture.Blazor.Domain.Enums; namespace CleanArchitecture.Blazor.Application.Features.KeyValues.Commands.AddEdit; diff --git a/src/Application/Features/KeyValues/Commands/Import/ImportKeyValuesCommand.cs b/src/Application/Features/KeyValues/Commands/Import/ImportKeyValuesCommand.cs index f6a961dca..2f7c8f40e 100644 --- a/src/Application/Features/KeyValues/Commands/Import/ImportKeyValuesCommand.cs +++ b/src/Application/Features/KeyValues/Commands/Import/ImportKeyValuesCommand.cs @@ -3,6 +3,7 @@ using CleanArchitecture.Blazor.Application.Features.KeyValues.Caching; using CleanArchitecture.Blazor.Application.Features.KeyValues.Commands.AddEdit; +using CleanArchitecture.Blazor.Domain.Enums; namespace CleanArchitecture.Blazor.Application.Features.KeyValues.Commands.Import; diff --git a/src/Application/Features/KeyValues/DTOs/KeyValueDto.cs b/src/Application/Features/KeyValues/DTOs/KeyValueDto.cs index 3c0baf2c3..b9155b740 100644 --- a/src/Application/Features/KeyValues/DTOs/KeyValueDto.cs +++ b/src/Application/Features/KeyValues/DTOs/KeyValueDto.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using CleanArchitecture.Blazor.Domain.Enums; + namespace CleanArchitecture.Blazor.Application.Features.KeyValues.DTOs; [Description("Picklist")] diff --git a/src/Application/Features/KeyValues/Queries/ByName/KeyValuesQueryByName.cs b/src/Application/Features/KeyValues/Queries/ByName/KeyValuesQueryByName.cs index 127d471b7..0fc09ec3c 100644 --- a/src/Application/Features/KeyValues/Queries/ByName/KeyValuesQueryByName.cs +++ b/src/Application/Features/KeyValues/Queries/ByName/KeyValuesQueryByName.cs @@ -3,6 +3,7 @@ using CleanArchitecture.Blazor.Application.Features.KeyValues.Caching; using CleanArchitecture.Blazor.Application.Features.KeyValues.DTOs; +using CleanArchitecture.Blazor.Domain.Enums; namespace CleanArchitecture.Blazor.Application.Features.KeyValues.Queries.ByName; diff --git a/src/Application/Features/KeyValues/Queries/PaginationQuery/KeyValuesWithPaginationQuery.cs b/src/Application/Features/KeyValues/Queries/PaginationQuery/KeyValuesWithPaginationQuery.cs index 0766c9b67..f0906ed3a 100644 --- a/src/Application/Features/KeyValues/Queries/PaginationQuery/KeyValuesWithPaginationQuery.cs +++ b/src/Application/Features/KeyValues/Queries/PaginationQuery/KeyValuesWithPaginationQuery.cs @@ -3,6 +3,7 @@ using CleanArchitecture.Blazor.Application.Features.KeyValues.Caching; using CleanArchitecture.Blazor.Application.Features.KeyValues.DTOs; +using CleanArchitecture.Blazor.Domain.Enums; namespace CleanArchitecture.Blazor.Application.Features.KeyValues.Queries.PaginationQuery; diff --git a/src/Application/Features/Loggers/DTOs/LogDto.cs b/src/Application/Features/Loggers/DTOs/LogDto.cs index 6287f5c20..166f35cbf 100644 --- a/src/Application/Features/Loggers/DTOs/LogDto.cs +++ b/src/Application/Features/Loggers/DTOs/LogDto.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using CleanArchitecture.Blazor.Domain.Entities.Logger; + namespace CleanArchitecture.Blazor.Application.Features.Loggers.DTOs; public class LogDto : IMapFrom diff --git a/src/Application/Features/Products/Queries/Export/ExportProductsQuery.cs b/src/Application/Features/Products/Queries/Export/ExportProductsQuery.cs index d2a44b88a..d42d0a7d6 100644 --- a/src/Application/Features/Products/Queries/Export/ExportProductsQuery.cs +++ b/src/Application/Features/Products/Queries/Export/ExportProductsQuery.cs @@ -4,6 +4,7 @@ using CleanArchitecture.Blazor.Application.Common.Interfaces.Serialization; using CleanArchitecture.Blazor.Application.Features.Products.DTOs; +using CleanArchitecture.Blazor.Domain.Enums; namespace CleanArchitecture.Blazor.Application.Features.Products.Queries.Export; diff --git a/src/Application/_Imports.cs b/src/Application/_Imports.cs index dea933f64..d1c9e64f1 100644 --- a/src/Application/_Imports.cs +++ b/src/Application/_Imports.cs @@ -25,7 +25,6 @@ global using CleanArchitecture.Blazor.Application.Common.Interfaces; global using CleanArchitecture.Blazor.Application.Common.Interfaces.Caching; global using CleanArchitecture.Blazor.Domain.Entities.Audit; -global using CleanArchitecture.Blazor.Domain.Entities.Log; global using CleanArchitecture.Blazor.Application.Common.Specification; global using AutoFilterer.Attributes; global using AutoFilterer.Enums; diff --git a/src/Blazor.Server.UI/Components/Common/PicklistAutocomplete.cs b/src/Blazor.Server.UI/Components/Common/PicklistAutocomplete.cs index 611569152..e0299cb76 100644 --- a/src/Blazor.Server.UI/Components/Common/PicklistAutocomplete.cs +++ b/src/Blazor.Server.UI/Components/Common/PicklistAutocomplete.cs @@ -1,3 +1,5 @@ +using CleanArchitecture.Blazor.Domain.Enums; + namespace Blazor.Server.UI.Components.Common; public class PicklistAutocomplete : MudAutocomplete diff --git a/src/Blazor.Server.UI/Pages/Documents/Documents.razor b/src/Blazor.Server.UI/Pages/Documents/Documents.razor index d36c2b451..86f7e0b92 100644 --- a/src/Blazor.Server.UI/Pages/Documents/Documents.razor +++ b/src/Blazor.Server.UI/Pages/Documents/Documents.razor @@ -12,6 +12,7 @@ @using CleanArchitecture.Blazor.Application.Features.Documents.Commands.Delete @using Blazor.Server.UI.Services.JsInterop @using CleanArchitecture.Blazor.Application.Constants.Permission +@using CleanArchitecture.Blazor.Domain.Enums @implements IDisposable @attribute [Authorize(Policy = Permissions.Documents.View)] @Title diff --git a/src/Blazor.Server.UI/Pages/Documents/_DocumentFormDialog.razor b/src/Blazor.Server.UI/Pages/Documents/_DocumentFormDialog.razor index 7e1ca6fa7..209fce91c 100644 --- a/src/Blazor.Server.UI/Pages/Documents/_DocumentFormDialog.razor +++ b/src/Blazor.Server.UI/Pages/Documents/_DocumentFormDialog.razor @@ -1,4 +1,5 @@ @using CleanArchitecture.Blazor.Application.Features.Documents.Commands.AddEdit +@using CleanArchitecture.Blazor.Domain.Enums @inherits MudComponentBase @inject IStringLocalizer L diff --git a/src/Blazor.Server.UI/Pages/Documents/_UploadFilesFormDialog.razor b/src/Blazor.Server.UI/Pages/Documents/_UploadFilesFormDialog.razor index 56fd91f74..06db5ad84 100644 --- a/src/Blazor.Server.UI/Pages/Documents/_UploadFilesFormDialog.razor +++ b/src/Blazor.Server.UI/Pages/Documents/_UploadFilesFormDialog.razor @@ -1,6 +1,7 @@ @using CleanArchitecture.Blazor.Application.Features.Documents.Commands.AddEdit @using CleanArchitecture.Blazor.Application.Features.Documents.Commands.Upload @using Blazor.Server.UI.Services.JsInterop +@using CleanArchitecture.Blazor.Domain.Enums @inherits MudComponentBase @inject IStringLocalizer L diff --git a/src/Blazor.Server.UI/Pages/Identity/Users/Profile.razor.cs b/src/Blazor.Server.UI/Pages/Identity/Users/Profile.razor.cs index c49d71d2a..df816ae0d 100644 --- a/src/Blazor.Server.UI/Pages/Identity/Users/Profile.razor.cs +++ b/src/Blazor.Server.UI/Pages/Identity/Users/Profile.razor.cs @@ -1,6 +1,7 @@ using Blazor.Server.UI.Services.JsInterop; using CleanArchitecture.Blazor.Application.Common.Interfaces.Identity; using CleanArchitecture.Blazor.Application.Features.Identity.Notification; +using CleanArchitecture.Blazor.Domain.Enums; using Microsoft.AspNetCore.Components.Authorization; using Microsoft.AspNetCore.Components.Forms; using Microsoft.AspNetCore.Identity; diff --git a/src/Blazor.Server.UI/Pages/Identity/Users/_UserForm.razor b/src/Blazor.Server.UI/Pages/Identity/Users/_UserForm.razor index 25da26308..e3e36ce14 100644 --- a/src/Blazor.Server.UI/Pages/Identity/Users/_UserForm.razor +++ b/src/Blazor.Server.UI/Pages/Identity/Users/_UserForm.razor @@ -1,5 +1,6 @@ @using CleanArchitecture.Blazor.Application.Common.Interfaces.MultiTenant @using CleanArchitecture.Blazor.Application.Features.Identity.Dto +@using CleanArchitecture.Blazor.Domain.Enums @inherits MudComponentBase @inject IStringLocalizer L diff --git a/src/Blazor.Server.UI/Pages/Products/AdvancedSearchProductsComponent.razor b/src/Blazor.Server.UI/Pages/Products/AdvancedSearchProductsComponent.razor index fe91a02a8..f4c3ba711 100644 --- a/src/Blazor.Server.UI/Pages/Products/AdvancedSearchProductsComponent.razor +++ b/src/Blazor.Server.UI/Pages/Products/AdvancedSearchProductsComponent.razor @@ -1,4 +1,5 @@ @using CleanArchitecture.Blazor.Application.Features.Products.Queries.Pagination +@using CleanArchitecture.Blazor.Domain.Enums @inject IStringLocalizer L L diff --git a/src/Blazor.Server.UI/Pages/Products/_ProductFormDialog.razor b/src/Blazor.Server.UI/Pages/Products/_ProductFormDialog.razor index eb3cc1c73..6e6688d1a 100644 --- a/src/Blazor.Server.UI/Pages/Products/_ProductFormDialog.razor +++ b/src/Blazor.Server.UI/Pages/Products/_ProductFormDialog.razor @@ -1,4 +1,5 @@ @using CleanArchitecture.Blazor.Application.Features.Products.Commands.AddEdit +@using CleanArchitecture.Blazor.Domain.Enums @inherits MudComponentBase @inject IJSRuntime JS @inject IStringLocalizer L diff --git a/src/Blazor.Server.UI/Pages/SystemManagement/AuditTrails.razor b/src/Blazor.Server.UI/Pages/SystemManagement/AuditTrails.razor index eb56f60e3..f62ccb230 100644 --- a/src/Blazor.Server.UI/Pages/SystemManagement/AuditTrails.razor +++ b/src/Blazor.Server.UI/Pages/SystemManagement/AuditTrails.razor @@ -3,6 +3,7 @@ @using CleanArchitecture.Blazor.Application.Features.AuditTrails.Queries.PaginationQuery @using CleanArchitecture.Blazor.Application.Features.AuditTrails.Caching @using CleanArchitecture.Blazor.Application.Constants.Permission +@using CleanArchitecture.Blazor.Domain.Enums @attribute [Authorize(Policy = Permissions.AuditTrails.View)] diff --git a/src/Blazor.Server.UI/Pages/SystemManagement/Dictionaries.razor b/src/Blazor.Server.UI/Pages/SystemManagement/Dictionaries.razor index 8ee58f87a..3f8449310 100644 --- a/src/Blazor.Server.UI/Pages/SystemManagement/Dictionaries.razor +++ b/src/Blazor.Server.UI/Pages/SystemManagement/Dictionaries.razor @@ -8,6 +8,7 @@ @using CleanArchitecture.Blazor.Application.Features.KeyValues.Commands.AddEdit @using CleanArchitecture.Blazor.Application.Features.KeyValues.Commands.Delete @using CleanArchitecture.Blazor.Application.Features.KeyValues.Commands.Import +@using CleanArchitecture.Blazor.Domain.Enums @attribute [Authorize(Policy = Permissions.Dictionaries.View)] @inject IStringLocalizer L diff --git a/src/Domain/Entities/Audit/AuditTrail.cs b/src/Domain/Entities/Audit/AuditTrail.cs index 0d0f6ee57..d0b934f0b 100644 --- a/src/Domain/Entities/Audit/AuditTrail.cs +++ b/src/Domain/Entities/Audit/AuditTrail.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using CleanArchitecture.Blazor.Domain.Enums; using CleanArchitecture.Blazor.Domain.Identity; using Microsoft.EntityFrameworkCore.ChangeTracking; diff --git a/src/Domain/Entities/Document.cs b/src/Domain/Entities/Document.cs index 13971aa8d..bcae97678 100644 --- a/src/Domain/Entities/Document.cs +++ b/src/Domain/Entities/Document.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using CleanArchitecture.Blazor.Domain.Enums; + namespace CleanArchitecture.Blazor.Domain.Entities; public class Document : OwnerPropertyEntity, IMayHaveTenant, IAuditTrial diff --git a/src/Domain/Entities/KeyValue.cs b/src/Domain/Entities/KeyValue.cs index a30dc97b6..3ee19c403 100644 --- a/src/Domain/Entities/KeyValue.cs +++ b/src/Domain/Entities/KeyValue.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using CleanArchitecture.Blazor.Domain.Enums; + namespace CleanArchitecture.Blazor.Domain.Entities; public class KeyValue : BaseAuditableEntity, IAuditTrial diff --git a/src/Domain/Entities/Logger/Logger.cs b/src/Domain/Entities/Logger/Logger.cs index 57bf6b60e..fd45fabec 100644 --- a/src/Domain/Entities/Logger/Logger.cs +++ b/src/Domain/Entities/Logger/Logger.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace CleanArchitecture.Blazor.Domain.Entities.Log; +namespace CleanArchitecture.Blazor.Domain.Entities.Logger; public class Logger : IEntity { diff --git a/src/Domain/Enums/AuditType.cs b/src/Domain/Enums/AuditType.cs index a2c61083d..c97fe64d0 100644 --- a/src/Domain/Enums/AuditType.cs +++ b/src/Domain/Enums/AuditType.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace CleanArchitecture.Blazor.Domain; +namespace CleanArchitecture.Blazor.Domain.Enums; public enum AuditType { diff --git a/src/Domain/Enums/DocumentType.cs b/src/Domain/Enums/DocumentType.cs index bd22fe32f..51573c3b8 100644 --- a/src/Domain/Enums/DocumentType.cs +++ b/src/Domain/Enums/DocumentType.cs @@ -1,4 +1,4 @@ -namespace CleanArchitecture.Blazor.Domain; +namespace CleanArchitecture.Blazor.Domain.Enums; public enum DocumentType { Document, diff --git a/src/Domain/Enums/ExportType.cs b/src/Domain/Enums/ExportType.cs index a5fc1c10b..ba415e2de 100644 --- a/src/Domain/Enums/ExportType.cs +++ b/src/Domain/Enums/ExportType.cs @@ -1,4 +1,4 @@ -namespace CleanArchitecture.Blazor.Domain; +namespace CleanArchitecture.Blazor.Domain.Enums; public enum ExportType { Excel, diff --git a/src/Domain/Enums/JobStatus.cs b/src/Domain/Enums/JobStatus.cs index cb90cb1e5..a6c2dc6d0 100644 --- a/src/Domain/Enums/JobStatus.cs +++ b/src/Domain/Enums/JobStatus.cs @@ -1,4 +1,4 @@ -namespace CleanArchitecture.Blazor.Domain; +namespace CleanArchitecture.Blazor.Domain.Enums; public enum JobStatus { NotStart, diff --git a/src/Domain/Enums/PartnerType.cs b/src/Domain/Enums/PartnerType.cs index c0e9aecf6..e6a833cea 100644 --- a/src/Domain/Enums/PartnerType.cs +++ b/src/Domain/Enums/PartnerType.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace CleanArchitecture.Blazor.Domain; +namespace CleanArchitecture.Blazor.Domain.Enums; public enum PartnerType { diff --git a/src/Domain/Enums/Picklist.cs b/src/Domain/Enums/Picklist.cs index b24ce64f0..a31db138d 100644 --- a/src/Domain/Enums/Picklist.cs +++ b/src/Domain/Enums/Picklist.cs @@ -3,7 +3,7 @@ using System.ComponentModel; -namespace CleanArchitecture.Blazor.Domain; +namespace CleanArchitecture.Blazor.Domain.Enums; public enum Picklist { diff --git a/src/Domain/Enums/TrackingState.cs b/src/Domain/Enums/TrackingState.cs index 4d8eeb7fa..00776bf5f 100644 --- a/src/Domain/Enums/TrackingState.cs +++ b/src/Domain/Enums/TrackingState.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace CleanArchitecture.Blazor.Domain; +namespace CleanArchitecture.Blazor.Domain.Enums; public enum TrackingState { diff --git a/src/Domain/Enums/UploadType.cs b/src/Domain/Enums/UploadType.cs index 659e60660..3c5f81713 100644 --- a/src/Domain/Enums/UploadType.cs +++ b/src/Domain/Enums/UploadType.cs @@ -3,7 +3,7 @@ using System.ComponentModel; -namespace CleanArchitecture.Blazor.Domain; +namespace CleanArchitecture.Blazor.Domain.Enums; public enum UploadType : byte { diff --git a/src/Infrastructure/Persistence/ApplicationDbContext.cs b/src/Infrastructure/Persistence/ApplicationDbContext.cs index 9c8fb2668..98bc2a505 100644 --- a/src/Infrastructure/Persistence/ApplicationDbContext.cs +++ b/src/Infrastructure/Persistence/ApplicationDbContext.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Reflection; +using CleanArchitecture.Blazor.Domain.Entities.Logger; using CleanArchitecture.Blazor.Infrastructure.Persistence.Interceptors; namespace CleanArchitecture.Blazor.Infrastructure.Persistence; diff --git a/src/Infrastructure/Persistence/ApplicationDbContextInitialiser.cs b/src/Infrastructure/Persistence/ApplicationDbContextInitialiser.cs index e473f6d10..517b94104 100644 --- a/src/Infrastructure/Persistence/ApplicationDbContextInitialiser.cs +++ b/src/Infrastructure/Persistence/ApplicationDbContextInitialiser.cs @@ -3,6 +3,7 @@ using CleanArchitecture.Blazor.Application.Constants.Permission; using CleanArchitecture.Blazor.Application.Constants.Role; using CleanArchitecture.Blazor.Application.Constants.User; +using CleanArchitecture.Blazor.Domain.Enums; namespace CleanArchitecture.Blazor.Infrastructure.Persistence; public class ApplicationDbContextInitialiser diff --git a/src/Infrastructure/Persistence/Interceptors/AuditableEntitySaveChangesInterceptor.cs b/src/Infrastructure/Persistence/Interceptors/AuditableEntitySaveChangesInterceptor.cs index 76991b7ec..84dc80a9e 100644 --- a/src/Infrastructure/Persistence/Interceptors/AuditableEntitySaveChangesInterceptor.cs +++ b/src/Infrastructure/Persistence/Interceptors/AuditableEntitySaveChangesInterceptor.cs @@ -1,4 +1,5 @@ using CleanArchitecture.Blazor.Application.Common.Interfaces.MultiTenant; +using CleanArchitecture.Blazor.Domain.Enums; using CleanArchitecture.Blazor.Infrastructure.Extensions; using MediatR; using Microsoft.EntityFrameworkCore.ChangeTracking; diff --git a/src/Infrastructure/Services/PaddleOCR/DocumentOcrJob.cs b/src/Infrastructure/Services/PaddleOCR/DocumentOcrJob.cs index 3cebf8bd4..709405310 100644 --- a/src/Infrastructure/Services/PaddleOCR/DocumentOcrJob.cs +++ b/src/Infrastructure/Services/PaddleOCR/DocumentOcrJob.cs @@ -8,6 +8,7 @@ using CleanArchitecture.Blazor.Application.Common.Interfaces.Serialization; using CleanArchitecture.Blazor.Application.Features.Documents.Caching; using CleanArchitecture.Blazor.Application.Services.PaddleOCR; +using CleanArchitecture.Blazor.Domain.Enums; using CleanArchitecture.Blazor.Infrastructure.Hubs; using Microsoft.AspNetCore.SignalR; diff --git a/src/Infrastructure/_Imports.cs b/src/Infrastructure/_Imports.cs index db27afd60..07c02dbcf 100644 --- a/src/Infrastructure/_Imports.cs +++ b/src/Infrastructure/_Imports.cs @@ -13,7 +13,6 @@ global using CleanArchitecture.Blazor.Domain.Common; global using CleanArchitecture.Blazor.Domain.Entities; global using CleanArchitecture.Blazor.Domain.Entities.Audit; -global using CleanArchitecture.Blazor.Domain.Entities.Log; global using CleanArchitecture.Blazor.Infrastructure.Persistence.Extensions; global using CleanArchitecture.Blazor.Application.Common.Models; global using CleanArchitecture.Blazor.Application.Common.Interfaces; diff --git a/tests/Application.IntegrationTests/KeyValues/Commands/AddEditKeyValueCommandTests.cs b/tests/Application.IntegrationTests/KeyValues/Commands/AddEditKeyValueCommandTests.cs index 460120b28..da47f51a0 100644 --- a/tests/Application.IntegrationTests/KeyValues/Commands/AddEditKeyValueCommandTests.cs +++ b/tests/Application.IntegrationTests/KeyValues/Commands/AddEditKeyValueCommandTests.cs @@ -2,6 +2,7 @@ using CleanArchitecture.Application.IntegrationTests; using CleanArchitecture.Blazor.Application.Features.KeyValues.Commands.AddEdit; using CleanArchitecture.Blazor.Domain.Entities; +using CleanArchitecture.Blazor.Domain.Enums; using FluentAssertions; using NUnit.Framework; @@ -21,11 +22,11 @@ public void ShouldThrowValidationException() [Test] public async Task InsertItem() { - var addcommand = new AddEditKeyValueCommand() { Name= Domain.Picklist.Brand, Text="Test",Value="Test",Description= "Description" }; + var addcommand = new AddEditKeyValueCommand() { Name= Picklist.Brand, Text="Test",Value="Test",Description= "Description" }; var result = await SendAsync(addcommand); var find = await FindAsync(result.Data); find.Should().NotBeNull(); - find.Name.Should().Be(Domain.Picklist.Brand); + find.Name.Should().Be(Picklist.Brand); find.Text.Should().Be("Test"); find.Value.Should().Be("Test"); @@ -33,14 +34,14 @@ public async Task InsertItem() [Test] public async Task UpdateItem() { - var addcommand = new AddEditKeyValueCommand() { Name = Domain.Picklist.Brand, Text = "Test", Value = "Test", Description = "Description" }; + var addcommand = new AddEditKeyValueCommand() { Name = Picklist.Brand, Text = "Test", Value = "Test", Description = "Description" }; var result = await SendAsync(addcommand); var find = await FindAsync(result.Data); - var editcommand = new AddEditKeyValueCommand() { Id=find.Id, Name = Domain.Picklist.Brand, Text = "Test1", Value = "Test1", Description = "Description1" }; + var editcommand = new AddEditKeyValueCommand() { Id=find.Id, Name = Picklist.Brand, Text = "Test1", Value = "Test1", Description = "Description1" }; await SendAsync(editcommand); var updated = await FindAsync(find.Id); updated.Should().NotBeNull(); - updated.Name.Should().Be(Domain.Picklist.Brand); + updated.Name.Should().Be(Picklist.Brand); updated.Text.Should().Be("Test1"); updated.Value.Should().Be("Test1"); updated.Description.Should().Be("Description1"); diff --git a/tests/Application.IntegrationTests/KeyValues/Commands/DeleteKeyValueTests.cs b/tests/Application.IntegrationTests/KeyValues/Commands/DeleteKeyValueTests.cs index 47b073323..2e8901c6b 100644 --- a/tests/Application.IntegrationTests/KeyValues/Commands/DeleteKeyValueTests.cs +++ b/tests/Application.IntegrationTests/KeyValues/Commands/DeleteKeyValueTests.cs @@ -5,6 +5,7 @@ using CleanArchitecture.Blazor.Application.Features.KeyValues.Commands.Delete; using CleanArchitecture.Blazor.Domain; using CleanArchitecture.Blazor.Domain.Entities; +using CleanArchitecture.Blazor.Domain.Enums; using FluentAssertions; using NUnit.Framework; diff --git a/tests/Application.IntegrationTests/KeyValues/Queries/KeyValuesQueryTests.cs b/tests/Application.IntegrationTests/KeyValues/Queries/KeyValuesQueryTests.cs index 708fa32f4..5bf1d9a1f 100644 --- a/tests/Application.IntegrationTests/KeyValues/Queries/KeyValuesQueryTests.cs +++ b/tests/Application.IntegrationTests/KeyValues/Queries/KeyValuesQueryTests.cs @@ -3,6 +3,7 @@ using CleanArchitecture.Blazor.Application.Features.KeyValues.Queries.ByName; using CleanArchitecture.Blazor.Domain; +using CleanArchitecture.Blazor.Domain.Enums; using FluentAssertions; using NUnit.Framework; diff --git a/tests/Application.IntegrationTests/KeyValues/Queries/KeyValuesWithPaginationQueryTests.cs b/tests/Application.IntegrationTests/KeyValues/Queries/KeyValuesWithPaginationQueryTests.cs index 642327a2f..4679d5bad 100644 --- a/tests/Application.IntegrationTests/KeyValues/Queries/KeyValuesWithPaginationQueryTests.cs +++ b/tests/Application.IntegrationTests/KeyValues/Queries/KeyValuesWithPaginationQueryTests.cs @@ -2,6 +2,7 @@ using CleanArchitecture.Application.IntegrationTests; using CleanArchitecture.Blazor.Application.Features.KeyValues.Queries.PaginationQuery; using CleanArchitecture.Blazor.Domain.Entities; +using CleanArchitecture.Blazor.Domain.Enums; using NUnit.Framework; namespace CleanArchitecture.Blazor.Application.IntegrationTests.KeyValues.Queries; @@ -11,11 +12,11 @@ internal class KeyValuesWithPaginationQueryTests: TestBase [SetUp] public async Task initData() { - await AddAsync(new KeyValue() { Name = Domain.Picklist.Brand, Text = "Text1", Value = "Value1" ,Description= "Test Description" }); - await AddAsync(new KeyValue() { Name = Domain.Picklist.Brand, Text = "Text2", Value = "Value2", Description = "Test Description" }); - await AddAsync(new KeyValue() { Name = Domain.Picklist.Brand, Text = "Text3", Value = "Value3", Description = "Test Description" }); - await AddAsync(new KeyValue() { Name = Domain.Picklist.Brand, Text = "Text4", Value = "Value4", Description = "Test Description" }); - await AddAsync(new KeyValue() { Name = Domain.Picklist.Brand, Text = "Text5", Value = "Value5", Description = "Test Description" }); + await AddAsync(new KeyValue() { Name = Picklist.Brand, Text = "Text1", Value = "Value1" ,Description= "Test Description" }); + await AddAsync(new KeyValue() { Name = Picklist.Brand, Text = "Text2", Value = "Value2", Description = "Test Description" }); + await AddAsync(new KeyValue() { Name = Picklist.Brand, Text = "Text3", Value = "Value3", Description = "Test Description" }); + await AddAsync(new KeyValue() { Name = Picklist.Brand, Text = "Text4", Value = "Value4", Description = "Test Description" }); + await AddAsync(new KeyValue() { Name = Picklist.Brand, Text = "Text5", Value = "Value5", Description = "Test Description" }); } [Test] diff --git a/tests/Application.IntegrationTests/Services/PicklistServiceTests.cs b/tests/Application.IntegrationTests/Services/PicklistServiceTests.cs index 9f4427c85..32ed45e6f 100644 --- a/tests/Application.IntegrationTests/Services/PicklistServiceTests.cs +++ b/tests/Application.IntegrationTests/Services/PicklistServiceTests.cs @@ -2,6 +2,7 @@ using System.Threading.Tasks; using CleanArchitecture.Application.IntegrationTests; using CleanArchitecture.Blazor.Domain.Entities; +using CleanArchitecture.Blazor.Domain.Enums; using NUnit.Framework; namespace CleanArchitecture.Blazor.Application.IntegrationTests.Services; @@ -11,10 +12,10 @@ public class PicklistServiceTests : TestBase [SetUp] public async Task InitData() { - await AddAsync(new KeyValue() { Name = Domain.Picklist.Brand, Text="Text1",Value="Value1" }); - await AddAsync(new KeyValue() { Name = Domain.Picklist.Brand, Text = "Text2", Value = "Value2" }); - await AddAsync(new KeyValue() { Name = Domain.Picklist.Brand, Text = "Text3", Value = "Value3" }); - await AddAsync(new KeyValue() { Name = Domain.Picklist.Brand, Text = "Text4", Value = "Value4" }); + await AddAsync(new KeyValue() { Name = Picklist.Brand, Text="Text1",Value="Value1" }); + await AddAsync(new KeyValue() { Name = Picklist.Brand, Text = "Text2", Value = "Value2" }); + await AddAsync(new KeyValue() { Name = Picklist.Brand, Text = "Text3", Value = "Value3" }); + await AddAsync(new KeyValue() { Name = Picklist.Brand, Text = "Text4", Value = "Value4" }); } [Test] public async Task ShouldLoadDataSource() @@ -28,7 +29,7 @@ public async Task ShouldLoadDataSource() [Test] public async Task ShouldUpdateDataSource() { - await AddAsync(new KeyValue() { Name = Domain.Picklist.Brand, Text = "Text5", Value = "Value5" }); + await AddAsync(new KeyValue() { Name = Picklist.Brand, Text = "Text5", Value = "Value5" }); var picklist = CreatePicklistService(); await picklist.Refresh(); var count = picklist.DataSource.Count(); From 528f06228de4ce1b9eb15c0938e1beee8615b158 Mon Sep 17 00:00:00 2001 From: Bram1903 <70259613+Bram1903@users.noreply.github.com> Date: Mon, 24 Apr 2023 22:51:13 +0200 Subject: [PATCH 5/7] Removed: Period in some strings Fixed: Namespace namings Fixed: Incorrect naming conventions (Refactored: Infrastructure) --- src/Blazor.Server.UI/Program.cs | 2 +- src/Blazor.Server.UI/_Imports.cs | 1 - .../Localization/LocalizationConstants.cs | 2 +- .../Constants/Role/RoleNameConstants.cs | 2 +- .../Constants/User/UserNameConstants.cs | 2 +- src/Infrastructure/DependencyInjection.cs | 2 +- .../ApplicationBuilderExtensions.cs | 1 + ...LocalizationServiceCollectionExtensions.cs | 23 ++++++------ .../ServicesCollectionExtensions.cs | 20 ++++++----- .../SignalRServiceCollectionExtensions.cs | 13 ++++--- src/Infrastructure/Hubs/HubClient.cs | 13 +++---- src/Infrastructure/Hubs/SignalRHub.cs | 8 ++--- ....cs => ApplicationDbContextInitializer.cs} | 16 ++++----- .../Persistence/BlazorContextFactory.cs | 8 ++--- .../Conversions/StringListConverter.cs | 9 +++-- .../Extensions/ModelBuilderExtensions.cs | 4 +-- .../AuditableEntitySaveChangesInterceptor.cs | 16 ++++----- src/Infrastructure/Services/ExcelService.cs | 12 +++---- .../Services/Identity/IdentityService.cs | 26 +++++++------- .../Services/Identity/UserDataProvider.cs | 4 +-- .../Services/InMemoryTicketStore.cs | 2 +- .../Services/JWT/AccessTokenProvider.cs | 8 ++--- src/Infrastructure/Services/MailService.cs | 4 +-- src/Infrastructure/Services/PDFService.cs | 36 +++++++------------ .../Services/PaddleOCR/DocumentOcrJob.cs | 32 ++++++++--------- src/Infrastructure/Services/UploadService.cs | 6 ++-- src/Infrastructure/_Imports.cs | 3 -- 27 files changed, 129 insertions(+), 146 deletions(-) rename src/Infrastructure/Persistence/{ApplicationDbContextInitialiser.cs => ApplicationDbContextInitializer.cs} (94%) diff --git a/src/Blazor.Server.UI/Program.cs b/src/Blazor.Server.UI/Program.cs index c39123172..9a9211cf6 100644 --- a/src/Blazor.Server.UI/Program.cs +++ b/src/Blazor.Server.UI/Program.cs @@ -44,7 +44,7 @@ using (var scope = app.Services.CreateScope()) { - var initializer = scope.ServiceProvider.GetRequiredService(); + var initializer = scope.ServiceProvider.GetRequiredService(); await initializer.InitialiseAsync(); await initializer.SeedAsync(); var notificationService = scope.ServiceProvider.GetService(); diff --git a/src/Blazor.Server.UI/_Imports.cs b/src/Blazor.Server.UI/_Imports.cs index 87160d1fa..a65738ab0 100644 --- a/src/Blazor.Server.UI/_Imports.cs +++ b/src/Blazor.Server.UI/_Imports.cs @@ -4,7 +4,6 @@ global using Microsoft.EntityFrameworkCore; global using System.Data; global using Microsoft.Extensions.Logging; -global using CleanArchitecture.Blazor.Domain; global using CleanArchitecture.Blazor.Domain.Entities; global using CleanArchitecture.Blazor.Domain.Identity; global using CleanArchitecture.Blazor.Application.Common.Models; diff --git a/src/Infrastructure/Constants/Localization/LocalizationConstants.cs b/src/Infrastructure/Constants/Localization/LocalizationConstants.cs index 779aa3530..4add2dc5c 100644 --- a/src/Infrastructure/Constants/Localization/LocalizationConstants.cs +++ b/src/Infrastructure/Constants/Localization/LocalizationConstants.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace CleanArchitecture.Blazor.Infrastructure.Constants; +namespace CleanArchitecture.Blazor.Infrastructure.Constants.Localization; public static class LocalizationConstants { diff --git a/src/Infrastructure/Constants/Role/RoleNameConstants.cs b/src/Infrastructure/Constants/Role/RoleNameConstants.cs index 48f77dfaa..3616d55bb 100644 --- a/src/Infrastructure/Constants/Role/RoleNameConstants.cs +++ b/src/Infrastructure/Constants/Role/RoleNameConstants.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace CleanArchitecture.Blazor.Infrastructure.Constants; +namespace CleanArchitecture.Blazor.Infrastructure.Constants.Role; public static class RoleNameConstants { diff --git a/src/Infrastructure/Constants/User/UserNameConstants.cs b/src/Infrastructure/Constants/User/UserNameConstants.cs index 3b32560c3..c63a74ddd 100644 --- a/src/Infrastructure/Constants/User/UserNameConstants.cs +++ b/src/Infrastructure/Constants/User/UserNameConstants.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace CleanArchitecture.Blazor.Infrastructure.Constants; +namespace CleanArchitecture.Blazor.Infrastructure.Constants.User; public static class UserNameConstants { diff --git a/src/Infrastructure/DependencyInjection.cs b/src/Infrastructure/DependencyInjection.cs index 9a4dbc66e..0a0292be1 100644 --- a/src/Infrastructure/DependencyInjection.cs +++ b/src/Infrastructure/DependencyInjection.cs @@ -53,7 +53,7 @@ public static IServiceCollection AddInfrastructureServices(this IServiceCollecti services.AddSingleton(s => s.GetRequiredService>().Value); services.AddScoped, BlazorContextFactory>(); services.AddTransient(provider => provider.GetRequiredService>().CreateDbContext()); - services.AddScoped(); + services.AddScoped(); services.AddLocalizationServices(); diff --git a/src/Infrastructure/Extensions/ApplicationBuilderExtensions.cs b/src/Infrastructure/Extensions/ApplicationBuilderExtensions.cs index 7ce6c8712..cd9a45fa5 100644 --- a/src/Infrastructure/Extensions/ApplicationBuilderExtensions.cs +++ b/src/Infrastructure/Extensions/ApplicationBuilderExtensions.cs @@ -1,3 +1,4 @@ +using CleanArchitecture.Blazor.Infrastructure.Constants.Localization; using CleanArchitecture.Blazor.Infrastructure.Hubs; using Hangfire; using Microsoft.AspNetCore.Builder; diff --git a/src/Infrastructure/Extensions/LocalizationServiceCollectionExtensions.cs b/src/Infrastructure/Extensions/LocalizationServiceCollectionExtensions.cs index fc4f99c0d..1c3dfeaf9 100644 --- a/src/Infrastructure/Extensions/LocalizationServiceCollectionExtensions.cs +++ b/src/Infrastructure/Extensions/LocalizationServiceCollectionExtensions.cs @@ -1,16 +1,19 @@ +using CleanArchitecture.Blazor.Infrastructure.Constants.Localization; using Microsoft.AspNetCore.Builder; namespace CleanArchitecture.Blazor.Infrastructure.Extensions; + public static class LocalizationServiceCollectionExtensions { public static IServiceCollection AddLocalizationServices(this IServiceCollection services) - => services.AddScoped() - .Configure(options => - { - options.AddSupportedUICultures(LocalizationConstants.SupportedLanguages.Select(x => x.Code).ToArray()); - options.AddSupportedCultures(LocalizationConstants.SupportedLanguages.Select(x => x.Code).ToArray()); - options.FallBackToParentUICultures = true; - - }) - .AddLocalization(options => options.ResourcesPath = LocalizationConstants.ResourcesPath); -} + { + return services.AddScoped() + .Configure(options => + { + options.AddSupportedUICultures(LocalizationConstants.SupportedLanguages.Select(x => x.Code).ToArray()); + options.AddSupportedCultures(LocalizationConstants.SupportedLanguages.Select(x => x.Code).ToArray()); + options.FallBackToParentUICultures = true; + }) + .AddLocalization(options => options.ResourcesPath = LocalizationConstants.ResourcesPath); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Extensions/ServicesCollectionExtensions.cs b/src/Infrastructure/Extensions/ServicesCollectionExtensions.cs index 39c74ef00..728a1d748 100644 --- a/src/Infrastructure/Extensions/ServicesCollectionExtensions.cs +++ b/src/Infrastructure/Extensions/ServicesCollectionExtensions.cs @@ -2,15 +2,17 @@ using CleanArchitecture.Blazor.Infrastructure.Services.PaddleOCR; namespace CleanArchitecture.Blazor.Infrastructure.Extensions; + public static class ServicesCollectionExtensions { public static IServiceCollection AddServices(this IServiceCollection services) - => services - .AddScoped() - .AddScoped() - .AddScoped() - .AddScoped() - .AddTransient() - .AddScoped(); - -} + { + return services + .AddScoped() + .AddScoped() + .AddScoped() + .AddScoped() + .AddTransient() + .AddScoped(); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Extensions/SignalRServiceCollectionExtensions.cs b/src/Infrastructure/Extensions/SignalRServiceCollectionExtensions.cs index 85f732612..fa229da2f 100644 --- a/src/Infrastructure/Extensions/SignalRServiceCollectionExtensions.cs +++ b/src/Infrastructure/Extensions/SignalRServiceCollectionExtensions.cs @@ -2,11 +2,14 @@ using Microsoft.AspNetCore.Components.Server.Circuits; namespace CleanArchitecture.Blazor.Infrastructure.Extensions; + public static class SignalRServiceCollectionExtensions { public static void AddSignalRServices(this IServiceCollection services) - => services.AddSingleton() - .AddScoped() - .AddTransient() - .AddSignalR(); -} + { + services.AddSingleton() + .AddScoped() + .AddTransient() + .AddSignalR(); + } +} \ No newline at end of file diff --git a/src/Infrastructure/Hubs/HubClient.cs b/src/Infrastructure/Hubs/HubClient.cs index 4bf6d09e9..ecc35f2a9 100644 --- a/src/Infrastructure/Hubs/HubClient.cs +++ b/src/Infrastructure/Hubs/HubClient.cs @@ -6,21 +6,16 @@ namespace CleanArchitecture.Blazor.Infrastructure.Hubs; public class HubClient : IAsyncDisposable { - private HubConnection _hubConnection; - private string _hubUrl = String.Empty; - private readonly NavigationManager _navigationManager; - private readonly AccessTokenProvider _authProvider; + private readonly HubConnection _hubConnection; private bool _started = false; public HubClient(NavigationManager navigationManager, AccessTokenProvider authProvider ) { - _navigationManager = navigationManager; - _authProvider = authProvider; - var token = _authProvider.AccessToken; - _hubUrl = _navigationManager.BaseUri.TrimEnd('/') + SignalR.HubUrl; + var token = authProvider.AccessToken; + string hubUrl = navigationManager.BaseUri.TrimEnd('/') + SignalR.HubUrl; _hubConnection = new HubConnectionBuilder() - .WithUrl(_hubUrl, options => { + .WithUrl(hubUrl, options => { options.AccessTokenProvider =()=> Task.FromResult(token); options.Transports = HttpTransportType.WebSockets; }) diff --git a/src/Infrastructure/Hubs/SignalRHub.cs b/src/Infrastructure/Hubs/SignalRHub.cs index a17b0b57d..5bc8aa836 100644 --- a/src/Infrastructure/Hubs/SignalRHub.cs +++ b/src/Infrastructure/Hubs/SignalRHub.cs @@ -20,14 +20,14 @@ public interface ISignalRHub [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] public class SignalRHub : Hub { - private static readonly ConcurrentDictionary _onlineUsers = new(); + private static readonly ConcurrentDictionary OnlineUsers = new(); public override async Task OnConnectedAsync() { var id = Context.ConnectionId; var userName = Context.User?.Identity?.Name ?? string.Empty; - if (!_onlineUsers.ContainsKey(id)) + if (!OnlineUsers.ContainsKey(id)) { - _onlineUsers.TryAdd(id, userName); + OnlineUsers.TryAdd(id, userName); } await Clients.All.Connect(userName); await base.OnConnectedAsync(); @@ -37,7 +37,7 @@ public override async Task OnDisconnectedAsync(Exception? exception) { var id = Context.ConnectionId; //try to remove key from dictionary - if (_onlineUsers.TryRemove(id, out string? userName)) + if (OnlineUsers.TryRemove(id, out string? userName)) { await Clients.All.Disconnect(userName); } diff --git a/src/Infrastructure/Persistence/ApplicationDbContextInitialiser.cs b/src/Infrastructure/Persistence/ApplicationDbContextInitializer.cs similarity index 94% rename from src/Infrastructure/Persistence/ApplicationDbContextInitialiser.cs rename to src/Infrastructure/Persistence/ApplicationDbContextInitializer.cs index 517b94104..035c05cfa 100644 --- a/src/Infrastructure/Persistence/ApplicationDbContextInitialiser.cs +++ b/src/Infrastructure/Persistence/ApplicationDbContextInitializer.cs @@ -6,14 +6,14 @@ using CleanArchitecture.Blazor.Domain.Enums; namespace CleanArchitecture.Blazor.Infrastructure.Persistence; -public class ApplicationDbContextInitialiser +public class ApplicationDbContextInitializer { - private readonly ILogger _logger; + private readonly ILogger _logger; private readonly ApplicationDbContext _context; private readonly UserManager _userManager; private readonly RoleManager _roleManager; - public ApplicationDbContextInitialiser(ILogger logger, ApplicationDbContext context, UserManager userManager, RoleManager roleManager) + public ApplicationDbContextInitializer(ILogger logger, ApplicationDbContext context, UserManager userManager, RoleManager roleManager) { _logger = logger; _context = context; @@ -31,7 +31,7 @@ public async Task InitialiseAsync() } catch (Exception ex) { - _logger.LogError(ex, "An error occurred while initialising the database."); + _logger.LogError(ex, "An error occurred while initialising the database"); throw; } } @@ -44,7 +44,7 @@ public async Task SeedAsync() } catch (Exception ex) { - _logger.LogError(ex, "An error occurred while seeding the database."); + _logger.LogError(ex, "An error occurred while seeding the database"); throw; } } @@ -85,12 +85,12 @@ public async Task TrySeedAsync() // Default roles var administratorRole = new ApplicationRole(RoleName.Administrator) { Description = "Admin Group" }; var userRole = new ApplicationRole(RoleName.Basic) { Description = "Basic Group" }; - var Permissions = GetAllPermissions(); + var permissions = GetAllPermissions(); if (_roleManager.Roles.All(r => r.Name != administratorRole.Name)) { await _roleManager.CreateAsync(administratorRole); - foreach (var permission in Permissions) + foreach (var permission in permissions) { await _roleManager.AddClaimAsync(administratorRole, new System.Security.Claims.Claim(ApplicationClaimTypes.Permission, permission)); } @@ -98,7 +98,7 @@ public async Task TrySeedAsync() if (_roleManager.Roles.All(r => r.Name != userRole.Name)) { await _roleManager.CreateAsync(userRole); - foreach (var permission in Permissions) + foreach (var permission in permissions) { if (permission.StartsWith("Permissions.Products")) await _roleManager.AddClaimAsync(userRole, new System.Security.Claims.Claim(ApplicationClaimTypes.Permission, permission)); diff --git a/src/Infrastructure/Persistence/BlazorContextFactory.cs b/src/Infrastructure/Persistence/BlazorContextFactory.cs index 5c1776761..43aa76ca0 100644 --- a/src/Infrastructure/Persistence/BlazorContextFactory.cs +++ b/src/Infrastructure/Persistence/BlazorContextFactory.cs @@ -1,21 +1,21 @@ namespace CleanArchitecture.Blazor.Infrastructure.Persistence; public class BlazorContextFactory : IDbContextFactory where TContext : DbContext { - private readonly IServiceProvider provider; + private readonly IServiceProvider _provider; public BlazorContextFactory(IServiceProvider provider) { - this.provider = provider; + this._provider = provider; } public TContext CreateDbContext() { - if (provider == null) + if (_provider == null) { throw new InvalidOperationException( $"You must configure an instance of IServiceProvider"); } - return ActivatorUtilities.CreateInstance(provider); + return ActivatorUtilities.CreateInstance(_provider); } } diff --git a/src/Infrastructure/Persistence/Conversions/StringListConverter.cs b/src/Infrastructure/Persistence/Conversions/StringListConverter.cs index 53a5fb427..2bb45a6c1 100644 --- a/src/Infrastructure/Persistence/Conversions/StringListConverter.cs +++ b/src/Infrastructure/Persistence/Conversions/StringListConverter.cs @@ -9,11 +9,10 @@ namespace CleanArchitecture.Blazor.Infrastructure.Persistence.Conversions; public class StringListConverter : ValueConverter, string> { - public StringListConverter() : base(v => JsonSerializer.Serialize(v, DefaultJsonSerializerOptions.Options), - v => JsonSerializer.Deserialize>(string.IsNullOrEmpty(v) ? "[]" : v, DefaultJsonSerializerOptions.Options)??new() - ) + v => JsonSerializer.Deserialize>(string.IsNullOrEmpty(v) ? "[]" : v, + DefaultJsonSerializerOptions.Options) ?? new List() + ) { - } -} +} \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Extensions/ModelBuilderExtensions.cs b/src/Infrastructure/Persistence/Extensions/ModelBuilderExtensions.cs index 71c6c177e..93beab9cc 100644 --- a/src/Infrastructure/Persistence/Extensions/ModelBuilderExtensions.cs +++ b/src/Infrastructure/Persistence/Extensions/ModelBuilderExtensions.cs @@ -17,8 +17,8 @@ public static void ApplyGlobalFilters(this ModelBuilder modelBuilder foreach (var entity in entities) { var newParam = Expression.Parameter(entity); - var newbody = ReplacingExpressionVisitor.Replace(expression.Parameters.Single(), newParam, expression.Body); - modelBuilder.Entity(entity).HasQueryFilter(Expression.Lambda(newbody, newParam)); + var newBody = ReplacingExpressionVisitor.Replace(expression.Parameters.Single(), newParam, expression.Body); + modelBuilder.Entity(entity).HasQueryFilter(Expression.Lambda(newBody, newParam)); } } } diff --git a/src/Infrastructure/Persistence/Interceptors/AuditableEntitySaveChangesInterceptor.cs b/src/Infrastructure/Persistence/Interceptors/AuditableEntitySaveChangesInterceptor.cs index 84dc80a9e..818eb9251 100644 --- a/src/Infrastructure/Persistence/Interceptors/AuditableEntitySaveChangesInterceptor.cs +++ b/src/Infrastructure/Persistence/Interceptors/AuditableEntitySaveChangesInterceptor.cs @@ -29,19 +29,19 @@ public AuditableEntitySaveChangesInterceptor( public override async ValueTask> SavingChangesAsync(DbContextEventData eventData, InterceptionResult result, CancellationToken cancellationToken = default) { - updateEntities(eventData.Context!); + UpdateEntities(eventData.Context!); _temporaryAuditTrailList = TryInsertTemporaryAuditTrail(eventData.Context!, cancellationToken); _deletingDomainEvents = TryGetDeletingDomainEvents(eventData.Context!, cancellationToken); return await base.SavingChangesAsync(eventData, result, cancellationToken); } public override async ValueTask SavedChangesAsync(SaveChangesCompletedEventData eventData, int result, CancellationToken cancellationToken = default) { - var resultvalueTask = await base.SavedChangesAsync(eventData, result, cancellationToken); + var resultValueTask = await base.SavedChangesAsync(eventData, result, cancellationToken); await TryUpdateTemporaryPropertiesForAuditTrail(eventData.Context!, cancellationToken).ConfigureAwait(false); await _mediator.DispatchDomainEvents(eventData.Context!, _deletingDomainEvents).ConfigureAwait(false); - return resultvalueTask; + return resultValueTask; } - private void updateEntities(DbContext context) + private void UpdateEntities(DbContext context) { var userId = _currentUserService.UserId; var tenantId = _tenantProvider.TenantId; @@ -52,13 +52,13 @@ private void updateEntities(DbContext context) case EntityState.Added: entry.Entity.CreatedBy = userId; entry.Entity.Created = _dateTime.Now; - if (entry.Entity is IMustHaveTenant mustenant) + if (entry.Entity is IMustHaveTenant mustTenant) { - mustenant.TenantId = tenantId; + mustTenant.TenantId = tenantId; } - if (entry.Entity is IMayHaveTenant maytenant) + if (entry.Entity is IMayHaveTenant mayTenant) { - maytenant.TenantId = tenantId; + mayTenant.TenantId = tenantId; } break; diff --git a/src/Infrastructure/Services/ExcelService.cs b/src/Infrastructure/Services/ExcelService.cs index 01f0e4b72..9b0f78822 100644 --- a/src/Infrastructure/Services/ExcelService.cs +++ b/src/Infrastructure/Services/ExcelService.cs @@ -131,26 +131,26 @@ public async Task>> ImportAsync(byte[] dat { return await Result>.FailureAsync(errors); } - var lastrow = ws.LastRowUsed(); + var lastRow = ws.LastRowUsed(); var list = new List(); - foreach (IXLRow row in ws.Rows(startRow, lastrow.RowNumber())) + foreach (IXLRow row in ws.Rows(startRow, lastRow.RowNumber())) { try { - DataRow datarow = dt.Rows.Add(); + DataRow dataRow = dt.Rows.Add(); var item = (TEntity?)Activator.CreateInstance(typeof(TEntity))??throw new NullReferenceException($"{nameof(TEntity)}"); foreach (IXLCell cell in row.Cells()) { if (cell.DataType == XLDataType.DateTime) { - datarow[cell.Address.ColumnNumber - 1] = cell.GetDateTime().ToString("yyyy-MM-dd HH:mm:ss"); + dataRow[cell.Address.ColumnNumber - 1] = cell.GetDateTime().ToString("yyyy-MM-dd HH:mm:ss"); } else { - datarow[cell.Address.ColumnNumber - 1] = cell.Value.ToString(); + dataRow[cell.Address.ColumnNumber - 1] = cell.Value.ToString(); } } - headers.ForEach(x => mappers[x](datarow, item)); + headers.ForEach(x => mappers[x](dataRow, item)); list.Add(item); } catch (Exception e) diff --git a/src/Infrastructure/Services/Identity/IdentityService.cs b/src/Infrastructure/Services/Identity/IdentityService.cs index 258fb984c..a54433a82 100644 --- a/src/Infrastructure/Services/Identity/IdentityService.cs +++ b/src/Infrastructure/Services/Identity/IdentityService.cs @@ -20,7 +20,6 @@ namespace CleanArchitecture.Blazor.Infrastructure.Services.Identity; public class IdentityService : IIdentityService { - private readonly IServiceScopeFactory _scopeFactory; private readonly UserManager _userManager; private readonly RoleManager _roleManager; private readonly AppConfigurationSettings _appConfig; @@ -29,8 +28,8 @@ public class IdentityService : IIdentityService private readonly IAppCache _cache; private readonly IMapper _mapper; private readonly IStringLocalizer _localizer; - private TimeSpan refreshInterval => TimeSpan.FromSeconds(60); - private LazyCacheEntryOptions _options => new LazyCacheEntryOptions().SetAbsoluteExpiration(refreshInterval, ExpirationMode.LazyExpiration); + private TimeSpan RefreshInterval => TimeSpan.FromSeconds(60); + private LazyCacheEntryOptions Options => new LazyCacheEntryOptions().SetAbsoluteExpiration(RefreshInterval, ExpirationMode.LazyExpiration); public IdentityService( IServiceScopeFactory scopeFactory, AppConfigurationSettings appConfig, @@ -38,8 +37,7 @@ public IdentityService( IMapper mapper, IStringLocalizer localizer) { - _scopeFactory = scopeFactory; - var scope = _scopeFactory.CreateScope(); + var scope = scopeFactory.CreateScope(); _userManager = scope.ServiceProvider.GetRequiredService>(); _roleManager = scope.ServiceProvider.GetRequiredService>(); _userClaimsPrincipalFactory = scope.ServiceProvider.GetRequiredService>(); @@ -53,13 +51,13 @@ public IdentityService( public async Task GetUserNameAsync(string userId, CancellationToken cancellation = default) { var key = $"GetUserNameAsync:{userId}"; - var user = await _cache.GetOrAddAsync(key, async () => await _userManager.Users.SingleOrDefaultAsync(u => u.Id == userId), _options); + var user = await _cache.GetOrAddAsync(key, async () => await _userManager.Users.SingleOrDefaultAsync(u => u.Id == userId), Options); return user?.UserName; } public string GetUserName(string userId) { var key = $"GetUserName-byId:{userId}"; - var user = _cache.GetOrAdd(key, () => _userManager.Users.SingleOrDefault(u => u.Id == userId), _options); + var user = _cache.GetOrAdd(key, () => _userManager.Users.SingleOrDefault(u => u.Id == userId), Options); return user?.UserName??string.Empty; } public async Task IsInRoleAsync(string userId, string role, CancellationToken cancellation = default) @@ -86,7 +84,7 @@ public async Task DeleteUserAsync(string userId, CancellationToken cance public async Task> FetchUsers(string roleName, CancellationToken cancellation = default) { var result = await _userManager.Users - .Where(x => x.UserRoles.Where(y => y.Role.Name == roleName).Any()) + .Where(x => x.UserRoles.Any(y => y.Role.Name == roleName)) .Include(x => x.UserRoles) .ToDictionaryAsync(x => x.UserName!, y => y.DisplayName, cancellation); return result; @@ -113,17 +111,17 @@ public async Task> LoginAsync(TokenRequest request, Cancel return await Result.FailureAsync(new string[] { _localizer["Invalid Credentials."] }); } user.RefreshToken = GenerateRefreshToken(); - var TokenExpiryTime = DateTime.Now.AddDays(7); + var tokenExpiryTime = DateTime.Now.AddDays(7); if (request.RememberMe) { - TokenExpiryTime = DateTime.Now.AddYears(1); + tokenExpiryTime = DateTime.Now.AddYears(1); } - user.RefreshTokenExpiryTime = TokenExpiryTime; + user.RefreshTokenExpiryTime = tokenExpiryTime; await _userManager.UpdateAsync(user); var token = await GenerateJwtAsync(user); - var response = new TokenResponse { Token = token, RefreshTokenExpiryTime = TokenExpiryTime, RefreshToken = user.RefreshToken, ProfilePictureDataUrl = user.ProfilePictureDataUrl }; + var response = new TokenResponse { Token = token, RefreshTokenExpiryTime = tokenExpiryTime, RefreshToken = user.RefreshToken, ProfilePictureDataUrl = user.ProfilePictureDataUrl }; return await Result.SuccessAsync(response); } @@ -231,14 +229,14 @@ public async Task UpdateLiveStatus(string userId, bool isLive, CancellationToken public async Task GetApplicationUserDto(string userId, CancellationToken cancellation = default) { var key = $"GetApplicationUserDto:{userId}"; - var result = await _cache.GetOrAddAsync(key, async () => await _userManager.Users.Where(x => x.Id == userId).Include(x => x.UserRoles).ThenInclude(x => x.Role).ProjectTo(_mapper.ConfigurationProvider).FirstAsync(cancellation), _options); + var result = await _cache.GetOrAddAsync(key, async () => await _userManager.Users.Where(x => x.Id == userId).Include(x => x.UserRoles).ThenInclude(x => x.Role).ProjectTo(_mapper.ConfigurationProvider).FirstAsync(cancellation), Options); return result; } public async Task?> GetUsers(string tenantId, CancellationToken cancellation = default) { var key = $"GetApplicationUserDtoListWithTenantId:{tenantId}"; var result = await _cache.GetOrAddAsync(key, async () => await _userManager.Users.Where(x => x.TenantId == tenantId).Include(x => x.UserRoles).ThenInclude(x => x.Role) - .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(), _options); + .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(), Options); return result; } } diff --git a/src/Infrastructure/Services/Identity/UserDataProvider.cs b/src/Infrastructure/Services/Identity/UserDataProvider.cs index e6ce89534..56618c2e7 100644 --- a/src/Infrastructure/Services/Identity/UserDataProvider.cs +++ b/src/Infrastructure/Services/Identity/UserDataProvider.cs @@ -6,7 +6,6 @@ namespace CleanArchitecture.Blazor.Infrastructure.Services.Identity; public class UserDataProvider : IUserDataProvider { private readonly IMapper _mapper; - private readonly IServiceScopeFactory _scopeFactory; private readonly UserManager _userManager; public List DataSource { get; private set; } @@ -17,8 +16,7 @@ public UserDataProvider( IServiceScopeFactory scopeFactory) { _mapper = mapper; - _scopeFactory = scopeFactory; - var scope = _scopeFactory.CreateScope(); + var scope = scopeFactory.CreateScope(); _userManager = scope.ServiceProvider.GetRequiredService>(); DataSource = new List(); } diff --git a/src/Infrastructure/Services/InMemoryTicketStore.cs b/src/Infrastructure/Services/InMemoryTicketStore.cs index 478b40507..749a6627c 100644 --- a/src/Infrastructure/Services/InMemoryTicketStore.cs +++ b/src/Infrastructure/Services/InMemoryTicketStore.cs @@ -15,7 +15,7 @@ public class InMemoryTicketStore : ITicketStore public InMemoryTicketStore(IMemoryCache cache) { - _cache = cache ?? throw new ArgumentNullException(nameof(_cache)); ; + _cache = cache ?? throw new ArgumentNullException(nameof(cache)); ; } public Task RemoveAsync(string key) diff --git a/src/Infrastructure/Services/JWT/AccessTokenProvider.cs b/src/Infrastructure/Services/JWT/AccessTokenProvider.cs index a7c06cb2a..58f2d8b81 100644 --- a/src/Infrastructure/Services/JWT/AccessTokenProvider.cs +++ b/src/Infrastructure/Services/JWT/AccessTokenProvider.cs @@ -7,7 +7,7 @@ namespace CleanArchitecture.Blazor.Infrastructure.Services.JWT; public class AccessTokenProvider { - private readonly string TokenKey = nameof(TokenKey); + private readonly string _tokenKey = nameof(_tokenKey); private readonly ProtectedLocalStorage _localStorage; private readonly NavigationManager _navigation; private readonly IIdentityService _identityService; @@ -28,7 +28,7 @@ public AccessTokenProvider(ProtectedLocalStorage localStorage, NavigationManager public async Task GenerateJwt(ApplicationUser applicationUser) { AccessToken = await _identityService.GenerateJwtAsync(applicationUser); - await _localStorage.SetAsync(TokenKey, AccessToken); + await _localStorage.SetAsync(_tokenKey, AccessToken); _tenantProvider.TenantId = applicationUser.TenantId; _tenantProvider.TenantName = applicationUser.TenantName; _currentUser.UserId = applicationUser.Id; @@ -41,7 +41,7 @@ public async Task GetClaimsPrincipal() { try { - var token = await _localStorage.GetAsync(TokenKey); + var token = await _localStorage.GetAsync(_tokenKey); if (token.Success && !string.IsNullOrEmpty(token.Value)) { AccessToken = token.Value; @@ -72,7 +72,7 @@ public async Task GetClaimsPrincipal() public async Task RemoveAuthDataFromStorage() { - await _localStorage.DeleteAsync(TokenKey); + await _localStorage.DeleteAsync(_tokenKey); _navigation.NavigateTo("/", true); } } diff --git a/src/Infrastructure/Services/MailService.cs b/src/Infrastructure/Services/MailService.cs index e04534fba..4dcf18b46 100644 --- a/src/Infrastructure/Services/MailService.cs +++ b/src/Infrastructure/Services/MailService.cs @@ -52,7 +52,7 @@ public Task SendAsync(string to, string subject, string body) } catch (Exception e) { - _logger.LogError(e, $"Error sending an email to {to} with subject {subject}", to, subject); + _logger.LogError(e, "Error sending an email to {Unknown} with subject {Subject}", to, subject); throw; } } @@ -79,7 +79,7 @@ public Task SendAsync(string to, string subject, string template, } catch (Exception e) { - _logger.LogError(e, $"Error sending an email to {to} with subject {subject} and template {template}", to, subject,template); + _logger.LogError(e, "Error sending an email to {Unknown} with subject {Subject} and template {Template}", to, subject,template); throw; } } diff --git a/src/Infrastructure/Services/PDFService.cs b/src/Infrastructure/Services/PDFService.cs index b342ec761..97bdb325d 100644 --- a/src/Infrastructure/Services/PDFService.cs +++ b/src/Infrastructure/Services/PDFService.cs @@ -7,11 +7,11 @@ namespace CleanArchitecture.Blazor.Infrastructure.Services; public class PDFService : IPDFService { - private const int marginPTs = 56; - private const string fontFamilyName = Fonts.Consolas; - private const float fontSize = 10F; - private const int maxCharsPerCell = 80; - private const int minCharsPerCell = 10; + private const int MarginPTs = 56; + private const string FontFamilyName = Fonts.Consolas; + private const float FontSize = 10F; + private const int MaxCharsPerCell = 80; + private const int MinCharsPerCell = 10; public async Task ExportAsync(IEnumerable data , Dictionary> mappers @@ -24,9 +24,9 @@ public async Task ExportAsync(IEnumerable data container.Page(page => { page.Size(landscape? PageSizes.A4.Landscape() : PageSizes.A4); - page.Margin(marginPTs, Unit.Point); + page.Margin(MarginPTs, Unit.Point); page.PageColor(QuestPDF.Helpers.Colors.White); - page.DefaultTextStyle(x => x.FontSize(fontSize).FontFamily(fontFamilyName).Fallback(TextStyle.Default.FontFamily("simhei"))); + page.DefaultTextStyle(x => x.FontSize(FontSize).FontFamily(FontFamilyName).Fallback(TextStyle.Default.FontFamily("simhei"))); page.Header() .Text(title) @@ -40,12 +40,12 @@ public async Task ExportAsync(IEnumerable data var dataList = data.ToList(); // Rough fit columns calculation - int tableWidth = landscape ? (int)(PageSizes.A4.Landscape().Width - (marginPTs * 2)) : (int)(PageSizes.A4.Width - (marginPTs * 2)); + int tableWidth = landscape ? (int)(PageSizes.A4.Landscape().Width - (MarginPTs * 2)) : (int)(PageSizes.A4.Width - (MarginPTs * 2)); int[] columnsWidth = new int[headers.Count]; for (uint c = 0; c < headers.Count; c++) { - var cellWidth = Math.Max(minCharsPerCell, Math.Min($"{headers[(int)c]}".Length,maxCharsPerCell)); + var cellWidth = Math.Max(MinCharsPerCell, Math.Min($"{headers[(int)c]}".Length,MaxCharsPerCell)); if (columnsWidth[c] < cellWidth) columnsWidth[c] = cellWidth; @@ -58,7 +58,7 @@ public async Task ExportAsync(IEnumerable data uint c = 0; foreach (var value in result) { - var cellWidth = Math.Max(minCharsPerCell, Math.Min($"{value}".Length, maxCharsPerCell)); + var cellWidth = Math.Max(MinCharsPerCell, Math.Min($"{value}".Length, MaxCharsPerCell)); if (columnsWidth[c] < cellWidth) columnsWidth[c] = cellWidth; c += 1; @@ -81,11 +81,10 @@ public async Task ExportAsync(IEnumerable data }); // Create rows - uint colIndex = 1; uint rowIndex = 1; foreach (var item in dataList) { - colIndex = 1; + uint colIndex = 1; rowIndex++; var result = headers.Select(header => mappers[header](item)); @@ -122,18 +121,7 @@ static bool IsNumber(object? value) { if (value == null) return false; - else - return value is sbyte - || value is byte - || value is short - || value is ushort - || value is int - || value is uint - || value is long - || value is ulong - || value is float - || value is double - || value is decimal; + return value is sbyte or byte or short or ushort or int or uint or long or ulong or float or double or decimal; } static IContainer BlockCell(IContainer container) diff --git a/src/Infrastructure/Services/PaddleOCR/DocumentOcrJob.cs b/src/Infrastructure/Services/PaddleOCR/DocumentOcrJob.cs index 709405310..da8681341 100644 --- a/src/Infrastructure/Services/PaddleOCR/DocumentOcrJob.cs +++ b/src/Infrastructure/Services/PaddleOCR/DocumentOcrJob.cs @@ -36,7 +36,7 @@ ILogger logger _logger = logger; _timer=new Stopwatch(); } - private string readbase64string(string path) + private string ReadBase64String(string path) { using (Image image = Image.FromFile(path)) { @@ -68,21 +68,21 @@ public async Task Recognition(int id, CancellationToken cancellationToken) await _hubContext.Clients.All.Start(doc.Title!); DocumentCacheKey.SharedExpiryTokenSource().Cancel(); if (string.IsNullOrEmpty(doc.URL)) return; - var imgfile = Path.Combine(Directory.GetCurrentDirectory(), doc.URL); - if (!File.Exists(imgfile)) return; - string base64string = readbase64string(imgfile); + var imgFile = Path.Combine(Directory.GetCurrentDirectory(), doc.URL); + if (!File.Exists(imgFile)) return; + string base64String = ReadBase64String(imgFile); - var response = client.PostAsJsonAsync("", new { images = new string[] { base64string } }).Result; + var response = client.PostAsJsonAsync("", new { images = new string[] { base64String } }).Result; if (response.StatusCode == System.Net.HttpStatusCode.OK) { var result = await response.Content.ReadAsStringAsync(); - var ocr_result = JsonSerializer.Deserialize(result); - var ocr_status = ocr_result!.status; + var ocrResult = JsonSerializer.Deserialize(result); + var ocrStatus = ocrResult!.Status; doc.Status = JobStatus.Done; - doc.Description = "recognize the result: " + ocr_status; - if (ocr_result.status == "000") + doc.Description = "recognize the result: " + ocrStatus; + if (ocrResult.Status == "000") { - var content = _serializer.Serialize(ocr_result.results); + var content = _serializer.Serialize(ocrResult.Results); doc!.Content = content; } @@ -91,7 +91,7 @@ public async Task Recognition(int id, CancellationToken cancellationToken) DocumentCacheKey.SharedExpiryTokenSource().Cancel(); _timer.Stop(); var elapsedMilliseconds = _timer.ElapsedMilliseconds; - _logger.LogInformation("Id: {id}, elapsed: {elapsedMilliseconds}, recognize the result: {@result},{@content}", id, elapsedMilliseconds, ocr_result, doc.Content); + _logger.LogInformation("Id: {Id}, elapsed: {ElapsedMilliseconds}, recognize the result: {@Result},{@Content}", id, elapsedMilliseconds, ocrResult, doc.Content); } @@ -99,7 +99,7 @@ public async Task Recognition(int id, CancellationToken cancellationToken) } catch (Exception ex) { - _logger.LogError(ex, $"{id}: recognize error {ex.Message}"); + _logger.LogError(ex, "{Id}: recognize error {ExMessage}", id, ex.Message); } } @@ -112,11 +112,11 @@ class result public string text { get; set; } = String.Empty; public List text_region { get; set; } = new(); } -class ocr_result +class OcrResult { - public string msg { get; set; } = String.Empty; - public List results { get; set; } = new(); - public string status { get; set; }=String.Empty; + public string Msg { get; set; } = String.Empty; + public List Results { get; set; } = new(); + public string Status { get; set; }=String.Empty; } diff --git a/src/Infrastructure/Services/UploadService.cs b/src/Infrastructure/Services/UploadService.cs index 0b5e48521..a54838ab7 100644 --- a/src/Infrastructure/Services/UploadService.cs +++ b/src/Infrastructure/Services/UploadService.cs @@ -38,7 +38,7 @@ public async Task UploadAsync(UploadRequest request) } } - private static string _numberPattern = " ({0})"; + private static readonly string NumberPattern = " ({0})"; public static string NextAvailableFilename(string path) { @@ -48,10 +48,10 @@ public static string NextAvailableFilename(string path) // If path has extension then insert the number pattern just before the extension and return next filename if (Path.HasExtension(path)) - return GetNextFilename(path.Insert(path.LastIndexOf(Path.GetExtension(path)), _numberPattern)); + return GetNextFilename(path.Insert(path.LastIndexOf(Path.GetExtension(path)), NumberPattern)); // Otherwise just append the pattern to the path and return next filename - return GetNextFilename(path + _numberPattern); + return GetNextFilename(path + NumberPattern); } private static string GetNextFilename(string pattern) diff --git a/src/Infrastructure/_Imports.cs b/src/Infrastructure/_Imports.cs index 07c02dbcf..91990d4ff 100644 --- a/src/Infrastructure/_Imports.cs +++ b/src/Infrastructure/_Imports.cs @@ -9,7 +9,6 @@ global using Microsoft.Extensions.Logging; global using Microsoft.AspNetCore.Identity.EntityFrameworkCore; global using Microsoft.EntityFrameworkCore; -global using CleanArchitecture.Blazor.Domain; global using CleanArchitecture.Blazor.Domain.Common; global using CleanArchitecture.Blazor.Domain.Entities; global using CleanArchitecture.Blazor.Domain.Entities.Audit; @@ -17,8 +16,6 @@ global using CleanArchitecture.Blazor.Application.Common.Models; global using CleanArchitecture.Blazor.Application.Common.Interfaces; global using CleanArchitecture.Blazor.Application.Common.Interfaces.Identity; -global using CleanArchitecture.Blazor.Infrastructure.Constants; -global using CleanArchitecture.Blazor.Application.Constants; global using CleanArchitecture.Blazor.Domain.Identity; global using CleanArchitecture.Blazor.Infrastructure.Middlewares; global using CleanArchitecture.Blazor.Infrastructure.Persistence; From ece4d56ffd53e26f0838d4dac5d1a06a382c6897 Mon Sep 17 00:00:00 2001 From: Bram1903 <70259613+Bram1903@users.noreply.github.com> Date: Mon, 24 Apr 2023 22:58:19 +0200 Subject: [PATCH 6/7] Fixed: Namespace namings Fixed: Incorrect naming conventions (Refactored: Unit Tests) --- .../Commands/AddEditKeyValueCommandTests.cs | 13 ++++++------- .../KeyValues/Commands/DeleteKeyValueTests.cs | 8 +++----- .../KeyValues/Queries/ExportKeyValuesQueryTests.cs | 1 - .../KeyValues/Queries/KeyValuesQueryTests.cs | 3 +-- .../Queries/KeyValuesWithPaginationQueryTests.cs | 5 ++--- .../Products/Commands/AddEditProductCommandTests.cs | 13 ++++++------- .../Products/Commands/DeleteProductCommandTests.cs | 9 ++++----- .../Products/Commands/ImportProductsCommandTests.cs | 5 ++--- .../Products/Queries/ExportProductsQueryTests.cs | 1 - .../Products/Queries/GetAllProductsQueryTests.cs | 5 ++--- .../Queries/ProductsPaginationQueryTests.cs | 3 +-- .../Services/PicklistServiceTests.cs | 1 - .../Services/TenantsServiceTests.cs | 1 - tests/Application.IntegrationTests/TestBase.cs | 2 +- tests/Application.IntegrationTests/Testing.cs | 7 ++++--- .../Common/Exceptions/ValidationExceptionTests.cs | 2 +- tests/Domain.UnitTests/ValueObjects/ColourTests.cs | 2 +- 17 files changed, 34 insertions(+), 47 deletions(-) diff --git a/tests/Application.IntegrationTests/KeyValues/Commands/AddEditKeyValueCommandTests.cs b/tests/Application.IntegrationTests/KeyValues/Commands/AddEditKeyValueCommandTests.cs index da47f51a0..8c3c551ab 100644 --- a/tests/Application.IntegrationTests/KeyValues/Commands/AddEditKeyValueCommandTests.cs +++ b/tests/Application.IntegrationTests/KeyValues/Commands/AddEditKeyValueCommandTests.cs @@ -1,5 +1,4 @@ using System.Threading.Tasks; -using CleanArchitecture.Application.IntegrationTests; using CleanArchitecture.Blazor.Application.Features.KeyValues.Commands.AddEdit; using CleanArchitecture.Blazor.Domain.Entities; using CleanArchitecture.Blazor.Domain.Enums; @@ -22,8 +21,8 @@ public void ShouldThrowValidationException() [Test] public async Task InsertItem() { - var addcommand = new AddEditKeyValueCommand() { Name= Picklist.Brand, Text="Test",Value="Test",Description= "Description" }; - var result = await SendAsync(addcommand); + var addCommand = new AddEditKeyValueCommand() { Name= Picklist.Brand, Text="Test",Value="Test",Description= "Description" }; + var result = await SendAsync(addCommand); var find = await FindAsync(result.Data); find.Should().NotBeNull(); find.Name.Should().Be(Picklist.Brand); @@ -34,11 +33,11 @@ public async Task InsertItem() [Test] public async Task UpdateItem() { - var addcommand = new AddEditKeyValueCommand() { Name = Picklist.Brand, Text = "Test", Value = "Test", Description = "Description" }; - var result = await SendAsync(addcommand); + var addCommand = new AddEditKeyValueCommand() { Name = Picklist.Brand, Text = "Test", Value = "Test", Description = "Description" }; + var result = await SendAsync(addCommand); var find = await FindAsync(result.Data); - var editcommand = new AddEditKeyValueCommand() { Id=find.Id, Name = Picklist.Brand, Text = "Test1", Value = "Test1", Description = "Description1" }; - await SendAsync(editcommand); + var editCommand = new AddEditKeyValueCommand() { Id=find.Id, Name = Picklist.Brand, Text = "Test1", Value = "Test1", Description = "Description1" }; + await SendAsync(editCommand); var updated = await FindAsync(find.Id); updated.Should().NotBeNull(); updated.Name.Should().Be(Picklist.Brand); diff --git a/tests/Application.IntegrationTests/KeyValues/Commands/DeleteKeyValueTests.cs b/tests/Application.IntegrationTests/KeyValues/Commands/DeleteKeyValueTests.cs index 2e8901c6b..5676568bd 100644 --- a/tests/Application.IntegrationTests/KeyValues/Commands/DeleteKeyValueTests.cs +++ b/tests/Application.IntegrationTests/KeyValues/Commands/DeleteKeyValueTests.cs @@ -1,15 +1,13 @@ - using System.Threading.Tasks; using CleanArchitecture.Blazor.Application.Common.ExceptionHandlers; using CleanArchitecture.Blazor.Application.Features.KeyValues.Commands.AddEdit; using CleanArchitecture.Blazor.Application.Features.KeyValues.Commands.Delete; -using CleanArchitecture.Blazor.Domain; using CleanArchitecture.Blazor.Domain.Entities; using CleanArchitecture.Blazor.Domain.Enums; using FluentAssertions; using NUnit.Framework; -namespace CleanArchitecture.Application.IntegrationTests.KeyValues.Commands +namespace CleanArchitecture.Blazor.Application.IntegrationTests.KeyValues.Commands { using static Testing; @@ -27,14 +25,14 @@ public void ShouldRequireValidKeyValueId() [Test] public async Task ShouldDeleteKeyValue() { - var addcommand = new AddEditKeyValueCommand() + var addCommand = new AddEditKeyValueCommand() { Name = Picklist.Brand, Text= "Word", Value = "Word", Description = "For Test" }; - var result= await SendAsync(addcommand); + var result= await SendAsync(addCommand); await SendAsync(new DeleteKeyValueCommand(new int[] { result.Data })); diff --git a/tests/Application.IntegrationTests/KeyValues/Queries/ExportKeyValuesQueryTests.cs b/tests/Application.IntegrationTests/KeyValues/Queries/ExportKeyValuesQueryTests.cs index 8ad74e871..fbd147f1c 100644 --- a/tests/Application.IntegrationTests/KeyValues/Queries/ExportKeyValuesQueryTests.cs +++ b/tests/Application.IntegrationTests/KeyValues/Queries/ExportKeyValuesQueryTests.cs @@ -1,5 +1,4 @@ using System.Threading.Tasks; -using CleanArchitecture.Application.IntegrationTests; using CleanArchitecture.Blazor.Application.Features.KeyValues.Queries.Export; using FluentAssertions; using NUnit.Framework; diff --git a/tests/Application.IntegrationTests/KeyValues/Queries/KeyValuesQueryTests.cs b/tests/Application.IntegrationTests/KeyValues/Queries/KeyValuesQueryTests.cs index 5bf1d9a1f..29f3cd21e 100644 --- a/tests/Application.IntegrationTests/KeyValues/Queries/KeyValuesQueryTests.cs +++ b/tests/Application.IntegrationTests/KeyValues/Queries/KeyValuesQueryTests.cs @@ -2,12 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. using CleanArchitecture.Blazor.Application.Features.KeyValues.Queries.ByName; -using CleanArchitecture.Blazor.Domain; using CleanArchitecture.Blazor.Domain.Enums; using FluentAssertions; using NUnit.Framework; -namespace CleanArchitecture.Application.IntegrationTests.KeyValues.Queries +namespace CleanArchitecture.Blazor.Application.IntegrationTests.KeyValues.Queries { using static Testing; public class KeyValuesQueryTests : TestBase diff --git a/tests/Application.IntegrationTests/KeyValues/Queries/KeyValuesWithPaginationQueryTests.cs b/tests/Application.IntegrationTests/KeyValues/Queries/KeyValuesWithPaginationQueryTests.cs index 4679d5bad..4a040948e 100644 --- a/tests/Application.IntegrationTests/KeyValues/Queries/KeyValuesWithPaginationQueryTests.cs +++ b/tests/Application.IntegrationTests/KeyValues/Queries/KeyValuesWithPaginationQueryTests.cs @@ -1,5 +1,4 @@ using System.Threading.Tasks; -using CleanArchitecture.Application.IntegrationTests; using CleanArchitecture.Blazor.Application.Features.KeyValues.Queries.PaginationQuery; using CleanArchitecture.Blazor.Domain.Entities; using CleanArchitecture.Blazor.Domain.Enums; @@ -10,7 +9,7 @@ namespace CleanArchitecture.Blazor.Application.IntegrationTests.KeyValues.Querie internal class KeyValuesWithPaginationQueryTests: TestBase { [SetUp] - public async Task initData() + public async Task InitData() { await AddAsync(new KeyValue() { Name = Picklist.Brand, Text = "Text1", Value = "Value1" ,Description= "Test Description" }); await AddAsync(new KeyValue() { Name = Picklist.Brand, Text = "Text2", Value = "Value2", Description = "Test Description" }); @@ -27,7 +26,7 @@ public async Task ShouldNotEmptyQuery() Assert.AreEqual(5, result.TotalItems); } [Test] - public async Task ShouldNotEmptyKewordQuery() + public async Task ShouldNotEmptyKeywordQuery() { var query = new KeyValuesWithPaginationQuery() { Keyword="1"}; var result = await SendAsync(query); diff --git a/tests/Application.IntegrationTests/Products/Commands/AddEditProductCommandTests.cs b/tests/Application.IntegrationTests/Products/Commands/AddEditProductCommandTests.cs index c6c46485e..3481a8b92 100644 --- a/tests/Application.IntegrationTests/Products/Commands/AddEditProductCommandTests.cs +++ b/tests/Application.IntegrationTests/Products/Commands/AddEditProductCommandTests.cs @@ -1,5 +1,4 @@ using System.Threading.Tasks; -using CleanArchitecture.Application.IntegrationTests; using CleanArchitecture.Blazor.Application.Features.Products.Commands.AddEdit; using CleanArchitecture.Blazor.Domain.Entities; using FluentAssertions; @@ -20,8 +19,8 @@ public void ShouldThrowValidationException() [Test] public async Task InsertItem() { - var addcommand = new AddEditProductCommand() { Name = "Test", Brand="Brand", Price=100m, Unit="EA", Description = "Description" }; - var result = await SendAsync(addcommand); + var addCommand = new AddEditProductCommand() { Name = "Test", Brand="Brand", Price=100m, Unit="EA", Description = "Description" }; + var result = await SendAsync(addCommand); var find = await FindAsync(result.Data); find.Should().NotBeNull(); find.Name.Should().Be("Test"); @@ -32,11 +31,11 @@ public async Task InsertItem() [Test] public async Task UpdateItem() { - var addcommand = new AddEditProductCommand() { Name = "Test", Brand = "Brand", Price = 100m, Unit = "EA", Description = "Description" }; - var result = await SendAsync(addcommand); + var addCommand = new AddEditProductCommand() { Name = "Test", Brand = "Brand", Price = 100m, Unit = "EA", Description = "Description" }; + var result = await SendAsync(addCommand); var find = await FindAsync(result.Data); - var editcommand = new AddEditProductCommand() { Id = find.Id, Name = "Test1", Brand = "Brand1", Price =200m, Unit = "KG", Pictures= addcommand.Pictures, Description = "Description1" }; - await SendAsync(editcommand); + var editCommand = new AddEditProductCommand() { Id = find.Id, Name = "Test1", Brand = "Brand1", Price =200m, Unit = "KG", Pictures= addCommand.Pictures, Description = "Description1" }; + await SendAsync(editCommand); var updated = await FindAsync(find.Id); updated.Should().NotBeNull(); updated.Id.Should().Be(find.Id); diff --git a/tests/Application.IntegrationTests/Products/Commands/DeleteProductCommandTests.cs b/tests/Application.IntegrationTests/Products/Commands/DeleteProductCommandTests.cs index 7ea5e192b..3ea56f156 100644 --- a/tests/Application.IntegrationTests/Products/Commands/DeleteProductCommandTests.cs +++ b/tests/Application.IntegrationTests/Products/Commands/DeleteProductCommandTests.cs @@ -1,6 +1,5 @@ using System.Linq; using System.Threading.Tasks; -using CleanArchitecture.Application.IntegrationTests; using CleanArchitecture.Blazor.Application.Common.ExceptionHandlers; using CleanArchitecture.Blazor.Application.Features.Products.Commands.AddEdit; using CleanArchitecture.Blazor.Application.Features.Products.Commands.Delete; @@ -25,8 +24,8 @@ public void ShouldRequireValidKeyValueId() [Test] public async Task ShouldDeleteOne() { - var addcommand = new AddEditProductCommand() { Name = "Test", Brand = "Brand", Price = 100m, Unit = "EA", Description = "Description" }; - var result = await SendAsync(addcommand); + var addCommand = new AddEditProductCommand() { Name = "Test", Brand = "Brand", Price = 100m, Unit = "EA", Description = "Description" }; + var result = await SendAsync(addCommand); await SendAsync(new DeleteProductCommand(new int[] { result.Data })); @@ -52,8 +51,8 @@ public async Task ShouldDeleteAll() var deleted = await SendAsync(new DeleteProductCommand(id)); deleted.Succeeded.Should().BeTrue(); - var deleteresult = await SendAsync(query); - deleteresult.Should().BeNullOrEmpty(); + var deleteResult = await SendAsync(query); + deleteResult.Should().BeNullOrEmpty(); } diff --git a/tests/Application.IntegrationTests/Products/Commands/ImportProductsCommandTests.cs b/tests/Application.IntegrationTests/Products/Commands/ImportProductsCommandTests.cs index 7485c11db..93782745a 100644 --- a/tests/Application.IntegrationTests/Products/Commands/ImportProductsCommandTests.cs +++ b/tests/Application.IntegrationTests/Products/Commands/ImportProductsCommandTests.cs @@ -1,7 +1,6 @@ using System.IO; using System.Reflection; using System.Threading.Tasks; -using CleanArchitecture.Application.IntegrationTests; using CleanArchitecture.Blazor.Application.Features.Products.Commands.Import; using FluentAssertions; using NUnit.Framework; @@ -23,8 +22,8 @@ public async Task DownloadTemplate() public async Task ImportDataFromExcel() { var dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - var excelfile = Path.Combine(dir,"../../../", "Products", "ImportExcel", "Products.xlsx"); - var data = File.ReadAllBytes(excelfile); + var excelFile = Path.Combine(dir,"../../../", "Products", "ImportExcel", "Products.xlsx"); + var data = File.ReadAllBytes(excelFile); var cmd = new ImportProductsCommand("Products.xlsx", data); var result = await SendAsync(cmd); result.Succeeded.Should().BeTrue(); diff --git a/tests/Application.IntegrationTests/Products/Queries/ExportProductsQueryTests.cs b/tests/Application.IntegrationTests/Products/Queries/ExportProductsQueryTests.cs index e4a528e0d..6589d3bba 100644 --- a/tests/Application.IntegrationTests/Products/Queries/ExportProductsQueryTests.cs +++ b/tests/Application.IntegrationTests/Products/Queries/ExportProductsQueryTests.cs @@ -1,5 +1,4 @@ using System.Threading.Tasks; -using CleanArchitecture.Application.IntegrationTests; using CleanArchitecture.Blazor.Application.Features.Products.Queries.Export; using FluentAssertions; using NUnit.Framework; diff --git a/tests/Application.IntegrationTests/Products/Queries/GetAllProductsQueryTests.cs b/tests/Application.IntegrationTests/Products/Queries/GetAllProductsQueryTests.cs index cc4dda97b..39ef23686 100644 --- a/tests/Application.IntegrationTests/Products/Queries/GetAllProductsQueryTests.cs +++ b/tests/Application.IntegrationTests/Products/Queries/GetAllProductsQueryTests.cs @@ -1,6 +1,5 @@ using System.Linq; using System.Threading.Tasks; -using CleanArchitecture.Application.IntegrationTests; using CleanArchitecture.Blazor.Application.Features.Products.Queries.GetAll; using CleanArchitecture.Blazor.Domain.Entities; using NUnit.Framework; @@ -30,8 +29,8 @@ public async Task ShouldQueryById() var query = new GetAllProductsQuery(); var result = await SendAsync(query); var id= result.Last().Id; - var productquery = new GetProductQuery() { Id = id }; - var product = await SendAsync(productquery); + var getProductQuery = new GetProductQuery() { Id = id }; + var product = await SendAsync(getProductQuery); Assert.AreEqual(id, product.Id); } } diff --git a/tests/Application.IntegrationTests/Products/Queries/ProductsPaginationQueryTests.cs b/tests/Application.IntegrationTests/Products/Queries/ProductsPaginationQueryTests.cs index f3e185f35..e1cda6786 100644 --- a/tests/Application.IntegrationTests/Products/Queries/ProductsPaginationQueryTests.cs +++ b/tests/Application.IntegrationTests/Products/Queries/ProductsPaginationQueryTests.cs @@ -1,5 +1,4 @@ using System.Threading.Tasks; -using CleanArchitecture.Application.IntegrationTests; using CleanArchitecture.Blazor.Application.Features.Products.Queries.Pagination; using CleanArchitecture.Blazor.Domain.Entities; using NUnit.Framework; @@ -25,7 +24,7 @@ public async Task ShouldNotEmptyQuery() Assert.AreEqual(5, result.TotalItems); } [Test] - public async Task ShouldNotEmptyKewordQuery() + public async Task ShouldNotEmptyKeywordQuery() { var query = new ProductsWithPaginationQuery() { Keyword = "1" }; var result = await SendAsync(query); diff --git a/tests/Application.IntegrationTests/Services/PicklistServiceTests.cs b/tests/Application.IntegrationTests/Services/PicklistServiceTests.cs index 32ed45e6f..8e50dd892 100644 --- a/tests/Application.IntegrationTests/Services/PicklistServiceTests.cs +++ b/tests/Application.IntegrationTests/Services/PicklistServiceTests.cs @@ -1,6 +1,5 @@ using System.Linq; using System.Threading.Tasks; -using CleanArchitecture.Application.IntegrationTests; using CleanArchitecture.Blazor.Domain.Entities; using CleanArchitecture.Blazor.Domain.Enums; using NUnit.Framework; diff --git a/tests/Application.IntegrationTests/Services/TenantsServiceTests.cs b/tests/Application.IntegrationTests/Services/TenantsServiceTests.cs index e8841eeea..109ead680 100644 --- a/tests/Application.IntegrationTests/Services/TenantsServiceTests.cs +++ b/tests/Application.IntegrationTests/Services/TenantsServiceTests.cs @@ -1,6 +1,5 @@ using System.Linq; using System.Threading.Tasks; -using CleanArchitecture.Application.IntegrationTests; using CleanArchitecture.Blazor.Domain.Entities; using NUnit.Framework; diff --git a/tests/Application.IntegrationTests/TestBase.cs b/tests/Application.IntegrationTests/TestBase.cs index 76d310187..ae87bd6a6 100644 --- a/tests/Application.IntegrationTests/TestBase.cs +++ b/tests/Application.IntegrationTests/TestBase.cs @@ -1,7 +1,7 @@ using System.Threading.Tasks; using NUnit.Framework; -namespace CleanArchitecture.Application.IntegrationTests +namespace CleanArchitecture.Blazor.Application.IntegrationTests { using static Testing; diff --git a/tests/Application.IntegrationTests/Testing.cs b/tests/Application.IntegrationTests/Testing.cs index ab42da23f..d073bc459 100644 --- a/tests/Application.IntegrationTests/Testing.cs +++ b/tests/Application.IntegrationTests/Testing.cs @@ -2,7 +2,6 @@ using System.IO; using System.Linq; using System.Threading.Tasks; -using CleanArchitecture.Blazor.Application; using CleanArchitecture.Blazor.Application.Common.Interfaces; using CleanArchitecture.Blazor.Application.Common.Interfaces.MultiTenant; using CleanArchitecture.Blazor.Domain.Identity; @@ -20,6 +19,8 @@ using Respawn; using Respawn.Graph; +namespace CleanArchitecture.Blazor.Application.IntegrationTests; + [SetUpFixture] public class Testing { @@ -49,7 +50,7 @@ public async Task RunBeforeAnyTests() w.ApplicationName == "Blazor.Server.UI")); services.AddInfrastructureServices(_configuration) - .AddApplicationServices(); + .AddApplicationServices(); //services.AddLogging(); @@ -193,4 +194,4 @@ public static ITenantService CreateTenantsService() public void RunAfterAnyTests() { } -} +} \ No newline at end of file diff --git a/tests/Application.UnitTests/Common/Exceptions/ValidationExceptionTests.cs b/tests/Application.UnitTests/Common/Exceptions/ValidationExceptionTests.cs index 3b75fd82a..333e8858b 100644 --- a/tests/Application.UnitTests/Common/Exceptions/ValidationExceptionTests.cs +++ b/tests/Application.UnitTests/Common/Exceptions/ValidationExceptionTests.cs @@ -25,7 +25,7 @@ public void SingleValidationFailureCreatesASingleElementErrorDictionary() } [Test] - public void MulitpleValidationFailureForMultiplePropertiesCreatesAMultipleElementErrorDictionaryEachWithMultipleValues() + public void MultipleValidationFailureForMultiplePropertiesCreatesAMultipleElementErrorDictionaryEachWithMultipleValues() { var failures = new List { diff --git a/tests/Domain.UnitTests/ValueObjects/ColourTests.cs b/tests/Domain.UnitTests/ValueObjects/ColourTests.cs index ff008664a..4a1355737 100644 --- a/tests/Domain.UnitTests/ValueObjects/ColourTests.cs +++ b/tests/Domain.UnitTests/ValueObjects/ColourTests.cs @@ -13,7 +13,7 @@ public class ColourTests [Test] public void ShouldReturnCorrectColourCode() { - var code = "#FFFFFF"; + const string code = "#FFFFFF"; var colour = Colour.From(code); From ece2081fe9f2fe7d5c17fdc0e9e11131513a74aa Mon Sep 17 00:00:00 2001 From: Bram1903 <70259613+Bram1903@users.noreply.github.com> Date: Mon, 24 Apr 2023 23:06:01 +0200 Subject: [PATCH 7/7] Changed: Copyright from 2022 to 2023 on another location --- src/Blazor.Server.UI/appsettings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Blazor.Server.UI/appsettings.json b/src/Blazor.Server.UI/appsettings.json index 25009b930..f9e8eb05a 100644 --- a/src/Blazor.Server.UI/appsettings.json +++ b/src/Blazor.Server.UI/appsettings.json @@ -26,7 +26,7 @@ "AppFlavor": "Blazor .NET 7.0", "AppFlavorSubscript": ".NET 7.0", "Company": "Company", - "Copyright": "@2022 Copyright" + "Copyright": "@2023 Copyright" }, "AllowedHosts": "*", "SmtpClientOptions": {