diff --git a/common.props b/common.props index da3e11c8..5ccbc377 100644 --- a/common.props +++ b/common.props @@ -20,7 +20,7 @@ - + all runtime; build; native; contentfiles; analyzers diff --git a/integration/EasyAbp.EShop/src/EasyAbp.EShop.Application.Contracts/EasyAbp.EShop.Application.Contracts.csproj b/integration/EasyAbp.EShop/src/EasyAbp.EShop.Application.Contracts/EasyAbp.EShop.Application.Contracts.csproj index d5253194..6f73f372 100644 --- a/integration/EasyAbp.EShop/src/EasyAbp.EShop.Application.Contracts/EasyAbp.EShop.Application.Contracts.csproj +++ b/integration/EasyAbp.EShop/src/EasyAbp.EShop.Application.Contracts/EasyAbp.EShop.Application.Contracts.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/integration/EasyAbp.EShop/src/EasyAbp.EShop.Application/EasyAbp.EShop.Application.csproj b/integration/EasyAbp.EShop/src/EasyAbp.EShop.Application/EasyAbp.EShop.Application.csproj index 9a79af94..fa679b2d 100644 --- a/integration/EasyAbp.EShop/src/EasyAbp.EShop.Application/EasyAbp.EShop.Application.csproj +++ b/integration/EasyAbp.EShop/src/EasyAbp.EShop.Application/EasyAbp.EShop.Application.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/integration/EasyAbp.EShop/src/EasyAbp.EShop.Domain.Shared/EasyAbp.EShop.Domain.Shared.csproj b/integration/EasyAbp.EShop/src/EasyAbp.EShop.Domain.Shared/EasyAbp.EShop.Domain.Shared.csproj index 814100f6..a0178bd8 100644 --- a/integration/EasyAbp.EShop/src/EasyAbp.EShop.Domain.Shared/EasyAbp.EShop.Domain.Shared.csproj +++ b/integration/EasyAbp.EShop/src/EasyAbp.EShop.Domain.Shared/EasyAbp.EShop.Domain.Shared.csproj @@ -9,7 +9,7 @@ - + diff --git a/integration/EasyAbp.EShop/src/EasyAbp.EShop.Domain/EasyAbp.EShop.Domain.csproj b/integration/EasyAbp.EShop/src/EasyAbp.EShop.Domain/EasyAbp.EShop.Domain.csproj index 1e306ec2..1b10364c 100644 --- a/integration/EasyAbp.EShop/src/EasyAbp.EShop.Domain/EasyAbp.EShop.Domain.csproj +++ b/integration/EasyAbp.EShop/src/EasyAbp.EShop.Domain/EasyAbp.EShop.Domain.csproj @@ -8,7 +8,7 @@ - + diff --git a/integration/EasyAbp.EShop/src/EasyAbp.EShop.EntityFrameworkCore/EasyAbp.EShop.EntityFrameworkCore.csproj b/integration/EasyAbp.EShop/src/EasyAbp.EShop.EntityFrameworkCore/EasyAbp.EShop.EntityFrameworkCore.csproj index 08e9043d..5f270df1 100644 --- a/integration/EasyAbp.EShop/src/EasyAbp.EShop.EntityFrameworkCore/EasyAbp.EShop.EntityFrameworkCore.csproj +++ b/integration/EasyAbp.EShop/src/EasyAbp.EShop.EntityFrameworkCore/EasyAbp.EShop.EntityFrameworkCore.csproj @@ -8,7 +8,7 @@ - + diff --git a/integration/EasyAbp.EShop/src/EasyAbp.EShop.HttpApi.Client/EasyAbp.EShop.HttpApi.Client.csproj b/integration/EasyAbp.EShop/src/EasyAbp.EShop.HttpApi.Client/EasyAbp.EShop.HttpApi.Client.csproj index a4a09eb1..16f437b6 100644 --- a/integration/EasyAbp.EShop/src/EasyAbp.EShop.HttpApi.Client/EasyAbp.EShop.HttpApi.Client.csproj +++ b/integration/EasyAbp.EShop/src/EasyAbp.EShop.HttpApi.Client/EasyAbp.EShop.HttpApi.Client.csproj @@ -8,7 +8,7 @@ - + diff --git a/integration/EasyAbp.EShop/src/EasyAbp.EShop.HttpApi/EasyAbp.EShop.HttpApi.csproj b/integration/EasyAbp.EShop/src/EasyAbp.EShop.HttpApi/EasyAbp.EShop.HttpApi.csproj index 231df789..6fe58b8a 100644 --- a/integration/EasyAbp.EShop/src/EasyAbp.EShop.HttpApi/EasyAbp.EShop.HttpApi.csproj +++ b/integration/EasyAbp.EShop/src/EasyAbp.EShop.HttpApi/EasyAbp.EShop.HttpApi.csproj @@ -8,7 +8,7 @@ - + diff --git a/integration/EasyAbp.EShop/src/EasyAbp.EShop.MongoDB/EasyAbp.EShop.MongoDB.csproj b/integration/EasyAbp.EShop/src/EasyAbp.EShop.MongoDB/EasyAbp.EShop.MongoDB.csproj index b288ee5b..164e4471 100644 --- a/integration/EasyAbp.EShop/src/EasyAbp.EShop.MongoDB/EasyAbp.EShop.MongoDB.csproj +++ b/integration/EasyAbp.EShop/src/EasyAbp.EShop.MongoDB/EasyAbp.EShop.MongoDB.csproj @@ -8,7 +8,7 @@ - + diff --git a/integration/EasyAbp.EShop/src/EasyAbp.EShop.Web/EasyAbp.EShop.Web.csproj b/integration/EasyAbp.EShop/src/EasyAbp.EShop.Web/EasyAbp.EShop.Web.csproj index f2f49fd8..e074ba51 100644 --- a/integration/EasyAbp.EShop/src/EasyAbp.EShop.Web/EasyAbp.EShop.Web.csproj +++ b/integration/EasyAbp.EShop/src/EasyAbp.EShop.Web/EasyAbp.EShop.Web.csproj @@ -12,8 +12,8 @@ - - + + diff --git a/integration/EasyAbp.EShop/test/EasyAbp.EShop.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.HttpApi.Client.ConsoleTestApp.csproj b/integration/EasyAbp.EShop/test/EasyAbp.EShop.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.HttpApi.Client.ConsoleTestApp.csproj index bb0a397e..16b0e57a 100644 --- a/integration/EasyAbp.EShop/test/EasyAbp.EShop.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.HttpApi.Client.ConsoleTestApp.csproj +++ b/integration/EasyAbp.EShop/test/EasyAbp.EShop.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.HttpApi.Client.ConsoleTestApp.csproj @@ -7,7 +7,7 @@ - + diff --git a/integration/EasyAbp.EShop/test/EasyAbp.EShop.TestBase/EasyAbp.EShop.TestBase.csproj b/integration/EasyAbp.EShop/test/EasyAbp.EShop.TestBase/EasyAbp.EShop.TestBase.csproj index ff2fc018..8a2d9790 100644 --- a/integration/EasyAbp.EShop/test/EasyAbp.EShop.TestBase/EasyAbp.EShop.TestBase.csproj +++ b/integration/EasyAbp.EShop/test/EasyAbp.EShop.TestBase/EasyAbp.EShop.TestBase.csproj @@ -14,9 +14,9 @@ - - - + + + diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp.EShop.Orders.Application.Contracts.csproj b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp.EShop.Orders.Application.Contracts.csproj index 4233e16a..5d19afe1 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp.EShop.Orders.Application.Contracts.csproj +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp.EShop.Orders.Application.Contracts.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp.EShop.Orders.Application.csproj b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp.EShop.Orders.Application.csproj index e5947cc7..d7268683 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp.EShop.Orders.Application.csproj +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp.EShop.Orders.Application.csproj @@ -8,9 +8,10 @@ - - + + + diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/BasicPurchasableCheckProvider.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/BasicPurchasableCheckProvider.cs index e0da78f4..8c9252d4 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/BasicPurchasableCheckProvider.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/BasicPurchasableCheckProvider.cs @@ -11,8 +11,7 @@ namespace EasyAbp.EShop.Orders.Orders { public class BasicPurchasableCheckProvider : IPurchasableCheckProvider, ITransientDependency { - public virtual async Task CheckAsync(CreateOrderDto input, Dictionary productDict, - Dictionary orderExtraProperties) + public virtual async Task CheckAsync(CreateOrderDto input, Dictionary productDict) { await CheckProductsPublishedAsync(input, productDict); diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/INewOrderGenerator.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/INewOrderGenerator.cs index fe653e10..efbbd6b1 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/INewOrderGenerator.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/INewOrderGenerator.cs @@ -8,7 +8,6 @@ namespace EasyAbp.EShop.Orders.Orders { public interface INewOrderGenerator { - Task GenerateAsync(CreateOrderDto input, Dictionary productDict, - Dictionary orderExtraProperties); + Task GenerateAsync(CreateOrderDto input, Dictionary productDict); } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/IPurchasableCheckProvider.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/IPurchasableCheckProvider.cs index 98b3c1d1..3bdf79d9 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/IPurchasableCheckProvider.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/IPurchasableCheckProvider.cs @@ -8,7 +8,6 @@ namespace EasyAbp.EShop.Orders.Orders { public interface IPurchasableCheckProvider { - Task CheckAsync(CreateOrderDto input, Dictionary productDict, - Dictionary orderExtraProperties); + Task CheckAsync(CreateOrderDto input, Dictionary productDict); } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/IPurchasableChecker.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/IPurchasableChecker.cs index 572cf8a8..f6c92292 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/IPurchasableChecker.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/IPurchasableChecker.cs @@ -8,7 +8,6 @@ namespace EasyAbp.EShop.Orders.Orders { public interface IPurchasableChecker { - Task CheckAsync(CreateOrderDto input, Dictionary productDict, - Dictionary orderExtraProperties); + Task CheckAsync(CreateOrderDto input, Dictionary productDict); } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/NewOrderGenerator.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/NewOrderGenerator.cs index 31e97994..1f67cb94 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/NewOrderGenerator.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/NewOrderGenerator.cs @@ -12,6 +12,7 @@ using Volo.Abp.DependencyInjection; using Volo.Abp.Guids; using Volo.Abp.Json; using Volo.Abp.MultiTenancy; +using Volo.Abp.ObjectExtending; using Volo.Abp.Users; namespace EasyAbp.EShop.Orders.Orders @@ -38,7 +39,7 @@ namespace EasyAbp.EShop.Orders.Orders _productSkuDescriptionProvider = productSkuDescriptionProvider; } - public virtual async Task GenerateAsync(CreateOrderDto input, Dictionary productDict, Dictionary orderExtraProperties) + public virtual async Task GenerateAsync(CreateOrderDto input, Dictionary productDict) { var orderLines = new List(); @@ -61,10 +62,7 @@ namespace EasyAbp.EShop.Orders.Orders refundedAmount: 0, customerRemark: input.CustomerRemark); - foreach (var orderExtraProperty in orderExtraProperties) - { - order.SetProperty(orderExtraProperty.Key, orderExtraProperty.Value); - } + input.MapExtraPropertiesTo(order, MappingPropertyDefinitionChecks.Both); order.SetOrderLines(orderLines); diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/OrderAppService.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/OrderAppService.cs index 1b966cd0..0681894a 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/OrderAppService.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/OrderAppService.cs @@ -6,6 +6,7 @@ using EasyAbp.EShop.Orders.Authorization; using EasyAbp.EShop.Orders.Orders.Dtos; using EasyAbp.EShop.Products.Products; using EasyAbp.EShop.Products.Products.Dtos; +using EasyAbp.EShop.Stores.Permissions; using Microsoft.AspNetCore.Authorization; using Volo.Abp; using Volo.Abp.Application.Dtos; @@ -67,7 +68,8 @@ namespace EasyAbp.EShop.Orders.Orders if (input.StoreId.HasValue) { - // Todo: Check if current user is an admin of the store. + await AuthorizationService.IsStoreOwnerGrantedAsync(input.StoreId.Value, + OrdersPermissions.Orders.Manage); } else { @@ -86,11 +88,10 @@ namespace EasyAbp.EShop.Orders.Orders if (order.CustomerUserId != CurrentUser.GetId()) { - await AuthorizationService.CheckAsync(OrdersPermissions.Orders.Manage); - - // Todo: Check if current user is an admin of the store. + await AuthorizationService.CheckStoreOwnerAsync(order.StoreId, + OrdersPermissions.Orders.Manage); } - + return MapToGetOutputDto(order); } @@ -103,13 +104,11 @@ namespace EasyAbp.EShop.Orders.Orders var productDict = await GetProductDictionaryAsync(input.OrderLines.Select(dto => dto.ProductId).ToList(), input.StoreId); - var orderExtraProperties = new Dictionary(); + await _purchasableChecker.CheckAsync(input, productDict); - await _purchasableChecker.CheckAsync(input, productDict, orderExtraProperties); - - var order = await _newOrderGenerator.GenerateAsync(input, productDict, orderExtraProperties); + var order = await _newOrderGenerator.GenerateAsync(input, productDict); - await _orderManager.DiscountAsync(order, input.ExtraProperties); + await _orderManager.DiscountAsync(order); await Repository.InsertAsync(order, autoSave: true); @@ -134,7 +133,7 @@ namespace EasyAbp.EShop.Orders.Orders { throw new NotSupportedException(); } - + [RemoteService(false)] public override Task DeleteAsync(Guid id) { @@ -149,11 +148,9 @@ namespace EasyAbp.EShop.Orders.Orders if (order.CustomerUserId != CurrentUser.GetId()) { - await AuthorizationService.CheckAsync(OrdersPermissions.Orders.Manage); - - // Todo: Check if current user is an admin of the store. + await AuthorizationService.CheckStoreOwnerAsync(order.StoreId, OrdersPermissions.Orders.Manage); } - + return MapToGetOutputDto(order); } @@ -161,12 +158,10 @@ namespace EasyAbp.EShop.Orders.Orders public virtual async Task CompleteAsync(CompleteOrderInput input) { var order = await GetEntityByIdAsync(input.OrderId); - + if (order.CustomerUserId != CurrentUser.GetId()) { - await AuthorizationService.CheckAsync(OrdersPermissions.Orders.Manage); - - // Todo: Check if current user is an admin of the store. + await AuthorizationService.CheckStoreOwnerAsync(order.StoreId, OrdersPermissions.Orders.Manage); } order = await _orderManager.CompleteAsync(order); diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/PurchasableChecker.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/PurchasableChecker.cs index ed1bbf19..4648a1f5 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/PurchasableChecker.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/PurchasableChecker.cs @@ -17,14 +17,13 @@ namespace EasyAbp.EShop.Orders.Orders _serviceProvider = serviceProvider; } - public virtual async Task CheckAsync(CreateOrderDto input, Dictionary productDict, - Dictionary orderExtraProperties) + public virtual async Task CheckAsync(CreateOrderDto input, Dictionary productDict) { var providers = _serviceProvider.GetServices(); foreach (var provider in providers) { - await provider.CheckAsync(input, productDict, orderExtraProperties); + await provider.CheckAsync(input, productDict); } } } diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/OrdersApplicationAutoMapperProfile.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/OrdersApplicationAutoMapperProfile.cs index 42e8fa7f..bf0c9484 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/OrdersApplicationAutoMapperProfile.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/OrdersApplicationAutoMapperProfile.cs @@ -1,6 +1,7 @@ using EasyAbp.EShop.Orders.Orders; using EasyAbp.EShop.Orders.Orders.Dtos; using AutoMapper; +using Volo.Abp.ObjectExtending; namespace EasyAbp.EShop.Orders { @@ -11,7 +12,8 @@ namespace EasyAbp.EShop.Orders /* You can configure your AutoMapper mapping configuration here. * Alternatively, you can split your mapping configurations * into multiple profile classes for a better organization. */ - CreateMap(); + CreateMap() + .MapExtraProperties(MappingPropertyDefinitionChecks.Both); CreateMap(); } } diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp.EShop.Orders.Domain.Shared.csproj b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp.EShop.Orders.Domain.Shared.csproj index 4c581bce..b4cb6ac0 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp.EShop.Orders.Domain.Shared.csproj +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp.EShop.Orders.Domain.Shared.csproj @@ -9,7 +9,7 @@ - + diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp.EShop.Orders.Domain.csproj b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp.EShop.Orders.Domain.csproj index 1f671c4c..5d5dc2c7 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp.EShop.Orders.Domain.csproj +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp.EShop.Orders.Domain.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderDiscountProvider.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderDiscountProvider.cs index e3f85c61..2fd6dd4b 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderDiscountProvider.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderDiscountProvider.cs @@ -5,6 +5,6 @@ namespace EasyAbp.EShop.Orders.Orders { public interface IOrderDiscountProvider { - Task DiscountAsync(Order order, Dictionary inputExtraProperties); + Task DiscountAsync(Order order); } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderManager.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderManager.cs index ff6afc69..f5e3ce6b 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderManager.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderManager.cs @@ -6,7 +6,7 @@ namespace EasyAbp.EShop.Orders.Orders { public interface IOrderManager : IDomainService { - Task DiscountAsync(Order order, Dictionary inputExtraProperties); + Task DiscountAsync(Order order); Task CompleteAsync(Order order); } diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderManager.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderManager.cs index bb0000fa..a8bf7622 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderManager.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderManager.cs @@ -19,11 +19,11 @@ namespace EasyAbp.EShop.Orders.Orders _orderRepository = orderRepository; } - public virtual async Task DiscountAsync(Order order, Dictionary inputExtraProperties) + public virtual async Task DiscountAsync(Order order) { foreach (var provider in ServiceProvider.GetServices()) { - await provider.DiscountAsync(order, inputExtraProperties); + await provider.DiscountAsync(order); } return order; diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp.EShop.Orders.EntityFrameworkCore.csproj b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp.EShop.Orders.EntityFrameworkCore.csproj index 06084e49..6a8cebce 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp.EShop.Orders.EntityFrameworkCore.csproj +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp.EShop.Orders.EntityFrameworkCore.csproj @@ -8,7 +8,7 @@ - + diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi.Client/EasyAbp.EShop.Orders.HttpApi.Client.csproj b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi.Client/EasyAbp.EShop.Orders.HttpApi.Client.csproj index 9beb9cd6..9ee137e7 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi.Client/EasyAbp.EShop.Orders.HttpApi.Client.csproj +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi.Client/EasyAbp.EShop.Orders.HttpApi.Client.csproj @@ -8,7 +8,7 @@ - + diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi/EasyAbp.EShop.Orders.HttpApi.csproj b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi/EasyAbp.EShop.Orders.HttpApi.csproj index 7d168598..e2f475da 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi/EasyAbp.EShop.Orders.HttpApi.csproj +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi/EasyAbp.EShop.Orders.HttpApi.csproj @@ -8,7 +8,7 @@ - + diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/EasyAbp.EShop.Orders.MongoDB.csproj b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/EasyAbp.EShop.Orders.MongoDB.csproj index 193a549d..02bf2c53 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/EasyAbp.EShop.Orders.MongoDB.csproj +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/EasyAbp.EShop.Orders.MongoDB.csproj @@ -8,7 +8,7 @@ - + diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/EasyAbp.EShop.Orders.Web.csproj b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/EasyAbp.EShop.Orders.Web.csproj index 1181b13c..6c0fe4d5 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/EasyAbp.EShop.Orders.Web.csproj +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/EasyAbp.EShop.Orders.Web.csproj @@ -12,8 +12,8 @@ - - + + diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/OrdersWebAutoMapperProfile.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/OrdersWebAutoMapperProfile.cs index ab082c0a..9da94e9d 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/OrdersWebAutoMapperProfile.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/OrdersWebAutoMapperProfile.cs @@ -1,5 +1,6 @@ using EasyAbp.EShop.Orders.Orders.Dtos; using AutoMapper; +using Volo.Abp.ObjectExtending; namespace EasyAbp.EShop.Orders.Web { @@ -10,7 +11,8 @@ namespace EasyAbp.EShop.Orders.Web /* You can configure your AutoMapper mapping configuration here. * Alternatively, you can split your mapping configurations * into multiple profile classes for a better organization. */ - CreateMap(); + CreateMap() + .MapExtraProperties(MappingPropertyDefinitionChecks.Both); CreateMap(); } } diff --git a/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Orders.HttpApi.Client.ConsoleTestApp.csproj b/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Orders.HttpApi.Client.ConsoleTestApp.csproj index 0cf6c3b6..708aca8d 100644 --- a/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Orders.HttpApi.Client.ConsoleTestApp.csproj +++ b/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Orders.HttpApi.Client.ConsoleTestApp.csproj @@ -7,7 +7,7 @@ - + diff --git a/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.TestBase/EasyAbp.EShop.Orders.TestBase.csproj b/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.TestBase/EasyAbp.EShop.Orders.TestBase.csproj index b5ce62f0..8d61cc2e 100644 --- a/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.TestBase/EasyAbp.EShop.Orders.TestBase.csproj +++ b/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.TestBase/EasyAbp.EShop.Orders.TestBase.csproj @@ -14,9 +14,9 @@ - - - + + + diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp.EShop.Payments.Application.Contracts.csproj b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp.EShop.Payments.Application.Contracts.csproj index 598bff72..915bbaed 100644 --- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp.EShop.Payments.Application.Contracts.csproj +++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application.Contracts/EasyAbp.EShop.Payments.Application.Contracts.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp.EShop.Payments.Application.csproj b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp.EShop.Payments.Application.csproj index fc41bb90..66023449 100644 --- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp.EShop.Payments.Application.csproj +++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp.EShop.Payments.Application.csproj @@ -8,9 +8,10 @@ - - + + + diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/PaymentAppService.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/PaymentAppService.cs index 13594975..a5acd0b5 100644 --- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/PaymentAppService.cs +++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/PaymentAppService.cs @@ -1,15 +1,14 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using EasyAbp.EShop.Orders.Orders; using EasyAbp.EShop.Orders.Orders.Dtos; using EasyAbp.EShop.Payments.Authorization; -using EasyAbp.EShop.Payments.Payments; using EasyAbp.EShop.Payments.Payments.Dtos; +using EasyAbp.EShop.Stores.Permissions; using EasyAbp.PaymentService.Payments; using Microsoft.AspNetCore.Authorization; -using Volo.Abp; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using Volo.Abp.EventBus.Distributed; @@ -27,8 +26,7 @@ namespace EasyAbp.EShop.Payments.Payments private readonly IPayableChecker _payableChecker; private readonly IDistributedEventBus _distributedEventBus; private readonly IOrderAppService _orderAppService; - private readonly IPaymentRepository _repository; - + public PaymentAppService( IPayableChecker payableChecker, IDistributedEventBus distributedEventBus, @@ -38,7 +36,6 @@ namespace EasyAbp.EShop.Payments.Payments _payableChecker = payableChecker; _distributedEventBus = distributedEventBus; _orderAppService = orderAppService; - _repository = repository; } public override async Task GetAsync(Guid id) @@ -47,14 +44,20 @@ namespace EasyAbp.EShop.Payments.Payments if (payment.UserId != CurrentUser.GetId()) { - await AuthorizationService.CheckAsync(PaymentsPermissions.Payments.Manage); - - // Todo: Check if current user is an admin of the store. + if (payment.StoreId.HasValue) + { + await AuthorizationService.CheckStoreOwnerAsync(payment.StoreId.Value, + PaymentsPermissions.Payments.Manage); + } + else + { + await AuthorizationService.CheckAsync(PaymentsPermissions.Payments.Manage); + } } return payment; } - + protected override IQueryable CreateFilteredQuery(GetPaymentListDto input) { var query = base.CreateFilteredQuery(input); @@ -75,7 +78,8 @@ namespace EasyAbp.EShop.Payments.Payments if (input.StoreId.HasValue) { - // Todo: Check if current user is an admin of the store. + await AuthorizationService.CheckStoreOwnerAsync(input.StoreId.Value, + PaymentsPermissions.Payments.Manage); } else { @@ -85,23 +89,23 @@ namespace EasyAbp.EShop.Payments.Payments return await base.GetListAsync(input); } - + [Authorize(PaymentsPermissions.Payments.Create)] public virtual async Task CreateAsync(CreatePaymentDto input) { var orders = new List(); - + foreach (var orderId in input.OrderIds) { orders.Add(await _orderAppService.GetAsync(orderId)); } - var extraProperties = new Dictionary {{"StoreId", orders.First().StoreId}}; + var extraProperties = new Dictionary { { "StoreId", orders.First().StoreId } }; await _payableChecker.CheckAsync(input, orders, extraProperties); // Todo: should avoid duplicate creations. - + await _distributedEventBus.PublishAsync(new CreatePaymentEto { TenantId = CurrentTenant.Id, diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/RefundAppService.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/RefundAppService.cs index ba60f060..4a9d029a 100644 --- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/RefundAppService.cs +++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/RefundAppService.cs @@ -1,11 +1,11 @@ -using System; -using System.Linq; -using System.Threading.Tasks; using EasyAbp.EShop.Payments.Authorization; using EasyAbp.EShop.Payments.Payments; using EasyAbp.EShop.Payments.Refunds.Dtos; +using EasyAbp.EShop.Stores.Permissions; using Microsoft.AspNetCore.Authorization; -using Volo.Abp; +using System; +using System.Linq; +using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using Volo.Abp.Users; @@ -21,7 +21,7 @@ namespace EasyAbp.EShop.Payments.Refunds private readonly IPaymentRepository _paymentRepository; private readonly IRefundRepository _repository; - + public RefundAppService( IPaymentRepository paymentRepository, IRefundRepository repository) : base(repository) @@ -35,17 +35,22 @@ namespace EasyAbp.EShop.Payments.Refunds var refund = await base.GetAsync(id); var payment = await _paymentRepository.GetAsync(refund.PaymentId); - + if (payment.UserId != CurrentUser.GetId()) { - await AuthorizationService.CheckAsync(PaymentsPermissions.Refunds.Manage); - - // Todo: Check if current user is an admin of the store. + if (payment.StoreId.HasValue) + { + await AuthorizationService.CheckStoreOwnerAsync(payment.StoreId.Value, PaymentsPermissions.Refunds.Manage); + } + else + { + await AuthorizationService.CheckAsync(PaymentsPermissions.Refunds.Manage); + } } return refund; } - + protected override IQueryable CreateFilteredQuery(GetRefundListDto input) { var query = input.UserId.HasValue ? _repository.GetQueryableByUserId(input.UserId.Value) : _repository; @@ -66,7 +71,8 @@ namespace EasyAbp.EShop.Payments.Refunds if (input.StoreId.HasValue) { - // Todo: Check if current user is an admin of the store. + await AuthorizationService.CheckStoreOwnerAsync(input.StoreId.Value, + PaymentsPermissions.Refunds.Manage); } else { diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp.EShop.Payments.Domain.Shared.csproj b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp.EShop.Payments.Domain.Shared.csproj index e24c8c57..fbc64944 100644 --- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp.EShop.Payments.Domain.Shared.csproj +++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp.EShop.Payments.Domain.Shared.csproj @@ -9,7 +9,7 @@ - + diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp.EShop.Payments.Domain.csproj b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp.EShop.Payments.Domain.csproj index 080bcb68..c1869a12 100644 --- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp.EShop.Payments.Domain.csproj +++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp.EShop.Payments.Domain.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.EntityFrameworkCore/EasyAbp.EShop.Payments.EntityFrameworkCore.csproj b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.EntityFrameworkCore/EasyAbp.EShop.Payments.EntityFrameworkCore.csproj index d1c8b000..a8d06c77 100644 --- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.EntityFrameworkCore/EasyAbp.EShop.Payments.EntityFrameworkCore.csproj +++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.EntityFrameworkCore/EasyAbp.EShop.Payments.EntityFrameworkCore.csproj @@ -8,7 +8,7 @@ - + diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.HttpApi.Client/EasyAbp.EShop.Payments.HttpApi.Client.csproj b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.HttpApi.Client/EasyAbp.EShop.Payments.HttpApi.Client.csproj index 25fd567b..eae5d6de 100644 --- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.HttpApi.Client/EasyAbp.EShop.Payments.HttpApi.Client.csproj +++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.HttpApi.Client/EasyAbp.EShop.Payments.HttpApi.Client.csproj @@ -8,7 +8,7 @@ - + diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.HttpApi/EasyAbp.EShop.Payments.HttpApi.csproj b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.HttpApi/EasyAbp.EShop.Payments.HttpApi.csproj index bef8b959..9ec9c095 100644 --- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.HttpApi/EasyAbp.EShop.Payments.HttpApi.csproj +++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.HttpApi/EasyAbp.EShop.Payments.HttpApi.csproj @@ -8,7 +8,7 @@ - + diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.MongoDB/EasyAbp.EShop.Payments.MongoDB.csproj b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.MongoDB/EasyAbp.EShop.Payments.MongoDB.csproj index e171b386..2dd9f834 100644 --- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.MongoDB/EasyAbp.EShop.Payments.MongoDB.csproj +++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.MongoDB/EasyAbp.EShop.Payments.MongoDB.csproj @@ -8,7 +8,7 @@ - + diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Web/EasyAbp.EShop.Payments.Web.csproj b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Web/EasyAbp.EShop.Payments.Web.csproj index 2a14610c..5c537731 100644 --- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Web/EasyAbp.EShop.Payments.Web.csproj +++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Web/EasyAbp.EShop.Payments.Web.csproj @@ -12,8 +12,8 @@ - - + + diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp.csproj b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp.csproj index 1ff1a7c9..c3f6793a 100644 --- a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp.csproj +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp.csproj @@ -7,7 +7,7 @@ - + diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/EasyAbp.EShop.Payments.TestBase.csproj b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/EasyAbp.EShop.Payments.TestBase.csproj index 582e12bd..c901a17e 100644 --- a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/EasyAbp.EShop.Payments.TestBase.csproj +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/EasyAbp.EShop.Payments.TestBase.csproj @@ -14,9 +14,9 @@ - - - + + + diff --git a/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.Application.Contracts/EasyAbp.EShop.Plugins.Application.Contracts.csproj b/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.Application.Contracts/EasyAbp.EShop.Plugins.Application.Contracts.csproj index 7be88759..62d68e4f 100644 --- a/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.Application.Contracts/EasyAbp.EShop.Plugins.Application.Contracts.csproj +++ b/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.Application.Contracts/EasyAbp.EShop.Plugins.Application.Contracts.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.Application/EasyAbp.EShop.Plugins.Application.csproj b/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.Application/EasyAbp.EShop.Plugins.Application.csproj index ecd82098..08255f92 100644 --- a/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.Application/EasyAbp.EShop.Plugins.Application.csproj +++ b/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.Application/EasyAbp.EShop.Plugins.Application.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.Domain.Shared/EasyAbp.EShop.Plugins.Domain.Shared.csproj b/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.Domain.Shared/EasyAbp.EShop.Plugins.Domain.Shared.csproj index bb2fec65..5757660b 100644 --- a/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.Domain.Shared/EasyAbp.EShop.Plugins.Domain.Shared.csproj +++ b/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.Domain.Shared/EasyAbp.EShop.Plugins.Domain.Shared.csproj @@ -9,7 +9,7 @@ - + diff --git a/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.Domain/EasyAbp.EShop.Plugins.Domain.csproj b/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.Domain/EasyAbp.EShop.Plugins.Domain.csproj index fec1b9bb..b3e37aa7 100644 --- a/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.Domain/EasyAbp.EShop.Plugins.Domain.csproj +++ b/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.Domain/EasyAbp.EShop.Plugins.Domain.csproj @@ -8,7 +8,7 @@ - + diff --git a/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.EntityFrameworkCore/EasyAbp.EShop.Plugins.EntityFrameworkCore.csproj b/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.EntityFrameworkCore/EasyAbp.EShop.Plugins.EntityFrameworkCore.csproj index 8c9d9410..b7c007cc 100644 --- a/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.EntityFrameworkCore/EasyAbp.EShop.Plugins.EntityFrameworkCore.csproj +++ b/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.EntityFrameworkCore/EasyAbp.EShop.Plugins.EntityFrameworkCore.csproj @@ -8,7 +8,7 @@ - + diff --git a/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.HttpApi.Client/EasyAbp.EShop.Plugins.HttpApi.Client.csproj b/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.HttpApi.Client/EasyAbp.EShop.Plugins.HttpApi.Client.csproj index e00eb11a..5b71d7b8 100644 --- a/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.HttpApi.Client/EasyAbp.EShop.Plugins.HttpApi.Client.csproj +++ b/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.HttpApi.Client/EasyAbp.EShop.Plugins.HttpApi.Client.csproj @@ -8,7 +8,7 @@ - + diff --git a/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.HttpApi/EasyAbp.EShop.Plugins.HttpApi.csproj b/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.HttpApi/EasyAbp.EShop.Plugins.HttpApi.csproj index d5dae3b4..a72ca2b3 100644 --- a/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.HttpApi/EasyAbp.EShop.Plugins.HttpApi.csproj +++ b/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.HttpApi/EasyAbp.EShop.Plugins.HttpApi.csproj @@ -8,7 +8,7 @@ - + diff --git a/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.MongoDB/EasyAbp.EShop.Plugins.MongoDB.csproj b/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.MongoDB/EasyAbp.EShop.Plugins.MongoDB.csproj index e15a603d..4fe5485a 100644 --- a/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.MongoDB/EasyAbp.EShop.Plugins.MongoDB.csproj +++ b/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.MongoDB/EasyAbp.EShop.Plugins.MongoDB.csproj @@ -8,7 +8,7 @@ - + diff --git a/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.Web/EasyAbp.EShop.Plugins.Web.csproj b/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.Web/EasyAbp.EShop.Plugins.Web.csproj index 4566e412..fe09d410 100644 --- a/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.Web/EasyAbp.EShop.Plugins.Web.csproj +++ b/modules/EasyAbp.EShop.Plugins/src/EasyAbp.EShop.Plugins.Web/EasyAbp.EShop.Plugins.Web.csproj @@ -12,8 +12,8 @@ - - + + diff --git a/modules/EasyAbp.EShop.Plugins/test/EasyAbp.EShop.Plugins.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Plugins.HttpApi.Client.ConsoleTestApp.csproj b/modules/EasyAbp.EShop.Plugins/test/EasyAbp.EShop.Plugins.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Plugins.HttpApi.Client.ConsoleTestApp.csproj index 7c315b45..149713a8 100644 --- a/modules/EasyAbp.EShop.Plugins/test/EasyAbp.EShop.Plugins.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Plugins.HttpApi.Client.ConsoleTestApp.csproj +++ b/modules/EasyAbp.EShop.Plugins/test/EasyAbp.EShop.Plugins.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Plugins.HttpApi.Client.ConsoleTestApp.csproj @@ -7,7 +7,7 @@ - + diff --git a/modules/EasyAbp.EShop.Plugins/test/EasyAbp.EShop.Plugins.TestBase/EasyAbp.EShop.Plugins.TestBase.csproj b/modules/EasyAbp.EShop.Plugins/test/EasyAbp.EShop.Plugins.TestBase/EasyAbp.EShop.Plugins.TestBase.csproj index 2ed01749..d4818481 100644 --- a/modules/EasyAbp.EShop.Plugins/test/EasyAbp.EShop.Plugins.TestBase/EasyAbp.EShop.Plugins.TestBase.csproj +++ b/modules/EasyAbp.EShop.Plugins/test/EasyAbp.EShop.Plugins.TestBase/EasyAbp.EShop.Plugins.TestBase.csproj @@ -14,9 +14,9 @@ - - - + + + diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp.EShop.Products.Application.Contracts.csproj b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp.EShop.Products.Application.Contracts.csproj index dd94c673..ff8cb48e 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp.EShop.Products.Application.Contracts.csproj +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp.EShop.Products.Application.Contracts.csproj @@ -8,9 +8,9 @@ - - - + + + diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Permissions/ProductsPermissionDefinitionProvider.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Permissions/ProductsPermissionDefinitionProvider.cs index 47cb94b5..dd51ebde 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Permissions/ProductsPermissionDefinitionProvider.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Permissions/ProductsPermissionDefinitionProvider.cs @@ -18,7 +18,8 @@ namespace EasyAbp.EShop.Products.Permissions categories.AddChild(ProductsPermissions.Categories.Create, L("Permission:Create")); categories.AddChild(ProductsPermissions.Categories.Update, L("Permission:Update")); categories.AddChild(ProductsPermissions.Categories.Delete, L("Permission:Delete")); - + categories.AddChild(ProductsPermissions.Categories.ShowHidden, L("Permission:ShowHidden")); + var product = moduleGroup.AddPermission(ProductsPermissions.Products.Default, L("Permission:Product")); product.AddChild(ProductsPermissions.Products.CrossStore, L("Permission:CrossStore")); product.AddChild(ProductsPermissions.Products.Create, L("Permission:Create")); diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Permissions/ProductsPermissions.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Permissions/ProductsPermissions.cs index 42a97ea0..49f882ba 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Permissions/ProductsPermissions.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Permissions/ProductsPermissions.cs @@ -18,6 +18,7 @@ namespace EasyAbp.EShop.Products.Permissions public const string Delete = Default + ".Delete"; public const string Update = Default + ".Update"; public const string Create = Default + ".Create"; + public const string ShowHidden = Default + ".ShowHidden"; } public class Products diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/GetProductListDto.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/GetProductListDto.cs index 561c2981..c9c98591 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/GetProductListDto.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/GetProductListDto.cs @@ -1,10 +1,12 @@ using System; +using System.ComponentModel.DataAnnotations; using Volo.Abp.Application.Dtos; namespace EasyAbp.EShop.Products.Products.Dtos { public class GetProductListDto : PagedAndSortedResultRequestDto { + [Required] public Guid StoreId { get; set; } public Guid? CategoryId { get; set; } diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/IProductAppService.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/IProductAppService.cs index 9dac6b72..e120831d 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/IProductAppService.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/IProductAppService.cs @@ -1,7 +1,6 @@ +using EasyAbp.EShop.Products.Products.Dtos; using System; -using System.Collections.Generic; using System.Threading.Tasks; -using EasyAbp.EShop.Products.Products.Dtos; using Volo.Abp.Application.Services; namespace EasyAbp.EShop.Products.Products diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/NotAllowedToGetProductListWithShowHiddenException.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/NotAllowedToGetProductListWithShowHiddenException.cs similarity index 100% rename from modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/NotAllowedToGetProductListWithShowHiddenException.cs rename to modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/NotAllowedToGetProductListWithShowHiddenException.cs diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/ProductAttributeOptionsDeletionFailedException.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/ProductAttributeOptionsDeletionFailedException.cs similarity index 100% rename from modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/ProductAttributeOptionsDeletionFailedException.cs rename to modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/ProductAttributeOptionsDeletionFailedException.cs diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/ProductAttributesModificationFailedException.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/ProductAttributesModificationFailedException.cs similarity index 100% rename from modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/ProductAttributesModificationFailedException.cs rename to modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/ProductAttributesModificationFailedException.cs diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/StaticProductCannotBeModifiedException.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/StaticProductCannotBeModifiedException.cs similarity index 100% rename from modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/StaticProductCannotBeModifiedException.cs rename to modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/StaticProductCannotBeModifiedException.cs diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/StoreIsNotProductOwnerException.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/StoreIsNotProductOwnerException.cs similarity index 100% rename from modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/StoreIsNotProductOwnerException.cs rename to modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/StoreIsNotProductOwnerException.cs diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp.EShop.Products.Application.csproj b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp.EShop.Products.Application.csproj index 1fe7357b..99b3a948 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp.EShop.Products.Application.csproj +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp.EShop.Products.Application.csproj @@ -8,9 +8,10 @@ - - - + + + + diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Categories/CategoryAppService.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Categories/CategoryAppService.cs index f84a6e40..40ad6d57 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Categories/CategoryAppService.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Categories/CategoryAppService.cs @@ -34,10 +34,7 @@ namespace EasyAbp.EShop.Products.Categories public override async Task> GetListAsync(GetCategoryListDto input) { - // Todo: Check if current user is an admin of the store. - var isCurrentUserStoreAdmin = true && await AuthorizationService.IsGrantedAsync(ProductsPermissions.Categories.Default); - - if (input.ShowHidden && !isCurrentUserStoreAdmin) + if (input.ShowHidden && !await AuthorizationService.IsGrantedAsync(ProductsPermissions.Categories.ShowHidden)) { throw new NotAllowedToGetCategoryListWithShowHiddenException(); } diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductCategories/ProductCategoryAppService.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductCategories/ProductCategoryAppService.cs index f951f2c0..7f9296a9 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductCategories/ProductCategoryAppService.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductCategories/ProductCategoryAppService.cs @@ -1,10 +1,9 @@ +using EasyAbp.EShop.Products.Permissions; +using EasyAbp.EShop.Products.ProductCategories.Dtos; using System; using System.Linq; using System.Threading.Tasks; -using EasyAbp.EShop.Products.Permissions; -using EasyAbp.EShop.Products.ProductCategories.Dtos; using Volo.Abp; -using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; namespace EasyAbp.EShop.Products.ProductCategories diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductInventories/ProductInventoryAppService.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductInventories/ProductInventoryAppService.cs index 6160ff31..8244fc94 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductInventories/ProductInventoryAppService.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductInventories/ProductInventoryAppService.cs @@ -1,10 +1,11 @@ -using System; -using System.Threading.Tasks; using EasyAbp.EShop.Products.Permissions; using EasyAbp.EShop.Products.ProductInventories.Dtos; using EasyAbp.EShop.Products.Products; using EasyAbp.EShop.Products.ProductStores; +using EasyAbp.EShop.Stores.Permissions; using Microsoft.AspNetCore.Authorization; +using System; +using System.Threading.Tasks; using Volo.Abp.Application.Services; using Volo.Abp.Validation; @@ -50,9 +51,9 @@ namespace EasyAbp.EShop.Products.ProductInventories { throw new AbpValidationException("StoreId should not be null."); } - - // Todo: Check if current user is an admin of the store. - + + await AuthorizationService.CheckStoreOwnerAsync(input.StoreId.Value, ProductsPermissions.ProductInventory.Update); + await _productStoreRepository.GetAsync(input.ProductId, input.StoreId.Value); } @@ -65,7 +66,7 @@ namespace EasyAbp.EShop.Products.ProductInventories await _repository.InsertAsync(productInventory, true); } - + await ChangeInventoryAsync(productInventory, input.ChangedInventory); return ObjectMapper.Map(productInventory); diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/ProductAppService.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/ProductAppService.cs index 35c20af2..e9defd0e 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/ProductAppService.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/ProductAppService.cs @@ -1,12 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using EasyAbp.EShop.Products.Permissions; using EasyAbp.EShop.Products.Products.Dtos; using EasyAbp.EShop.Products.ProductStores; using EasyAbp.EShop.Products.ProductTypes; -using Microsoft.AspNetCore.Authorization; +using EasyAbp.EShop.Stores.Permissions; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; @@ -48,9 +48,7 @@ namespace EasyAbp.EShop.Products.Products protected override IQueryable CreateFilteredQuery(GetProductListDto input) { - var query = input.CategoryId.HasValue - ? _repository.WithDetails(input.StoreId, input.CategoryId.Value) - : _repository.WithDetails(input.StoreId); + var query = _repository.WithDetails(input.StoreId, input.CategoryId); return input.ShowHidden ? query : query.Where(x => !x.IsHidden); } @@ -65,30 +63,30 @@ namespace EasyAbp.EShop.Products.Products public override async Task CreateAsync(CreateUpdateProductDto input) { await CheckCreatePolicyAsync(); - + var product = MapToEntity(input); TryToSetTenantId(product); - + await UpdateProductAttributesAsync(product, input); - + await _productManager.CreateAsync(product, input.StoreId, input.CategoryIds); return MapToGetOutputDto(product); } - + public override async Task UpdateAsync(Guid id, CreateUpdateProductDto input) { await CheckUpdatePolicyAsync(); await CheckStoreIsProductOwnerAsync(id, input.StoreId); - + var product = await GetEntityByIdAsync(id); - + CheckProductIsNotStatic(product); - + MapToEntity(input, product); - + await UpdateProductAttributesAsync(product, input); await _productManager.UpdateAsync(product, input.CategoryIds); @@ -111,7 +109,7 @@ namespace EasyAbp.EShop.Products.Products var isProductSkusEmpty = product.ProductSkus.IsNullOrEmpty(); var usedAttributeOptionIds = new HashSet(); - + foreach (var serializedAttributeOptionIds in product.ProductSkus.Select(sku => sku.SerializedAttributeOptionIds)) { foreach (var attributeOptionId in await _attributeOptionIdsSerializer.DeserializeAsync(serializedAttributeOptionIds)) @@ -119,21 +117,21 @@ namespace EasyAbp.EShop.Products.Products usedAttributeOptionIds.Add(attributeOptionId); } } - + foreach (var attributeDto in input.ProductAttributes) { var attribute = product.ProductAttributes.FirstOrDefault(a => a.DisplayName == attributeDto.DisplayName); - + if (attribute == null) { if (!isProductSkusEmpty) { throw new ProductAttributesModificationFailedException(); } - + attribute = new ProductAttribute(GuidGenerator.Create(), attributeDto.DisplayName, attributeDto.Description); - + product.ProductAttributes.Add(attribute); } @@ -145,7 +143,7 @@ namespace EasyAbp.EShop.Products.Products { option = new ProductAttributeOption(GuidGenerator.Create(), optionDto.DisplayName, optionDto.Description); - + attribute.ProductAttributeOptions.Add(option); } } @@ -171,7 +169,7 @@ namespace EasyAbp.EShop.Products.Products { throw new ProductAttributesModificationFailedException(); } - + product.ProductAttributes.RemoveAll(a => removedAttributeNames.Contains(a.DisplayName)); } @@ -188,24 +186,24 @@ namespace EasyAbp.EShop.Products.Products { throw new NotSupportedException(); } - + public virtual async Task GetAsync(Guid id, Guid storeId) { await CheckGetPolicyAsync(); var product = await GetEntityByIdAsync(id); - + if (!product.IsPublished) { await CheckStoreIsProductOwnerAsync(product.Id, storeId); } - + var dto = MapToGetOutputDto(product); - + await LoadDtoInventoryDataAsync(product, dto, storeId); await LoadDtoPriceAsync(product, dto, storeId); - await LoadDtosProductTypeUniqueNameAsync(new[] {dto}); + await LoadDtosProductTypeUniqueNameAsync(new[] { dto }); return dto; } @@ -225,16 +223,16 @@ namespace EasyAbp.EShop.Products.Products await CheckGetPolicyAsync(); var product = await _repository.GetAsync(x => x.UniqueName == code); - + if (!product.IsPublished) { await CheckStoreIsProductOwnerAsync(product.Id, storeId); } - + var dto = MapToGetOutputDto(product); - + await LoadDtoInventoryDataAsync(product, dto, storeId); - + return dto; } @@ -242,9 +240,8 @@ namespace EasyAbp.EShop.Products.Products { await CheckGetListPolicyAsync(); - // Todo: Check if current user is an admin of the store. - var isCurrentUserStoreAdmin = true && await AuthorizationService.IsGrantedAsync(ProductsPermissions.Products.Default); - + var isCurrentUserStoreAdmin = await AuthorizationService.IsStoreOwnerGrantedAsync(input.StoreId, ProductsPermissions.Products.Default); + if (input.ShowHidden && !isCurrentUserStoreAdmin) { throw new NotAllowedToGetProductListWithShowHiddenException(); @@ -252,7 +249,7 @@ namespace EasyAbp.EShop.Products.Products // Todo: Products cache. var query = CreateFilteredQuery(input); - + if (!isCurrentUserStoreAdmin) { query = query.Where(x => x.IsPublished); @@ -266,32 +263,32 @@ namespace EasyAbp.EShop.Products.Products var products = await AsyncExecuter.ToListAsync(query); var items = new List(); - + foreach (var product in products) { var productDto = MapToGetListOutputDto(product); - + await LoadDtoInventoryDataAsync(product, productDto, input.StoreId); await LoadDtoPriceAsync(product, productDto, input.StoreId); items.Add(productDto); } - + await LoadDtosProductTypeUniqueNameAsync(items); - + return new PagedResultDto(totalCount, items); } - + protected virtual async Task LoadDtoInventoryDataAsync(Product product, ProductDto productDto, Guid storeId) { var inventoryDataDict = await _productInventoryProvider.GetInventoryDataDictionaryAsync(product, storeId); productDto.Sold = 0; - + foreach (var productSkuDto in productDto.ProductSkus) { var inventoryData = inventoryDataDict[productSkuDto.Id]; - + productSkuDto.Inventory = inventoryData.Inventory; productSkuDto.Sold = inventoryData.Sold; productDto.Sold += productSkuDto.Sold; @@ -322,7 +319,7 @@ namespace EasyAbp.EShop.Products.Products await CheckDeletePolicyAsync(); var product = await GetEntityByIdAsync(id); - + CheckProductIsNotStatic(product); await CheckStoreIsProductOwnerAsync(id, storeId); @@ -341,28 +338,28 @@ namespace EasyAbp.EShop.Products.Products public async Task CreateSkuAsync(Guid productId, Guid storeId, CreateProductSkuDto input) { await CheckUpdatePolicyAsync(); - + await CheckStoreIsProductOwnerAsync(productId, storeId); - + var product = await GetEntityByIdAsync(productId); CheckProductIsNotStatic(product); - + var sku = ObjectMapper.Map(input); EntityHelper.TrySetId(sku, GuidGenerator.Create); await _productManager.CreateSkuAsync(product, sku); - + return ObjectMapper.Map(product); } - + public async Task UpdateSkuAsync(Guid productId, Guid productSkuId, Guid storeId, UpdateProductSkuDto input) { await CheckUpdatePolicyAsync(); - + await CheckStoreIsProductOwnerAsync(productId, storeId); - + var product = await GetEntityByIdAsync(productId); CheckProductIsNotStatic(product); @@ -372,18 +369,18 @@ namespace EasyAbp.EShop.Products.Products ObjectMapper.Map(input, sku); await _productManager.UpdateSkuAsync(product, sku); - + return ObjectMapper.Map(product); } public async Task DeleteSkuAsync(Guid productId, Guid productSkuId, Guid storeId) { await CheckUpdatePolicyAsync(); - + await CheckStoreIsProductOwnerAsync(productId, storeId); - + var product = await GetEntityByIdAsync(productId); - + CheckProductIsNotStatic(product); var sku = product.ProductSkus.Single(x => x.Id == productSkuId); diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductsApplicationAutoMapperProfile.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductsApplicationAutoMapperProfile.cs index ac7bcc8c..5e349cc1 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductsApplicationAutoMapperProfile.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductsApplicationAutoMapperProfile.cs @@ -1,22 +1,22 @@ -using System.Linq; -using EasyAbp.EShop.Products.Products; -using EasyAbp.EShop.Products.Products.Dtos; +using AutoMapper; using EasyAbp.EShop.Products.Categories; using EasyAbp.EShop.Products.Categories.Dtos; -using EasyAbp.EShop.Products.ProductTypes; -using EasyAbp.EShop.Products.ProductTypes.Dtos; using EasyAbp.EShop.Products.ProductCategories; using EasyAbp.EShop.Products.ProductCategories.Dtos; -using AutoMapper; -using EasyAbp.EShop.Products.ProductDetails; -using EasyAbp.EShop.Products.ProductDetails.Dtos; using EasyAbp.EShop.Products.ProductDetailHistories; using EasyAbp.EShop.Products.ProductDetailHistories.Dtos; +using EasyAbp.EShop.Products.ProductDetails; +using EasyAbp.EShop.Products.ProductDetails.Dtos; using EasyAbp.EShop.Products.ProductHistories; using EasyAbp.EShop.Products.ProductHistories.Dtos; -using Volo.Abp.AutoMapper; using EasyAbp.EShop.Products.ProductInventories; using EasyAbp.EShop.Products.ProductInventories.Dtos; +using EasyAbp.EShop.Products.Products; +using EasyAbp.EShop.Products.Products.Dtos; +using EasyAbp.EShop.Products.ProductTypes; +using EasyAbp.EShop.Products.ProductTypes.Dtos; +using System.Linq; +using Volo.Abp.AutoMapper; using Volo.Abp.DependencyInjection; namespace EasyAbp.EShop.Products diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp.EShop.Products.Domain.Shared.csproj b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp.EShop.Products.Domain.Shared.csproj index 37082b8e..7e8a44d7 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp.EShop.Products.Domain.Shared.csproj +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp.EShop.Products.Domain.Shared.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/en.json b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/en.json index c2c9aac2..17056c1d 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/en.json +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/en.json @@ -70,7 +70,7 @@ "ProductTypeMultiTenancySide": "ProductTypeMultiTenancySide", "CreateProductType": "CreateProductType", "EditProductType": "EditProductType", - "ProductTypeDeletionConfirmationMessage": "Are you sure to delete the producttype {0}?", + "ProductTypeDeletionConfirmationMessage": "Are you sure to delete the product type {0}?", "Menu:ProductCategory": "MenuProductCategory", "ProductCategory": "ProductCategory", "ProductCategoryTenantId": "ProductCategoryTenantId", @@ -79,7 +79,7 @@ "ProductCategoryDisplayOrder": "ProductCategoryDisplayOrder", "CreateProductCategory": "CreateProductCategory", "EditProductCategory": "EditProductCategory", - "ProductCategoryDeletionConfirmationMessage": "Are you sure to delete the productcategory {0}?", + "ProductCategoryDeletionConfirmationMessage": "Are you sure to delete the product category {0}?", "Permission:ProductInventory": "ProductInventory", "Permission:Create": "Create", "Permission:Update": "Update", diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Products/IProductSku.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Products/IProductSku.cs index 7dc3231c..0d1117cc 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Products/IProductSku.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Products/IProductSku.cs @@ -20,6 +20,6 @@ namespace EasyAbp.EShop.Products.Products string MediaResources { get; } - public Guid? ProductDetailId { get; } + Guid? ProductDetailId { get; } } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp.EShop.Products.Domain.csproj b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp.EShop.Products.Domain.csproj index f7cb7745..9c7a64ff 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp.EShop.Products.Domain.csproj +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp.EShop.Products.Domain.csproj @@ -8,9 +8,9 @@ - - - + + + diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/ProductStores/IProductStoreRepository.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/ProductStores/IProductStoreRepository.cs index 302f69a6..ee295c5c 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/ProductStores/IProductStoreRepository.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/ProductStores/IProductStoreRepository.cs @@ -7,6 +7,6 @@ namespace EasyAbp.EShop.Products.ProductStores { public interface IProductStoreRepository : IRepository { - Task GetAsync(Guid productId, Guid storeId, CancellationToken cancellationToken = default); + Task GetAsync(Guid productId, Guid storeId, bool includeDetails = true, CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductRepository.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductRepository.cs index 1e1ab030..47b08be5 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductRepository.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductRepository.cs @@ -6,13 +6,8 @@ namespace EasyAbp.EShop.Products.Products { public interface IProductRepository : IRepository { - IQueryable GetQueryable(Guid storeId, Guid categoryId); - - IQueryable GetQueryable(Guid storeId); - - IQueryable WithDetails(Guid storeId, Guid categoryId); - - IQueryable WithDetails(Guid storeId); - + IQueryable GetQueryable(Guid storeId, Guid? categoryId = null); + + IQueryable WithDetails(Guid storeId, Guid? categoryId = null); } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/Product.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/Product.cs index bbd034af..782b0604 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/Product.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/Product.cs @@ -1,7 +1,6 @@ +using JetBrains.Annotations; using System; using System.Collections.Generic; -using EasyAbp.EShop.Products.ProductDetails; -using JetBrains.Annotations; using Volo.Abp.Domain.Entities.Auditing; namespace EasyAbp.EShop.Products.Products diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductManager.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductManager.cs index a15d09c9..698ed8e0 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductManager.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductManager.cs @@ -1,10 +1,10 @@ -using System; +using EasyAbp.EShop.Products.ProductCategories; +using EasyAbp.EShop.Products.ProductStores; +using Microsoft.Extensions.DependencyInjection; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using EasyAbp.EShop.Products.ProductCategories; -using EasyAbp.EShop.Products.ProductStores; -using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Domain.Services; namespace EasyAbp.EShop.Products.Products @@ -51,7 +51,8 @@ namespace EasyAbp.EShop.Products.Products return product; } - public virtual async Task UpdateAsync(Product product, IEnumerable categoryIds = null) + public virtual async Task UpdateAsync(Product product, + IEnumerable categoryIds = null) { await CheckProductCodeUniqueAsync(product); @@ -168,14 +169,16 @@ namespace EasyAbp.EShop.Products.Products protected virtual async Task UpdateProductCategoriesAsync(Guid productId, IEnumerable categoryIds) { - await _productCategoryRepository.DeleteAsync(x => x.ProductId.Equals(productId)); + categoryIds ??= new List(); - if (categoryIds == null) + var productCategories = await _productCategoryRepository.GetListByProductIdAsync(productId); + + foreach (var productCategory in productCategories.Where(x => !categoryIds.Contains(x.CategoryId))) { - return; + await _productCategoryRepository.DeleteAsync(productCategory, true); } - - foreach (var categoryId in categoryIds) + + foreach (var categoryId in categoryIds.Except(productCategories.Select(x => x.CategoryId))) { await _productCategoryRepository.InsertAsync( new ProductCategory(GuidGenerator.Create(), CurrentTenant.Id, categoryId, productId), true); diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp.EShop.Products.EntityFrameworkCore.csproj b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp.EShop.Products.EntityFrameworkCore.csproj index 54fe8eab..129fd9a5 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp.EShop.Products.EntityFrameworkCore.csproj +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp.EShop.Products.EntityFrameworkCore.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/ProductStores/ProductStoreRepository.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/ProductStores/ProductStoreRepository.cs index 80bcce77..cb5d94a3 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/ProductStores/ProductStoreRepository.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/ProductStores/ProductStoreRepository.cs @@ -1,9 +1,7 @@ +using EasyAbp.EShop.Products.EntityFrameworkCore; using System; -using System.Linq; using System.Threading; using System.Threading.Tasks; -using EasyAbp.EShop.Products.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore; using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; @@ -16,14 +14,13 @@ namespace EasyAbp.EShop.Products.ProductStores { } - public virtual async Task GetAsync(Guid productId, Guid storeId, CancellationToken cancellationToken = default) + public virtual async Task GetAsync(Guid productId, Guid storeId, bool includeDetails = true, CancellationToken cancellationToken = default) { - var entity = await GetQueryable().Where(x => x.ProductId == productId && x.StoreId == storeId) - .FirstOrDefaultAsync(cancellationToken); + var entity = await FindAsync(x => x.ProductId == productId && x.StoreId == storeId, includeDetails, cancellationToken); if (entity == null) { - throw new EntityNotFoundException(typeof(ProductStore), new {ProductId = productId, StoreId = storeId}); + throw new EntityNotFoundException(typeof(ProductStore), new { ProductId = productId, StoreId = storeId }); } return entity; diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/Products/ProductRepository.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/Products/ProductRepository.cs index 470df422..523ce417 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/Products/ProductRepository.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/Products/ProductRepository.cs @@ -20,22 +20,36 @@ namespace EasyAbp.EShop.Products.Products .Include(x => x.ProductSkus); } - public IQueryable GetQueryable(Guid storeId, Guid categoryId) + public IQueryable GetQueryable(Guid storeId, Guid? categoryId = null) { - return JoinProductCategories(GetQueryable(storeId), categoryId); + var queryable = GetStoreQueryable(storeId); + + if (categoryId.HasValue) + { + queryable = JoinProductCategories(queryable, categoryId.Value); + } + + return queryable; } - - public IQueryable GetQueryable(Guid storeId) + + public IQueryable WithDetails(Guid storeId, Guid? categoryId = null) { - return JoinProductStores(GetQueryable(), storeId); + var queryable = WithStoreDetails(storeId); + + if (categoryId.HasValue) + { + queryable = JoinProductCategories(queryable, categoryId.Value); + } + + return queryable; } - - public IQueryable WithDetails(Guid storeId, Guid categoryId) + + protected virtual IQueryable GetStoreQueryable(Guid storeId) { - return JoinProductCategories(WithDetails(storeId), categoryId); + return JoinProductStores(GetQueryable(), storeId); } - - public IQueryable WithDetails(Guid storeId) + + protected virtual IQueryable WithStoreDetails(Guid storeId) { return JoinProductStores(WithDetails(), storeId); } @@ -49,7 +63,7 @@ namespace EasyAbp.EShop.Products.Products (product, productStore) => product ); } - + protected virtual IQueryable JoinProductCategories(IQueryable queryable, Guid categoryId) { return queryable.Join( diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi.Client/EasyAbp.EShop.Products.HttpApi.Client.csproj b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi.Client/EasyAbp.EShop.Products.HttpApi.Client.csproj index bac6ae7a..d414adb9 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi.Client/EasyAbp.EShop.Products.HttpApi.Client.csproj +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi.Client/EasyAbp.EShop.Products.HttpApi.Client.csproj @@ -8,7 +8,7 @@ - + diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi/EasyAbp.EShop.Products.HttpApi.csproj b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi/EasyAbp.EShop.Products.HttpApi.csproj index 74384517..b7f69632 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi/EasyAbp.EShop.Products.HttpApi.csproj +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi/EasyAbp.EShop.Products.HttpApi.csproj @@ -8,7 +8,7 @@ - + diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi/EasyAbp/EShop/Products/Products/ProductController.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi/EasyAbp/EShop/Products/Products/ProductController.cs index aa9bda8c..b806d0af 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi/EasyAbp/EShop/Products/Products/ProductController.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.HttpApi/EasyAbp/EShop/Products/Products/ProductController.cs @@ -18,9 +18,9 @@ namespace EasyAbp.EShop.Products.Products _service = service; } - [HttpGet] - [Route("{id}/abandoned")] + [Route("{id}")] [RemoteService(false)] + [NonAction] public Task GetAsync(Guid id) { return _service.GetAsync(id); @@ -45,8 +45,7 @@ namespace EasyAbp.EShop.Products.Products return _service.UpdateAsync(id, input); } - [HttpDelete] - [Route("{id}/abandoned")] + [NonAction] [RemoteService(false)] public Task DeleteAsync(Guid id) { diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.MongoDB/EasyAbp.EShop.Products.MongoDB.csproj b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.MongoDB/EasyAbp.EShop.Products.MongoDB.csproj index 5abb1036..e47053b9 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.MongoDB/EasyAbp.EShop.Products.MongoDB.csproj +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.MongoDB/EasyAbp.EShop.Products.MongoDB.csproj @@ -8,7 +8,7 @@ - + diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/EasyAbp.EShop.Products.Web.csproj b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/EasyAbp.EShop.Products.Web.csproj index f4e3528c..96d37c54 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/EasyAbp.EShop.Products.Web.csproj +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/EasyAbp.EShop.Products.Web.csproj @@ -12,8 +12,8 @@ - - + + diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Menus/ProductsMenuContributor.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Menus/ProductsMenuContributor.cs index b642997d..55b46a33 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Menus/ProductsMenuContributor.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Menus/ProductsMenuContributor.cs @@ -1,10 +1,7 @@ -using System.Collections.Generic; using EasyAbp.EShop.Products.Localization; using EasyAbp.EShop.Products.Permissions; +using System.Collections.Generic; using System.Threading.Tasks; -using EasyAbp.EShop.Products.Localization; -using EasyAbp.EShop.Stores.Stores; -using Microsoft.Extensions.DependencyInjection; using Volo.Abp.UI.Navigation; namespace EasyAbp.EShop.Products.Web.Menus @@ -21,7 +18,9 @@ namespace EasyAbp.EShop.Products.Web.Menus private async Task ConfigureMainMenu(MenuConfigurationContext context) { - var l = context.GetLocalizer(); //Add main menu items. + var l = context.GetLocalizer(); + + //Add main menu items. var productManagementMenuItem = new ApplicationMenuItem(ProductsMenus.Prefix, l["Menu:ProductManagement"]); @@ -41,12 +40,8 @@ namespace EasyAbp.EShop.Products.Web.Menus if (await context.IsGrantedAsync(ProductsPermissions.Products.Default)) { - var storeAppService = context.ServiceProvider.GetRequiredService(); - - var defaultStore = (await storeAppService.GetDefaultAsync())?.Id; - productManagementMenuItem.AddItem( - new ApplicationMenuItem(ProductsMenus.Product, l["Menu:Product"], "/EShop/Products/Products/Product?storeId=" + defaultStore) + new ApplicationMenuItem(ProductsMenus.Product, l["Menu:Product"], "/EShop/Products/Products/Product") ); } diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Menus/ProductsMenus.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Menus/ProductsMenus.cs index ef679742..90f85536 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Menus/ProductsMenus.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Menus/ProductsMenus.cs @@ -9,7 +9,7 @@ public const string ProductType = Prefix + ".ProductType"; public const string Category = Prefix + ".Category"; - + public const string Product = Prefix + ".Product"; //Add your menu items here... diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/CreateModal.cshtml.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/CreateModal.cshtml.cs index 43771b3b..20e67951 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/CreateModal.cshtml.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/CreateModal.cshtml.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using EasyAbp.EShop.Products.Categories; using EasyAbp.EShop.Products.Categories.Dtos; using EasyAbp.EShop.Products.ProductDetails; @@ -12,6 +8,10 @@ using EasyAbp.EShop.Products.ProductTypes; using EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product.ViewModels; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; using Volo.Abp.Application.Dtos; namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product @@ -20,14 +20,16 @@ namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product { [BindProperty(SupportsGet = true)] public Guid StoreId { get; set; } - + [BindProperty] public CreateEditProductViewModel Product { get; set; } - + public ICollection ProductTypes { get; set; } - + public ICollection Categories { get; set; } + public ICollection Tags { get; set; } + private readonly IProductTypeAppService _productTypeAppService; private readonly ICategoryAppService _categoryAppService; private readonly IProductDetailAppService _productDetailAppService; @@ -45,18 +47,18 @@ namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product _service = service; } - public virtual async Task OnGetAsync(Guid? categoryId) + public virtual async Task OnGetAsync(Guid? categoryId, Guid? tagId) { ProductTypes = (await _productTypeAppService.GetListAsync(new PagedAndSortedResultRequestDto - {MaxResultCount = LimitedResultRequestDto.MaxMaxResultCount})).Items + { MaxResultCount = LimitedResultRequestDto.MaxMaxResultCount })).Items .Select(dto => new SelectListItem(dto.DisplayName, dto.Id.ToString())).ToList(); - + Categories = (await _categoryAppService.GetListAsync(new GetCategoryListDto - {MaxResultCount = LimitedResultRequestDto.MaxMaxResultCount}))?.Items + { MaxResultCount = LimitedResultRequestDto.MaxMaxResultCount }))?.Items .Select(dto => new SelectListItem(dto.DisplayName, dto.Id.ToString())).ToList(); - + Product = new CreateEditProductViewModel { StoreId = StoreId, @@ -68,10 +70,15 @@ namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product if (categoryId.HasValue) { - Product.CategoryIds = new List(new[] {categoryId.Value}); + Product.CategoryIds = new List(new[] { categoryId.Value }); + } + + if (tagId.HasValue) + { + Product.TagIds = new List(new[] { tagId.Value }); } } - + public virtual async Task OnPostAsync() { var detail = await _productDetailAppService.CreateAsync( @@ -81,7 +88,7 @@ namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product var createDto = ObjectMapper.Map(Product); createDto.ProductDetailId = detail.Id; - + var product = await _service.CreateAsync(createDto); return NoContent(); diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/EditModal.cshtml.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/EditModal.cshtml.cs index 0663b796..55fc1270 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/EditModal.cshtml.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/EditModal.cshtml.cs @@ -1,19 +1,19 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using EasyAbp.EShop.Products.Categories; using EasyAbp.EShop.Products.Categories.Dtos; using EasyAbp.EShop.Products.ProductCategories; using EasyAbp.EShop.Products.ProductCategories.Dtos; using EasyAbp.EShop.Products.ProductDetails; using EasyAbp.EShop.Products.ProductDetails.Dtos; -using Microsoft.AspNetCore.Mvc; using EasyAbp.EShop.Products.Products; using EasyAbp.EShop.Products.Products.Dtos; using EasyAbp.EShop.Products.ProductTypes; using EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product.ViewModels; +using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; using Volo.Abp.Application.Dtos; namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product @@ -31,6 +31,8 @@ namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product public ICollection Categories { get; set; } + public ICollection Tags { get; set; } + private readonly IProductTypeAppService _productTypeAppService; private readonly ICategoryAppService _categoryAppService; private readonly IProductDetailAppService _productDetailAppService; @@ -74,7 +76,7 @@ namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product ProductId = productDto.Id, MaxResultCount = LimitedResultRequestDto.MaxMaxResultCount })).Items.Select(x => x.CategoryId).ToList(); - + Product.ProductDetail = new CreateEditProductDetailViewModel { StoreId = storeId, diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/Index.cshtml b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/Index.cshtml index c5ef3d60..548ba20d 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/Index.cshtml +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/Index.cshtml @@ -24,6 +24,7 @@ diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/Index.cshtml.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/Index.cshtml.cs index 8194c851..fd6f9ecc 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/Index.cshtml.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/Index.cshtml.cs @@ -1,30 +1,56 @@ -using System; -using System.Threading.Tasks; +using EasyAbp.EShop.Stores.StoreOwners; +using EasyAbp.EShop.Stores.StoreOwners.Dtos; using EasyAbp.EShop.Stores.Stores; using Microsoft.AspNetCore.Mvc; +using System; +using System.Linq; +using System.Threading.Tasks; namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product { public class IndexModel : ProductsPageModel { private readonly IStoreAppService _storeAppService; + private readonly IStoreOwnerAppService _storeOwnerAppService; [BindProperty(SupportsGet = true)] - public Guid StoreId { get; set; } - + public Guid? StoreId { get; set; } + [BindProperty(SupportsGet = true)] public Guid? CategoryId { get; set; } - + + [BindProperty(SupportsGet = true)] + public Guid? TagId { get; set; } + public string StoreName { get; set; } - - public IndexModel(IStoreAppService storeAppService) + + public IndexModel(IStoreAppService storeAppService, + IStoreOwnerAppService storeOwnerAppService) { _storeAppService = storeAppService; + _storeOwnerAppService = storeOwnerAppService; } - + public virtual async Task OnGetAsync() { - StoreName = (await _storeAppService.GetAsync(StoreId)).Name; + //TODO: Need to handle: when StoreId is empty, and current user owns multiple store + if (!StoreId.HasValue && CurrentUser.Id.HasValue) + { + var storeOwners = await _storeOwnerAppService.GetListAsync(new GetStoreOwnerListDto + { + OwnerId = CurrentUser.Id.Value, + }); + + StoreId = storeOwners.Items.FirstOrDefault()?.StoreId; + } + + if (!StoreId.HasValue) + { + var defaultStore = await _storeAppService.GetDefaultAsync(); + StoreId = defaultStore.Id; + } + + StoreName = (await _storeAppService.GetAsync(StoreId.Value)).Name; } } } diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/ViewModels/CreateEditProductViewModel.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/ViewModels/CreateEditProductViewModel.cs index 6ec35a65..e1ed5a60 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/ViewModels/CreateEditProductViewModel.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/ViewModels/CreateEditProductViewModel.cs @@ -23,7 +23,11 @@ namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.Product.ViewM [SelectItems("Categories")] [Display(Name = "ProductCategory")] public List CategoryIds { get; set; } - + + [SelectItems("Tags")] + [Display(Name = "ProductTag")] + public List TagIds { get; set; } + [Display(Name = "ProductUniqueName")] public string UniqueName { get; set; } diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/index.js b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/index.js index 99b0f255..6f049fd2 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/index.js +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/index.js @@ -15,7 +15,7 @@ $(function () { scrollCollapse: true, order: [[1, "asc"]], ajax: abp.libs.datatables.createAjax(service.getList, function () { - return { storeId: storeId, categoryId: categoryId, showHidden: true } + return { storeId: storeId, categoryId: categoryId, tagId: tagId, showHidden: true } }), columnDefs: [ { @@ -69,6 +69,6 @@ $(function () { $('#NewProductButton').click(function (e) { e.preventDefault(); - createModal.open({ storeId: storeId, categoryId: categoryId }); + createModal.open({ storeId: storeId, categoryId: categoryId, tagId: tagId }); }); }); \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/ProductsWebAutoMapperProfile.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/ProductsWebAutoMapperProfile.cs index 707aacce..b1dc8a78 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/ProductsWebAutoMapperProfile.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/ProductsWebAutoMapperProfile.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using EasyAbp.EShop.Products.Products.Dtos; @@ -20,6 +20,7 @@ namespace EasyAbp.EShop.Products.Web * into multiple profile classes for a better organization. */ CreateMap() .Ignore(model => model.CategoryIds) + .Ignore(model => model.TagIds) .Ignore(model => model.ProductDetail) .Ignore(model => model.StoreId) .ForSourceMember(dto => dto.Sold, opt => opt.DoNotValidate()) @@ -41,11 +42,11 @@ namespace EasyAbp.EShop.Products.Web x.ProductAttributeNames.Split(",", StringSplitOptions.RemoveEmptyEntries).Select((s, i) => new CreateUpdateProductAttributeDto { - DisplayName = s, + DisplayName = s.Trim(), ProductAttributeOptions = new List( x.ProductAttributeOptionNames.SplitToLines(StringSplitOptions.RemoveEmptyEntries)[i] .Split(",", StringSplitOptions.RemoveEmptyEntries).Select(o => - new CreateUpdateProductAttributeOptionDto {DisplayName = o})) + new CreateUpdateProductAttributeOptionDto {DisplayName = o.Trim()})) }))); CreateMap() .Ignore(model => model.StoreId); diff --git a/modules/EasyAbp.EShop.Products/test/EasyAbp.EShop.Products.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Products.HttpApi.Client.ConsoleTestApp.csproj b/modules/EasyAbp.EShop.Products/test/EasyAbp.EShop.Products.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Products.HttpApi.Client.ConsoleTestApp.csproj index d838df6b..9e0db9be 100644 --- a/modules/EasyAbp.EShop.Products/test/EasyAbp.EShop.Products.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Products.HttpApi.Client.ConsoleTestApp.csproj +++ b/modules/EasyAbp.EShop.Products/test/EasyAbp.EShop.Products.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Products.HttpApi.Client.ConsoleTestApp.csproj @@ -7,7 +7,7 @@ - + diff --git a/modules/EasyAbp.EShop.Products/test/EasyAbp.EShop.Products.TestBase/EasyAbp.EShop.Products.TestBase.csproj b/modules/EasyAbp.EShop.Products/test/EasyAbp.EShop.Products.TestBase/EasyAbp.EShop.Products.TestBase.csproj index 61a2674c..3aa085a1 100644 --- a/modules/EasyAbp.EShop.Products/test/EasyAbp.EShop.Products.TestBase/EasyAbp.EShop.Products.TestBase.csproj +++ b/modules/EasyAbp.EShop.Products/test/EasyAbp.EShop.Products.TestBase/EasyAbp.EShop.Products.TestBase.csproj @@ -14,9 +14,9 @@ - - - + + + diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp.EShop.Stores.Application.Contracts.csproj b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp.EShop.Stores.Application.Contracts.csproj index 0f4b5329..dc7b7988 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp.EShop.Stores.Application.Contracts.csproj +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp.EShop.Stores.Application.Contracts.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/EShopStoresApplicationContractsModule.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/EShopStoresApplicationContractsModule.cs index c9fd4104..fb1a51e8 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/EShopStoresApplicationContractsModule.cs +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/EShopStoresApplicationContractsModule.cs @@ -1,4 +1,7 @@ -using Volo.Abp.Application; +using EasyAbp.EShop.Stores.Permissions; +using Microsoft.AspNetCore.Authorization; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Application; using Volo.Abp.Modularity; using Volo.Abp.VirtualFileSystem; using Volo.Abp.Authorization; @@ -12,6 +15,9 @@ namespace EasyAbp.EShop.Stores )] public class EShopStoresApplicationContractsModule : AbpModule { - + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddSingleton(); + } } } diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Permissions/BasicStorePermissionAuthorizationHandler.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Permissions/BasicStorePermissionAuthorizationHandler.cs new file mode 100644 index 00000000..5215bcbb --- /dev/null +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Permissions/BasicStorePermissionAuthorizationHandler.cs @@ -0,0 +1,46 @@ +using System; +using EasyAbp.EShop.Stores.StoreOwners; +using Microsoft.AspNetCore.Authorization; +using System.Security.Principal; +using System.Threading.Tasks; +using Volo.Abp.Authorization.Permissions; + +namespace EasyAbp.EShop.Stores.Permissions +{ + public class BasicStorePermissionAuthorizationHandler : AuthorizationHandler + { + private readonly IStoreOwnerAppService _storeOwnerAppService; + private readonly IPermissionChecker _permissionChecker; + + public BasicStorePermissionAuthorizationHandler(IStoreOwnerAppService storeOwnerAppService, + IPermissionChecker permissionChecker) + { + _storeOwnerAppService = storeOwnerAppService; + _permissionChecker = permissionChecker; + } + + protected override async Task HandleRequirementAsync(AuthorizationHandlerContext context, StorePermissionAuthorizationRequirement requirement) + { + var userId = context.User?.FindUserId(); + if (userId.HasValue) + { + var isStoreOwner = await _storeOwnerAppService.IsStoreOwnerAsync(requirement.StoreId, userId.Value); + + if (isStoreOwner) + { + if (!requirement.PolicyName.IsNullOrWhiteSpace()) + { + if (await _permissionChecker.IsGrantedAsync(context.User, requirement.PolicyName)) + { + context.Succeed(requirement); + } + } + else + { + context.Succeed(requirement); + } + } + } + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Permissions/StoreOwnerAuthorizationExtensions.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Permissions/StoreOwnerAuthorizationExtensions.cs new file mode 100644 index 00000000..b0172516 --- /dev/null +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Permissions/StoreOwnerAuthorizationExtensions.cs @@ -0,0 +1,23 @@ +using Microsoft.AspNetCore.Authorization; +using System; +using System.Threading.Tasks; + +namespace EasyAbp.EShop.Stores.Permissions +{ + public static class StoreOwnerAuthorizationExtensions + { + public static Task IsStoreOwnerGrantedAsync(this IAuthorizationService authorizationService, + Guid storeId, string policyName, object resource = null) + { + return authorizationService.IsGrantedAsync(resource, + new StorePermissionAuthorizationRequirement(storeId, policyName)); + } + + public static Task CheckStoreOwnerAsync(this IAuthorizationService authorizationService, + Guid storeId, string policyName, object resource = null) + { + return authorizationService.CheckAsync(resource, + new StorePermissionAuthorizationRequirement(storeId, policyName)); + } + } +} diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Permissions/StorePermissionAuthorizationRequirement.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Permissions/StorePermissionAuthorizationRequirement.cs new file mode 100644 index 00000000..56a6459a --- /dev/null +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Permissions/StorePermissionAuthorizationRequirement.cs @@ -0,0 +1,18 @@ +using System; +using Microsoft.AspNetCore.Authorization; + +namespace EasyAbp.EShop.Stores.Permissions +{ + public class StorePermissionAuthorizationRequirement : IAuthorizationRequirement + { + internal StorePermissionAuthorizationRequirement(Guid storeId, string policyName = null) + { + StoreId = storeId; + PolicyName = policyName; + } + + public Guid StoreId { get; } + + public string PolicyName { get; } + } +} diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Permissions/StoresPermissionDefinitionProvider.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Permissions/StoresPermissionDefinitionProvider.cs index 77bdb864..6ee9a966 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Permissions/StoresPermissionDefinitionProvider.cs +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Permissions/StoresPermissionDefinitionProvider.cs @@ -12,6 +12,8 @@ namespace EasyAbp.EShop.Stores.Permissions var moduleGroup = context.AddGroup(StoresPermissions.GroupName, L("Permission:Stores")); var stores = moduleGroup.AddPermission(StoresPermissions.Stores.Default, L("Permission:Store")); + stores.AddChild(StoresPermissions.Stores.CrossStore, L("Permission:CrossStore")); + stores.AddChild(StoresPermissions.Stores.Manage, L("Permission:Manage")); stores.AddChild(StoresPermissions.Stores.Create, L("Permission:Create")); stores.AddChild(StoresPermissions.Stores.Update, L("Permission:Update")); stores.AddChild(StoresPermissions.Stores.Delete, L("Permission:Delete"), MultiTenancySides.Host); diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Permissions/StoresPermissions.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Permissions/StoresPermissions.cs index be383fde..61d6173e 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Permissions/StoresPermissions.cs +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Permissions/StoresPermissions.cs @@ -14,6 +14,8 @@ namespace EasyAbp.EShop.Stores.Permissions public class Stores { public const string Default = GroupName + ".Store"; + public const string CrossStore = Default + ".CrossStore"; + public const string Manage = Default + ".Manage"; public const string Delete = Default + ".Delete"; public const string Update = Default + ".Update"; public const string Create = Default + ".Create"; diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/StoreOwners/Dtos/GetStoreOwnerListDto.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/StoreOwners/Dtos/GetStoreOwnerListDto.cs new file mode 100644 index 00000000..2d98b1d9 --- /dev/null +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/StoreOwners/Dtos/GetStoreOwnerListDto.cs @@ -0,0 +1,12 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace EasyAbp.EShop.Stores.StoreOwners.Dtos +{ + public class GetStoreOwnerListDto : PagedAndSortedResultRequestDto + { + public Guid? StoreId { get; set; } + + public Guid? OwnerId { get; set; } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/StoreOwners/Dtos/StoreOwnerDto.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/StoreOwners/Dtos/StoreOwnerDto.cs new file mode 100644 index 00000000..31157a32 --- /dev/null +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/StoreOwners/Dtos/StoreOwnerDto.cs @@ -0,0 +1,12 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace EasyAbp.EShop.Stores.StoreOwners.Dtos +{ + public class StoreOwnerDto : AuditedEntityDto + { + public Guid StoreId { get; set; } + + public Guid OwnerId { get; set; } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/StoreOwners/IStoreOwnerAppService.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/StoreOwners/IStoreOwnerAppService.cs new file mode 100644 index 00000000..c6223354 --- /dev/null +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/StoreOwners/IStoreOwnerAppService.cs @@ -0,0 +1,16 @@ +using System; +using System.Threading.Tasks; +using EasyAbp.EShop.Stores.StoreOwners.Dtos; +using Volo.Abp.Application.Services; + +namespace EasyAbp.EShop.Stores.StoreOwners +{ + public interface IStoreOwnerAppService : + IReadOnlyAppService< + StoreOwnerDto, + Guid, + GetStoreOwnerListDto> + { + Task IsStoreOwnerAsync(Guid storeId, Guid userId); + } +} diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Stores/Dtos/CreateUpdateStoreDto.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Stores/Dtos/CreateUpdateStoreDto.cs index 4e9982bf..209fad58 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Stores/Dtos/CreateUpdateStoreDto.cs +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Stores/Dtos/CreateUpdateStoreDto.cs @@ -1,13 +1,18 @@ using System; +using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; +using Volo.Abp.Application.Dtos; namespace EasyAbp.EShop.Stores.Stores.Dtos { - public class CreateUpdateStoreDto + public class CreateUpdateStoreDto : ExtensibleEntityDto { [Required] [DisplayName("StoreName")] public string Name { get; set; } + + [DisplayName("StoreOwner")] + public ICollection OwnerIds { get; set; } } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Stores/Dtos/StoreDto.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Stores/Dtos/StoreDto.cs index 6d034d47..f4e247ac 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Stores/Dtos/StoreDto.cs +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/Stores/Dtos/StoreDto.cs @@ -3,7 +3,7 @@ using Volo.Abp.Application.Dtos; namespace EasyAbp.EShop.Stores.Stores.Dtos { - public class StoreDto : FullAuditedEntityDto + public class StoreDto : ExtensibleAuditedEntityDto { public string Name { get; set; } } diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp.EShop.Stores.Application.csproj b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp.EShop.Stores.Application.csproj index d68407ab..0daef21b 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp.EShop.Stores.Application.csproj +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp.EShop.Stores.Application.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp/EShop/Stores/StoreOwners/StoreOwnerAppService.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp/EShop/Stores/StoreOwners/StoreOwnerAppService.cs new file mode 100644 index 00000000..bb7009d7 --- /dev/null +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp/EShop/Stores/StoreOwners/StoreOwnerAppService.cs @@ -0,0 +1,54 @@ +using EasyAbp.EShop.Stores.Permissions; +using EasyAbp.EShop.Stores.StoreOwners.Dtos; +using System; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Application.Services; + +namespace EasyAbp.EShop.Stores.StoreOwners +{ + public class StoreOwnerAppService : ReadOnlyAppService, + IStoreOwnerAppService + { + protected override string GetListPolicyName { get; set; } = StoresPermissions.Stores.Default; + + private readonly IStoreOwnerRepository _repository; + + public StoreOwnerAppService(IStoreOwnerRepository repository) : base(repository) + { + _repository = repository; + } + + protected override IQueryable CreateFilteredQuery(GetStoreOwnerListDto input) + { + var queryable = Repository.AsQueryable(); + + if (input.StoreId.HasValue) + { + queryable = queryable.Where(x => x.StoreId == input.StoreId); + } + + if (input.OwnerId.HasValue) + { + queryable = queryable.Where(x => x.OwnerId == input.OwnerId); + } + + return queryable; + } + + [RemoteService(false)] + public override Task GetAsync(Guid id) + { + throw new NotSupportedException(); + } + + [RemoteService(false)] + public async Task IsStoreOwnerAsync(Guid storeId, Guid userId) + { + var storeOwner = await _repository.FindAsync(x => x.OwnerId == userId && x.StoreId == storeId, false); + + return storeOwner != null; + } + } +} diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp/EShop/Stores/Stores/StoreAppService.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp/EShop/Stores/Stores/StoreAppService.cs index aebef321..55cb8fd1 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp/EShop/Stores/Stores/StoreAppService.cs +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp/EShop/Stores/Stores/StoreAppService.cs @@ -1,7 +1,6 @@ +using EasyAbp.EShop.Stores.Stores.Dtos; using System; -using System.Linq; using System.Threading.Tasks; -using EasyAbp.EShop.Stores.Stores.Dtos; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; @@ -11,10 +10,13 @@ namespace EasyAbp.EShop.Stores.Stores IStoreAppService { private readonly IStoreRepository _repository; + private readonly IStoreManager _storeManager; - public StoreAppService(IStoreRepository repository) : base(repository) + public StoreAppService(IStoreRepository repository, + IStoreManager storeManager) : base(repository) { _repository = repository; + _storeManager = storeManager; } public async Task GetDefaultAsync() @@ -22,5 +24,31 @@ namespace EasyAbp.EShop.Stores.Stores // Todo: need to be improved return ObjectMapper.Map(await _repository.FindDefaultStoreAsync()); } + + public override async Task CreateAsync(CreateUpdateStoreDto input) + { + await CheckCreatePolicyAsync(); + + var entity = MapToEntity(input); + + TryToSetTenantId(entity); + + entity = await _storeManager.CreateAsync(entity, input.OwnerIds); + + return MapToGetOutputDto(entity); + } + + public override async Task UpdateAsync(Guid id, CreateUpdateStoreDto input) + { + await CheckUpdatePolicyAsync(); + + var entity = await GetEntityByIdAsync(id); + + MapToEntity(input, entity); + + entity = await _storeManager.UpdateAsync(entity, input.OwnerIds); + + return MapToGetOutputDto(entity); + } } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp/EShop/Stores/StoresApplicationAutoMapperProfile.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp/EShop/Stores/StoresApplicationAutoMapperProfile.cs index 7f600d61..ccb37257 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp/EShop/Stores/StoresApplicationAutoMapperProfile.cs +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application/EasyAbp/EShop/Stores/StoresApplicationAutoMapperProfile.cs @@ -1,6 +1,9 @@ +using AutoMapper; +using EasyAbp.EShop.Stores.StoreOwners; +using EasyAbp.EShop.Stores.StoreOwners.Dtos; using EasyAbp.EShop.Stores.Stores; using EasyAbp.EShop.Stores.Stores.Dtos; -using AutoMapper; +using Volo.Abp.ObjectExtending; namespace EasyAbp.EShop.Stores { @@ -11,8 +14,14 @@ namespace EasyAbp.EShop.Stores /* You can configure your AutoMapper mapping configuration here. * Alternatively, you can split your mapping configurations * into multiple profile classes for a better organization. */ - CreateMap(); - CreateMap(MemberList.Source); + CreateMap() + .MapExtraProperties(MappingPropertyDefinitionChecks.Both); + CreateMap(MemberList.Source) + .MapExtraProperties(MappingPropertyDefinitionChecks.Both) + .ForSourceMember(x => x.OwnerIds, opt => opt.DoNotValidate()); + + CreateMap(); + } } } diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp.EShop.Stores.Domain.Shared.csproj b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp.EShop.Stores.Domain.Shared.csproj index 2a270ba6..f8c45822 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp.EShop.Stores.Domain.Shared.csproj +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp.EShop.Stores.Domain.Shared.csproj @@ -9,7 +9,7 @@ - + diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp.EShop.Stores.Domain.csproj b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp.EShop.Stores.Domain.csproj index 31f32699..485f6190 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp.EShop.Stores.Domain.csproj +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp.EShop.Stores.Domain.csproj @@ -1,4 +1,4 @@ - + @@ -8,7 +8,7 @@ - + diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/StoreOwners/IStoreOwnerRepository.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/StoreOwners/IStoreOwnerRepository.cs new file mode 100644 index 00000000..57da4bb7 --- /dev/null +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/StoreOwners/IStoreOwnerRepository.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; + +namespace EasyAbp.EShop.Stores.StoreOwners +{ + public interface IStoreOwnerRepository : IRepository + { + Task> GetListByStoreIdAsync(Guid storeId, CancellationToken cancellationToken = default); + + Task> GetListByOwnerIdAsync(Guid ownerId, CancellationToken cancellationToken = default); + } +} diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/StoreOwners/StoreOwner.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/StoreOwners/StoreOwner.cs new file mode 100644 index 00000000..91c962ad --- /dev/null +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/StoreOwners/StoreOwner.cs @@ -0,0 +1,26 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace EasyAbp.EShop.Stores.StoreOwners +{ + public class StoreOwner : FullAuditedAggregateRoot, IMultiTenant + { + public virtual Guid? TenantId { get; protected set; } + + public virtual Guid StoreId { get; protected set; } + + public virtual Guid OwnerId { get; protected set; } + + protected StoreOwner() + { + } + + public StoreOwner(Guid id, Guid storeId, Guid ownerId, Guid? tenantId = null) : base(id) + { + StoreId = storeId; + OwnerId = ownerId; + TenantId = tenantId; + } + } +} diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/Stores/IStoreManager.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/Stores/IStoreManager.cs new file mode 100644 index 00000000..40a4cecb --- /dev/null +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/Stores/IStoreManager.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Domain.Services; + +namespace EasyAbp.EShop.Stores.Stores +{ + public interface IStoreManager : IDomainService + { + Task CreateAsync(Store store, IEnumerable ownerIds = null); + + Task UpdateAsync(Store store, IEnumerable ownerIds = null); + } +} diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/Stores/StoreManager.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/Stores/StoreManager.cs new file mode 100644 index 00000000..2f8e66e7 --- /dev/null +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/Stores/StoreManager.cs @@ -0,0 +1,58 @@ +using EasyAbp.EShop.Stores.StoreOwners; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.Domain.Services; + +namespace EasyAbp.EShop.Stores.Stores +{ + public class StoreManager : DomainService, IStoreManager + { + private readonly IStoreRepository _storeRepository; + private readonly IStoreOwnerRepository _storeOwnerRepository; + + public StoreManager(IStoreRepository storeRepository, + IStoreOwnerRepository storeOwnerRepository) + { + _storeRepository = storeRepository; + _storeOwnerRepository = storeOwnerRepository; + } + + public async Task CreateAsync(Store store, IEnumerable ownerIds = null) + { + store = await _storeRepository.InsertAsync(store); + + await UpdateStoreOwnersAsync(store.Id, ownerIds); + + return store; + } + + public async Task UpdateAsync(Store store, IEnumerable ownerIds = null) + { + store = await _storeRepository.UpdateAsync(store); + + await UpdateStoreOwnersAsync(store.Id, ownerIds); + + return store; + } + + protected virtual async Task UpdateStoreOwnersAsync(Guid storeId, IEnumerable ownerIds) + { + ownerIds ??= new List(); + + var storeOwners = await _storeOwnerRepository.GetListByStoreIdAsync(storeId); + + foreach (var storeOwner in storeOwners.Where(x => !ownerIds.Contains(x.OwnerId)).ToList()) + { + await _storeOwnerRepository.DeleteAsync(storeOwner, true); + } + + foreach (var ownerId in ownerIds.Except(storeOwners.Select(x => x.OwnerId).ToList())) + { + await _storeOwnerRepository.InsertAsync( + new StoreOwner(GuidGenerator.Create(), storeId, ownerId, CurrentTenant.Id), true); + } + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp.EShop.Stores.EntityFrameworkCore.csproj b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp.EShop.Stores.EntityFrameworkCore.csproj index 9e8e74b5..ffeecbec 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp.EShop.Stores.EntityFrameworkCore.csproj +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp.EShop.Stores.EntityFrameworkCore.csproj @@ -8,12 +8,8 @@ - + - - - - diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/EShopStoresEntityFrameworkCoreModule.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/EShopStoresEntityFrameworkCoreModule.cs index d31bf8a5..de698069 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/EShopStoresEntityFrameworkCoreModule.cs +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/EShopStoresEntityFrameworkCoreModule.cs @@ -1,3 +1,4 @@ +using EasyAbp.EShop.Stores.StoreOwners; using EasyAbp.EShop.Stores.Stores; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.EntityFrameworkCore; @@ -19,6 +20,7 @@ namespace EasyAbp.EShop.Stores.EntityFrameworkCore * options.AddRepository(); */ options.AddRepository(); + options.AddRepository(); }); } } diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/IStoresDbContext.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/IStoresDbContext.cs index 3f685352..438940c8 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/IStoresDbContext.cs +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/IStoresDbContext.cs @@ -1,3 +1,4 @@ +using EasyAbp.EShop.Stores.StoreOwners; using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; @@ -12,5 +13,7 @@ namespace EasyAbp.EShop.Stores.EntityFrameworkCore * DbSet Questions { get; } */ DbSet Stores { get; set; } + + DbSet StoreOwners { get; set; } } } diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/StoresDbContext.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/StoresDbContext.cs index a57ed827..cc90f2a6 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/StoresDbContext.cs +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/StoresDbContext.cs @@ -1,3 +1,4 @@ +using EasyAbp.EShop.Stores.StoreOwners; using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; @@ -12,6 +13,7 @@ namespace EasyAbp.EShop.Stores.EntityFrameworkCore * public DbSet Questions { get; set; } */ public DbSet Stores { get; set; } + public DbSet StoreOwners { get; set; } public StoresDbContext(DbContextOptions options) : base(options) diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/StoresDbContextModelCreatingExtensions.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/StoresDbContextModelCreatingExtensions.cs index 8b3b905b..f9b97b84 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/StoresDbContextModelCreatingExtensions.cs +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/EntityFrameworkCore/StoresDbContextModelCreatingExtensions.cs @@ -1,5 +1,6 @@ using EasyAbp.EShop.Stores.Stores; using System; +using EasyAbp.EShop.Stores.StoreOwners; using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.EntityFrameworkCore.Modeling; @@ -47,6 +48,13 @@ namespace EasyAbp.EShop.Stores.EntityFrameworkCore b.ConfigureByConvention(); /* Configure more properties here */ }); + + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "StoreOwners", options.Schema); + b.ConfigureByConvention(); + /* Configure more properties here */ + }); } } } diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/StoreOwners/StoreOwnerRepository.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/StoreOwners/StoreOwnerRepository.cs new file mode 100644 index 00000000..760b63be --- /dev/null +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.EntityFrameworkCore/EasyAbp/EShop/Stores/StoreOwners/StoreOwnerRepository.cs @@ -0,0 +1,29 @@ +using EasyAbp.EShop.Stores.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; + +namespace EasyAbp.EShop.Stores.StoreOwners +{ + public class StoreOwnerRepository : EfCoreRepository, IStoreOwnerRepository + { + public StoreOwnerRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + + public async Task> GetListByStoreIdAsync(Guid storeId, CancellationToken cancellationToken = default) + { + return await GetQueryable().Where(pc => pc.StoreId == storeId).ToListAsync(cancellationToken); + } + + public async Task> GetListByOwnerIdAsync(Guid ownerId, CancellationToken cancellationToken = default) + { + return await GetQueryable().Where(pc => pc.OwnerId == ownerId).ToListAsync(cancellationToken); + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi.Client/EasyAbp.EShop.Stores.HttpApi.Client.csproj b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi.Client/EasyAbp.EShop.Stores.HttpApi.Client.csproj index ca512af6..9ce5f270 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi.Client/EasyAbp.EShop.Stores.HttpApi.Client.csproj +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi.Client/EasyAbp.EShop.Stores.HttpApi.Client.csproj @@ -8,7 +8,7 @@ - + diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi/EasyAbp.EShop.Stores.HttpApi.csproj b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi/EasyAbp.EShop.Stores.HttpApi.csproj index 8a0d43ad..01e75b50 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi/EasyAbp.EShop.Stores.HttpApi.csproj +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi/EasyAbp.EShop.Stores.HttpApi.csproj @@ -8,7 +8,7 @@ - + diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi/EasyAbp/EShop/Stores/StoreOwners/StoreOwnerController.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi/EasyAbp/EShop/Stores/StoreOwners/StoreOwnerController.cs new file mode 100644 index 00000000..81d232b2 --- /dev/null +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.HttpApi/EasyAbp/EShop/Stores/StoreOwners/StoreOwnerController.cs @@ -0,0 +1,34 @@ +using EasyAbp.EShop.Stores.StoreOwners.Dtos; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Application.Dtos; + +namespace EasyAbp.EShop.Stores.StoreOwners +{ + [RemoteService(Name = "EShopStores")] + [Route("/api/eShop/stores/storeOwner")] + public class StoreOwnerController : StoresController + { + private readonly IStoreOwnerAppService _service; + + public StoreOwnerController(IStoreOwnerAppService service) + { + _service = service; + } + + [NonAction] + [RemoteService(false)] + public Task GetAsync(Guid id) + { + return _service.GetAsync(id); + } + + [HttpGet] + public Task> GetListAsync(GetStoreOwnerListDto input) + { + return _service.GetListAsync(input); + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.MongoDB/EasyAbp.EShop.Stores.MongoDB.csproj b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.MongoDB/EasyAbp.EShop.Stores.MongoDB.csproj index c85c2201..96eb5f6e 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.MongoDB/EasyAbp.EShop.Stores.MongoDB.csproj +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.MongoDB/EasyAbp.EShop.Stores.MongoDB.csproj @@ -8,7 +8,7 @@ - + diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/EShopStoresWebModule.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/EShopStoresWebModule.cs index 134d0241..6b469bec 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/EShopStoresWebModule.cs +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/EShopStoresWebModule.cs @@ -5,6 +5,7 @@ using EasyAbp.EShop.Stores.Web.Menus; using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; using Volo.Abp.AutoMapper; +using Volo.Abp.Identity; using Volo.Abp.Modularity; using Volo.Abp.UI.Navigation; using Volo.Abp.VirtualFileSystem; @@ -14,7 +15,8 @@ namespace EasyAbp.EShop.Stores.Web [DependsOn( typeof(EShopStoresHttpApiModule), typeof(AbpAspNetCoreMvcUiThemeSharedModule), - typeof(AbpAutoMapperModule) + typeof(AbpAutoMapperModule), + typeof(AbpIdentityApplicationContractsModule) )] public class EShopStoresWebModule : AbpModule { diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/EasyAbp.EShop.Stores.Web.csproj b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/EasyAbp.EShop.Stores.Web.csproj index 5de28a2e..5657a4f8 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/EasyAbp.EShop.Stores.Web.csproj +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/EasyAbp.EShop.Stores.Web.csproj @@ -1,4 +1,4 @@ - + @@ -12,8 +12,9 @@ - - + + + diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/Pages/EShop/Stores/Stores/Store/CreateModal.cshtml.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/Pages/EShop/Stores/Stores/Store/CreateModal.cshtml.cs index 5b8f3281..315e88dc 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/Pages/EShop/Stores/Stores/Store/CreateModal.cshtml.cs +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/Pages/EShop/Stores/Stores/Store/CreateModal.cshtml.cs @@ -1,8 +1,13 @@ +using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using EasyAbp.EShop.Stores.Stores; using EasyAbp.EShop.Stores.Stores.Dtos; using EasyAbp.EShop.Stores.Web.Pages.EShop.Stores.Stores.Store.ViewModels; using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Rendering; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Identity; namespace EasyAbp.EShop.Stores.Web.Pages.EShop.Stores.Stores.Store { @@ -11,16 +16,31 @@ namespace EasyAbp.EShop.Stores.Web.Pages.EShop.Stores.Stores.Store [BindProperty] public CreateEditStoreViewModel Store { get; set; } + public ICollection StoreOwners { get; set; } + private readonly IStoreAppService _service; + private readonly IIdentityUserAppService _userAppService; - public CreateModalModel(IStoreAppService service) + public CreateModalModel(IStoreAppService service, + IIdentityUserAppService userAppService) { _service = service; + _userAppService = userAppService; + } + + public virtual async Task OnGetAsync() + { + StoreOwners = + (await _userAppService.GetListAsync(new GetIdentityUsersInput + { MaxResultCount = LimitedResultRequestDto.MaxMaxResultCount })).Items + .Select(dto => new SelectListItem(dto.UserName, dto.Id.ToString())).ToList(); } public async Task OnPostAsync() { - await _service.CreateAsync(ObjectMapper.Map(Store)); + var createDto = ObjectMapper.Map(Store); + var product = await _service.CreateAsync(createDto); + return NoContent(); } } diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/Pages/EShop/Stores/Stores/Store/EditModal.cshtml.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/Pages/EShop/Stores/Stores/Store/EditModal.cshtml.cs index 7b4f8553..77e07738 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/Pages/EShop/Stores/Stores/Store/EditModal.cshtml.cs +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/Pages/EShop/Stores/Stores/Store/EditModal.cshtml.cs @@ -1,9 +1,16 @@ -using System; -using System.Threading.Tasks; using EasyAbp.EShop.Stores.Stores; using EasyAbp.EShop.Stores.Stores.Dtos; using EasyAbp.EShop.Stores.Web.Pages.EShop.Stores.Stores.Store.ViewModels; using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Rendering; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using EasyAbp.EShop.Stores.StoreOwners; +using EasyAbp.EShop.Stores.StoreOwners.Dtos; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Identity; namespace EasyAbp.EShop.Stores.Web.Pages.EShop.Stores.Stores.Store { @@ -16,17 +23,36 @@ namespace EasyAbp.EShop.Stores.Web.Pages.EShop.Stores.Stores.Store [BindProperty] public CreateEditStoreViewModel Store { get; set; } + public ICollection StoreOwners { get; set; } + private readonly IStoreAppService _service; + private readonly IIdentityUserAppService _userAppService; + private readonly IStoreOwnerAppService _storeOwnerAppService; - public EditModalModel(IStoreAppService service) + public EditModalModel(IStoreAppService service, + IIdentityUserAppService userAppService, + IStoreOwnerAppService storeOwnerAppService) { _service = service; + _userAppService = userAppService; + _storeOwnerAppService = storeOwnerAppService; } public async Task OnGetAsync() { + StoreOwners = + (await _userAppService.GetListAsync(new GetIdentityUsersInput + { MaxResultCount = LimitedResultRequestDto.MaxMaxResultCount })).Items + .Select(x => new SelectListItem(x.UserName, x.Id.ToString())).ToList(); + var dto = await _service.GetAsync(Id); Store = ObjectMapper.Map(dto); + + Store.OwnerIds = (await _storeOwnerAppService.GetListAsync(new GetStoreOwnerListDto + { + StoreId = Id, + MaxResultCount = LimitedResultRequestDto.MaxMaxResultCount + })).Items.Select(x => x.OwnerId).ToList(); } public async Task OnPostAsync() diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/Pages/EShop/Stores/Stores/Store/ViewModels/CreateEditStoreViewModel.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/Pages/EShop/Stores/Stores/Store/ViewModels/CreateEditStoreViewModel.cs index a6a65d72..cddc2499 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/Pages/EShop/Stores/Stores/Store/ViewModels/CreateEditStoreViewModel.cs +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/Pages/EShop/Stores/Stores/Store/ViewModels/CreateEditStoreViewModel.cs @@ -1,11 +1,20 @@ -using System.ComponentModel.DataAnnotations; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; +using Volo.Abp.ObjectExtending; namespace EasyAbp.EShop.Stores.Web.Pages.EShop.Stores.Stores.Store.ViewModels { - public class CreateEditStoreViewModel + public class CreateEditStoreViewModel : ExtensibleObject { [Required] [Display(Name = "StoreName")] public string Name { get; set; } + + + [SelectItems("StoreOwners")] + [Display(Name = "StoreOwner")] + public List OwnerIds { get; set; } } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/StoresWebAutoMapperProfile.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/StoresWebAutoMapperProfile.cs index 85c543a5..beb7bfc1 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/StoresWebAutoMapperProfile.cs +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/StoresWebAutoMapperProfile.cs @@ -1,6 +1,8 @@ using EasyAbp.EShop.Stores.Stores.Dtos; using AutoMapper; using EasyAbp.EShop.Stores.Web.Pages.EShop.Stores.Stores.Store.ViewModels; +using Volo.Abp.AutoMapper; +using Volo.Abp.ObjectExtending; namespace EasyAbp.EShop.Stores.Web { @@ -11,8 +13,11 @@ namespace EasyAbp.EShop.Stores.Web /* You can configure your AutoMapper mapping configuration here. * Alternatively, you can split your mapping configurations * into multiple profile classes for a better organization. */ - CreateMap(); - CreateMap(); + CreateMap() + .MapExtraProperties(MappingPropertyDefinitionChecks.Both) + .Ignore(x=>x.OwnerIds); + CreateMap() + .MapExtraProperties(MappingPropertyDefinitionChecks.Both); } } } diff --git a/modules/EasyAbp.EShop.Stores/test/EasyAbp.EShop.Stores.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Stores.HttpApi.Client.ConsoleTestApp.csproj b/modules/EasyAbp.EShop.Stores/test/EasyAbp.EShop.Stores.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Stores.HttpApi.Client.ConsoleTestApp.csproj index 15ff3344..b94d4774 100644 --- a/modules/EasyAbp.EShop.Stores/test/EasyAbp.EShop.Stores.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Stores.HttpApi.Client.ConsoleTestApp.csproj +++ b/modules/EasyAbp.EShop.Stores/test/EasyAbp.EShop.Stores.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Stores.HttpApi.Client.ConsoleTestApp.csproj @@ -7,7 +7,7 @@ - + diff --git a/modules/EasyAbp.EShop.Stores/test/EasyAbp.EShop.Stores.TestBase/EasyAbp.EShop.Stores.TestBase.csproj b/modules/EasyAbp.EShop.Stores/test/EasyAbp.EShop.Stores.TestBase/EasyAbp.EShop.Stores.TestBase.csproj index 695d4f0a..a0ed473b 100644 --- a/modules/EasyAbp.EShop.Stores/test/EasyAbp.EShop.Stores.TestBase/EasyAbp.EShop.Stores.TestBase.csproj +++ b/modules/EasyAbp.EShop.Stores/test/EasyAbp.EShop.Stores.TestBase/EasyAbp.EShop.Stores.TestBase.csproj @@ -14,9 +14,9 @@ - - - + + + diff --git a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Application.Contracts/EasyAbp.EShop.Plugins.Baskets.Application.Contracts.csproj b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Application.Contracts/EasyAbp.EShop.Plugins.Baskets.Application.Contracts.csproj index 97ac50f2..4453a973 100644 --- a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Application.Contracts/EasyAbp.EShop.Plugins.Baskets.Application.Contracts.csproj +++ b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Application.Contracts/EasyAbp.EShop.Plugins.Baskets.Application.Contracts.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Application/EasyAbp.EShop.Plugins.Baskets.Application.csproj b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Application/EasyAbp.EShop.Plugins.Baskets.Application.csproj index b303d448..cef2ba3f 100644 --- a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Application/EasyAbp.EShop.Plugins.Baskets.Application.csproj +++ b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Application/EasyAbp.EShop.Plugins.Baskets.Application.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Domain.Shared/EasyAbp.EShop.Plugins.Baskets.Domain.Shared.csproj b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Domain.Shared/EasyAbp.EShop.Plugins.Baskets.Domain.Shared.csproj index 979c1520..51f8c0f3 100644 --- a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Domain.Shared/EasyAbp.EShop.Plugins.Baskets.Domain.Shared.csproj +++ b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Domain.Shared/EasyAbp.EShop.Plugins.Baskets.Domain.Shared.csproj @@ -9,11 +9,11 @@ - + - + diff --git a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Domain/EasyAbp.EShop.Plugins.Baskets.Domain.csproj b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Domain/EasyAbp.EShop.Plugins.Baskets.Domain.csproj index 5383439b..b52366b2 100644 --- a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Domain/EasyAbp.EShop.Plugins.Baskets.Domain.csproj +++ b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Domain/EasyAbp.EShop.Plugins.Baskets.Domain.csproj @@ -8,7 +8,7 @@ - + diff --git a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.EntityFrameworkCore/EasyAbp.EShop.Plugins.Baskets.EntityFrameworkCore.csproj b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.EntityFrameworkCore/EasyAbp.EShop.Plugins.Baskets.EntityFrameworkCore.csproj index 1a83545c..a0b997f0 100644 --- a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.EntityFrameworkCore/EasyAbp.EShop.Plugins.Baskets.EntityFrameworkCore.csproj +++ b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.EntityFrameworkCore/EasyAbp.EShop.Plugins.Baskets.EntityFrameworkCore.csproj @@ -8,7 +8,7 @@ - + diff --git a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.HttpApi.Client/EasyAbp.EShop.Plugins.Baskets.HttpApi.Client.csproj b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.HttpApi.Client/EasyAbp.EShop.Plugins.Baskets.HttpApi.Client.csproj index 94f052bd..4ec65305 100644 --- a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.HttpApi.Client/EasyAbp.EShop.Plugins.Baskets.HttpApi.Client.csproj +++ b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.HttpApi.Client/EasyAbp.EShop.Plugins.Baskets.HttpApi.Client.csproj @@ -8,7 +8,7 @@ - + diff --git a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.HttpApi/EasyAbp.EShop.Plugins.Baskets.HttpApi.csproj b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.HttpApi/EasyAbp.EShop.Plugins.Baskets.HttpApi.csproj index 2d8695f1..46b1e21d 100644 --- a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.HttpApi/EasyAbp.EShop.Plugins.Baskets.HttpApi.csproj +++ b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.HttpApi/EasyAbp.EShop.Plugins.Baskets.HttpApi.csproj @@ -8,7 +8,7 @@ - + diff --git a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.MongoDB/EasyAbp.EShop.Plugins.Baskets.MongoDB.csproj b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.MongoDB/EasyAbp.EShop.Plugins.Baskets.MongoDB.csproj index 80e11b34..6faa8d5a 100644 --- a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.MongoDB/EasyAbp.EShop.Plugins.Baskets.MongoDB.csproj +++ b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.MongoDB/EasyAbp.EShop.Plugins.Baskets.MongoDB.csproj @@ -8,7 +8,7 @@ - + diff --git a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Web/EasyAbp.EShop.Plugins.Baskets.Web.csproj b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Web/EasyAbp.EShop.Plugins.Baskets.Web.csproj index 65f6a088..396abdfa 100644 --- a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Web/EasyAbp.EShop.Plugins.Baskets.Web.csproj +++ b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Web/EasyAbp.EShop.Plugins.Baskets.Web.csproj @@ -12,8 +12,8 @@ - - + + diff --git a/plugins/Baskets/test/EasyAbp.EShop.Plugins.Baskets.EntityFrameworkCore.Tests/EasyAbp.EShop.Plugins.Baskets.EntityFrameworkCore.Tests.csproj b/plugins/Baskets/test/EasyAbp.EShop.Plugins.Baskets.EntityFrameworkCore.Tests/EasyAbp.EShop.Plugins.Baskets.EntityFrameworkCore.Tests.csproj index f2419fac..b2ea256f 100644 --- a/plugins/Baskets/test/EasyAbp.EShop.Plugins.Baskets.EntityFrameworkCore.Tests/EasyAbp.EShop.Plugins.Baskets.EntityFrameworkCore.Tests.csproj +++ b/plugins/Baskets/test/EasyAbp.EShop.Plugins.Baskets.EntityFrameworkCore.Tests/EasyAbp.EShop.Plugins.Baskets.EntityFrameworkCore.Tests.csproj @@ -12,7 +12,7 @@ - + diff --git a/plugins/Baskets/test/EasyAbp.EShop.Plugins.Baskets.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Plugins.Baskets.HttpApi.Client.ConsoleTestApp.csproj b/plugins/Baskets/test/EasyAbp.EShop.Plugins.Baskets.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Plugins.Baskets.HttpApi.Client.ConsoleTestApp.csproj index 55abdbb8..2ec4a686 100644 --- a/plugins/Baskets/test/EasyAbp.EShop.Plugins.Baskets.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Plugins.Baskets.HttpApi.Client.ConsoleTestApp.csproj +++ b/plugins/Baskets/test/EasyAbp.EShop.Plugins.Baskets.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Plugins.Baskets.HttpApi.Client.ConsoleTestApp.csproj @@ -7,7 +7,7 @@ - + diff --git a/plugins/Baskets/test/EasyAbp.EShop.Plugins.Baskets.TestBase/EasyAbp.EShop.Plugins.Baskets.TestBase.csproj b/plugins/Baskets/test/EasyAbp.EShop.Plugins.Baskets.TestBase/EasyAbp.EShop.Plugins.Baskets.TestBase.csproj index 77e21e36..80617097 100644 --- a/plugins/Baskets/test/EasyAbp.EShop.Plugins.Baskets.TestBase/EasyAbp.EShop.Plugins.Baskets.TestBase.csproj +++ b/plugins/Baskets/test/EasyAbp.EShop.Plugins.Baskets.TestBase/EasyAbp.EShop.Plugins.Baskets.TestBase.csproj @@ -14,9 +14,9 @@ - - - + + + diff --git a/plugins/ProductTag/.gitattributes b/plugins/ProductTag/.gitattributes new file mode 100644 index 00000000..c941e526 --- /dev/null +++ b/plugins/ProductTag/.gitattributes @@ -0,0 +1 @@ +**/wwwroot/libs/** linguist-vendored diff --git a/plugins/ProductTag/.gitignore b/plugins/ProductTag/.gitignore new file mode 100644 index 00000000..666ef8a0 --- /dev/null +++ b/plugins/ProductTag/.gitignore @@ -0,0 +1,258 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# ProductTag +host/EasyAbp.EShop.Plugins.ProductTag.IdentityServer/Logs/logs.txt +host/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Host/Logs/logs.txt +host/EasyAbp.EShop.Plugins.ProductTag.Web.Host/Logs/logs.txt +host/EasyAbp.EShop.Plugins.ProductTag.Web.Unified/Logs/logs.txt diff --git a/plugins/ProductTag/EasyAbp.EShop.Plugins.ProductTag.sln b/plugins/ProductTag/EasyAbp.EShop.Plugins.ProductTag.sln new file mode 100644 index 00000000..b43e8329 --- /dev/null +++ b/plugins/ProductTag/EasyAbp.EShop.Plugins.ProductTag.sln @@ -0,0 +1,139 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.ProductTag.Domain.Shared", "src\EasyAbp.EShop.Plugins.ProductTag.Domain.Shared\EasyAbp.EShop.Plugins.ProductTag.Domain.Shared.csproj", "{D64C1577-4929-4B60-939E-96DE1534891A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.ProductTag.Domain", "src\EasyAbp.EShop.Plugins.ProductTag.Domain\EasyAbp.EShop.Plugins.ProductTag.Domain.csproj", "{F2840BC7-0188-4606-9126-DADD0F5ABF7A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.ProductTag.Application.Contracts", "src\EasyAbp.EShop.Plugins.ProductTag.Application.Contracts\EasyAbp.EShop.Plugins.ProductTag.Application.Contracts.csproj", "{BD65D04F-08D5-40C1-8C24-77CA0BACB877}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.ProductTag.Application", "src\EasyAbp.EShop.Plugins.ProductTag.Application\EasyAbp.EShop.Plugins.ProductTag.Application.csproj", "{78040F9E-3501-4A40-82DF-00A597710F35}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{649A3FFA-182F-4E56-9717-E6A9A2BEC545}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "host", "host", "{E400416D-2895-4512-9D17-90681EEC7E0A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore", "src\EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore\EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore.csproj", "{0CE86223-D31D-4315-A1F5-87BA3EE1B844}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.ProductTag.MongoDB", "src\EasyAbp.EShop.Plugins.ProductTag.MongoDB\EasyAbp.EShop.Plugins.ProductTag.MongoDB.csproj", "{F1C58097-4C08-4D88-8976-6B3389391481}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.ProductTag.HttpApi", "src\EasyAbp.EShop.Plugins.ProductTag.HttpApi\EasyAbp.EShop.Plugins.ProductTag.HttpApi.csproj", "{077AA5F8-8B61-420C-A6B5-0150A66FDB34}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client", "src\EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client\EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.csproj", "{36E2735F-CEAB-44C8-A6D1-2CDAFF399751}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.ProductTag.TestBase", "test\EasyAbp.EShop.Plugins.ProductTag.TestBase\EasyAbp.EShop.Plugins.ProductTag.TestBase.csproj", "{C5BB573D-3030-4BCB-88B7-F6A85C32766C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore.Tests", "test\EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore.Tests\EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore.Tests.csproj", "{527F645C-C1FC-406E-8479-81386C8ECF13}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests", "test\EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests\EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests.csproj", "{D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.ProductTag.Domain.Tests", "test\EasyAbp.EShop.Plugins.ProductTag.Domain.Tests\EasyAbp.EShop.Plugins.ProductTag.Domain.Tests.csproj", "{E60895E5-79C4-447D-88B7-85CB5BA336A4}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.ProductTag.Application.Tests", "test\EasyAbp.EShop.Plugins.ProductTag.Application.Tests\EasyAbp.EShop.Plugins.ProductTag.Application.Tests.csproj", "{90CB5DC4-C040-45C7-8900-9688B26405BC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.ProductTag.Web", "src\EasyAbp.EShop.Plugins.ProductTag.Web\EasyAbp.EShop.Plugins.ProductTag.Web.csproj", "{3B7B6317-1B85-4164-8E11-75574F80AE17}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp", "test\EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp\EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp.csproj", "{1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.ProductTag.Host.Shared", "host\EasyAbp.EShop.Plugins.ProductTag.Host.Shared\EasyAbp.EShop.Plugins.ProductTag.Host.Shared.csproj", "{F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D64C1577-4929-4B60-939E-96DE1534891A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D64C1577-4929-4B60-939E-96DE1534891A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D64C1577-4929-4B60-939E-96DE1534891A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D64C1577-4929-4B60-939E-96DE1534891A}.Release|Any CPU.Build.0 = Release|Any CPU + {F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Release|Any CPU.Build.0 = Release|Any CPU + {BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Release|Any CPU.Build.0 = Release|Any CPU + {78040F9E-3501-4A40-82DF-00A597710F35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {78040F9E-3501-4A40-82DF-00A597710F35}.Debug|Any CPU.Build.0 = Debug|Any CPU + {78040F9E-3501-4A40-82DF-00A597710F35}.Release|Any CPU.ActiveCfg = Release|Any CPU + {78040F9E-3501-4A40-82DF-00A597710F35}.Release|Any CPU.Build.0 = Release|Any CPU + {0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Release|Any CPU.Build.0 = Release|Any CPU + {F1C58097-4C08-4D88-8976-6B3389391481}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F1C58097-4C08-4D88-8976-6B3389391481}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F1C58097-4C08-4D88-8976-6B3389391481}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F1C58097-4C08-4D88-8976-6B3389391481}.Release|Any CPU.Build.0 = Release|Any CPU + {077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Debug|Any CPU.Build.0 = Debug|Any CPU + {077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Release|Any CPU.ActiveCfg = Release|Any CPU + {077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Release|Any CPU.Build.0 = Release|Any CPU + {36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Debug|Any CPU.Build.0 = Debug|Any CPU + {36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Release|Any CPU.ActiveCfg = Release|Any CPU + {36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Release|Any CPU.Build.0 = Release|Any CPU + {C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Release|Any CPU.Build.0 = Release|Any CPU + {527F645C-C1FC-406E-8479-81386C8ECF13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {527F645C-C1FC-406E-8479-81386C8ECF13}.Debug|Any CPU.Build.0 = Debug|Any CPU + {527F645C-C1FC-406E-8479-81386C8ECF13}.Release|Any CPU.ActiveCfg = Release|Any CPU + {527F645C-C1FC-406E-8479-81386C8ECF13}.Release|Any CPU.Build.0 = Release|Any CPU + {D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}.Release|Any CPU.Build.0 = Release|Any CPU + {E60895E5-79C4-447D-88B7-85CB5BA336A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E60895E5-79C4-447D-88B7-85CB5BA336A4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E60895E5-79C4-447D-88B7-85CB5BA336A4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E60895E5-79C4-447D-88B7-85CB5BA336A4}.Release|Any CPU.Build.0 = Release|Any CPU + {90CB5DC4-C040-45C7-8900-9688B26405BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {90CB5DC4-C040-45C7-8900-9688B26405BC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {90CB5DC4-C040-45C7-8900-9688B26405BC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {90CB5DC4-C040-45C7-8900-9688B26405BC}.Release|Any CPU.Build.0 = Release|Any CPU + {3B7B6317-1B85-4164-8E11-75574F80AE17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3B7B6317-1B85-4164-8E11-75574F80AE17}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3B7B6317-1B85-4164-8E11-75574F80AE17}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3B7B6317-1B85-4164-8E11-75574F80AE17}.Release|Any CPU.Build.0 = Release|Any CPU + {1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Release|Any CPU.Build.0 = Release|Any CPU + {F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {D64C1577-4929-4B60-939E-96DE1534891A} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {F2840BC7-0188-4606-9126-DADD0F5ABF7A} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {BD65D04F-08D5-40C1-8C24-77CA0BACB877} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {78040F9E-3501-4A40-82DF-00A597710F35} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {0CE86223-D31D-4315-A1F5-87BA3EE1B844} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {F1C58097-4C08-4D88-8976-6B3389391481} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {077AA5F8-8B61-420C-A6B5-0150A66FDB34} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {36E2735F-CEAB-44C8-A6D1-2CDAFF399751} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {C5BB573D-3030-4BCB-88B7-F6A85C32766C} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {527F645C-C1FC-406E-8479-81386C8ECF13} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {E60895E5-79C4-447D-88B7-85CB5BA336A4} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {90CB5DC4-C040-45C7-8900-9688B26405BC} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {3B7B6317-1B85-4164-8E11-75574F80AE17} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB} = {E400416D-2895-4512-9D17-90681EEC7E0A} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4324B3B4-B60B-4E3C-91D8-59576B4E26DD} + EndGlobalSection +EndGlobal diff --git a/plugins/ProductTag/EasyAbp.EShop.Plugins.ProductTag.sln.DotSettings b/plugins/ProductTag/EasyAbp.EShop.Plugins.ProductTag.sln.DotSettings new file mode 100644 index 00000000..cb0b2c91 --- /dev/null +++ b/plugins/ProductTag/EasyAbp.EShop.Plugins.ProductTag.sln.DotSettings @@ -0,0 +1,23 @@ + + True + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + Required + Required + Required + Required + False + True + False + False + True + False + False + SQL + \ No newline at end of file diff --git a/plugins/ProductTag/common.props b/plugins/ProductTag/common.props new file mode 100644 index 00000000..d9519ad8 --- /dev/null +++ b/plugins/ProductTag/common.props @@ -0,0 +1,30 @@ + + + latest + 0.1.0 + $(NoWarn);CS1591 + module + true + EasyAbp Team + An abp application module group that provides basic e-shop service. + https://avatars3.githubusercontent.com/u/58311641?s=128 + https://github.com/EasyAbp/EShop + https://github.com/EasyAbp/EShop + abp module easyabp EShop shopping shop ordering product payment store mall + EasyAbp + MIT + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers + + + + \ No newline at end of file diff --git a/plugins/ProductTag/docker-compose.migrations.yml b/plugins/ProductTag/docker-compose.migrations.yml new file mode 100644 index 00000000..5e7c2ed1 --- /dev/null +++ b/plugins/ProductTag/docker-compose.migrations.yml @@ -0,0 +1,13 @@ +version: '3.4' + +services: + migrations: + build: + context: ../../ + dockerfile: templates/service/database/Dockerfile + depends_on: + - sqlserver + environment: + - IdentityServer_DB=ProductTag_Identity + - ProductTag_DB=ProductTag_ModuleDb + - SA_PASSWORD=yourStrong(!)Password diff --git a/plugins/ProductTag/docker-compose.override.yml b/plugins/ProductTag/docker-compose.override.yml new file mode 100644 index 00000000..d5d2a0e4 --- /dev/null +++ b/plugins/ProductTag/docker-compose.override.yml @@ -0,0 +1,29 @@ +version: '3.4' + +services: + sqlserver: + environment: + - SA_PASSWORD=yourStrong(!)Password + - ACCEPT_EULA=Y + ports: + - "51599:1433" + + identity-server: + environment: + - ASPNETCORE_URLS=http://0.0.0.0:80 + - ConnectionStrings__Default=Server=sqlserver;Database=ProductTag_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - ConnectionStrings__SqlServerCache=Server=sqlserver;Database=ProductTag_Cache;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + ports: + - "51600:80" + + product-tag: + environment: + - ASPNETCORE_URLS=http://0.0.0.0:80 + - ConnectionStrings__Default=Server=sqlserver;Database=ProductTag_ModuleDb;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - ConnectionStrings__AbpSettingManagement=Server=sqlserver;Database=ProductTag_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - ConnectionStrings__AbpPermissionManagement=Server=sqlserver;Database=ProductTag_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - ConnectionStrings__AbpAuditLogging=Server=sqlserver;Database=ProductTag_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - ConnectionStrings__SqlServerCache=Server=sqlserver;Database=ProductTag_Cache;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - AuthServer__Authority=http://identity-server + ports: + - "51601:80" \ No newline at end of file diff --git a/plugins/ProductTag/docker-compose.yml b/plugins/ProductTag/docker-compose.yml new file mode 100644 index 00000000..54ef5f29 --- /dev/null +++ b/plugins/ProductTag/docker-compose.yml @@ -0,0 +1,25 @@ +version: '3.4' + +services: + sqlserver: + image: mcr.microsoft.com/mssql/server + volumes: + - dbdata:/var/opt/mssql + + identity-server: + build: + context: ../../ + dockerfile: templates/service/host/IdentityServerHost/Dockerfile + depends_on: + - sqlserver + + product-tag: + build: + context: ../../ + dockerfile: templates/service/host/EasyAbp.EShop.Plugins.ProductTag.Host/Dockerfile + depends_on: + - sqlserver + - identity-server + +volumes: + dbdata: \ No newline at end of file diff --git a/plugins/ProductTag/host/EasyAbp.EShop.Plugins.ProductTag.Host.Shared/EasyAbp.EShop.Plugins.ProductTag.Host.Shared.csproj b/plugins/ProductTag/host/EasyAbp.EShop.Plugins.ProductTag.Host.Shared/EasyAbp.EShop.Plugins.ProductTag.Host.Shared.csproj new file mode 100644 index 00000000..d469bb9b --- /dev/null +++ b/plugins/ProductTag/host/EasyAbp.EShop.Plugins.ProductTag.Host.Shared/EasyAbp.EShop.Plugins.ProductTag.Host.Shared.csproj @@ -0,0 +1,10 @@ + + + + + + netstandard2.0 + EasyAbp.EShop.Plugins.ProductTag + + + diff --git a/plugins/ProductTag/host/EasyAbp.EShop.Plugins.ProductTag.Host.Shared/MultiTenancy/MultiTenancyConsts.cs b/plugins/ProductTag/host/EasyAbp.EShop.Plugins.ProductTag.Host.Shared/MultiTenancy/MultiTenancyConsts.cs new file mode 100644 index 00000000..4e271474 --- /dev/null +++ b/plugins/ProductTag/host/EasyAbp.EShop.Plugins.ProductTag.Host.Shared/MultiTenancy/MultiTenancyConsts.cs @@ -0,0 +1,10 @@ +namespace EasyAbp.EShop.Plugins.ProductTag.MultiTenancy +{ + public static class MultiTenancyConsts + { + /* Enable/disable multi-tenancy in a single point + * to test your module with multi-tenancy. + */ + public const bool IsEnabled = false; + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts.csproj b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts.csproj new file mode 100644 index 00000000..b953a1d8 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts.csproj @@ -0,0 +1,20 @@ + + + + + + netstandard2.0 + EasyAbp.EShop.Plugins.ProductTag + + + + + + + + + + + + + diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/FodyWeavers.xml b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/FodyWeavers.xml new file mode 100644 index 00000000..be0de3a9 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/FodyWeavers.xsd b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/Permissions/ProductTagPermissionDefinitionProvider.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/Permissions/ProductTagPermissionDefinitionProvider.cs new file mode 100644 index 00000000..2bcbcb33 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/Permissions/ProductTagPermissionDefinitionProvider.cs @@ -0,0 +1,24 @@ +using EasyAbp.EShop.Plugins.ProductTag.Localization; +using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Localization; + +namespace EasyAbp.EShop.Plugins.ProductTag.Permissions +{ + public class ProductTagPermissionDefinitionProvider : PermissionDefinitionProvider + { + public override void Define(IPermissionDefinitionContext context) + { + var moduleGroup = context.AddGroup(ProductTagPermissions.GroupName, L("Permission:ProductTag")); + + var tags = moduleGroup.AddPermission(ProductTagPermissions.Tags.Default, L("Permission:Tag")); + tags.AddChild(ProductTagPermissions.Tags.Create, L("Permission:Create")); + tags.AddChild(ProductTagPermissions.Tags.Update, L("Permission:Update")); + tags.AddChild(ProductTagPermissions.Tags.Delete, L("Permission:Delete")); + } + + private static LocalizableString L(string name) + { + return LocalizableString.Create(name); + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/Permissions/ProductTagPermissions.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/Permissions/ProductTagPermissions.cs new file mode 100644 index 00000000..ed8496ec --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/Permissions/ProductTagPermissions.cs @@ -0,0 +1,22 @@ +using Volo.Abp.Reflection; + +namespace EasyAbp.EShop.Plugins.ProductTag.Permissions +{ + public class ProductTagPermissions + { + public const string GroupName = "EasyAbp.EShop.ProductTag"; + + public class Tags + { + public const string Default = GroupName + ".Tag"; + public const string Delete = Default + ".Delete"; + public const string Update = Default + ".Update"; + public const string Create = Default + ".Create"; + } + + public static string[] GetAll() + { + return ReflectionHelper.GetPublicConstantsRecursively(typeof(ProductTagPermissions)); + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/ProductTagApplicationContractsModule.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/ProductTagApplicationContractsModule.cs new file mode 100644 index 00000000..95a8ca02 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/ProductTagApplicationContractsModule.cs @@ -0,0 +1,18 @@ +using EasyAbp.EShop.Stores; +using Volo.Abp.Application; +using Volo.Abp.Modularity; +using Volo.Abp.Authorization; + +namespace EasyAbp.EShop.Plugins.ProductTag +{ + [DependsOn( + typeof(ProductTagDomainSharedModule), + typeof(AbpDddApplicationContractsModule), + typeof(AbpAuthorizationModule), + typeof(EShopStoresDomainSharedModule) + )] + public class ProductTagApplicationContractsModule : AbpModule + { + + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/ProductTags/Dtos/CreateUpdateProductTagsDto.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/ProductTags/Dtos/CreateUpdateProductTagsDto.cs new file mode 100644 index 00000000..323f2e33 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/ProductTags/Dtos/CreateUpdateProductTagsDto.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using Volo.Abp.ObjectExtending; + +namespace EasyAbp.EShop.Plugins.ProductTag.ProductTags.Dtos +{ + public class CreateUpdateProductTagsDto : ExtensibleObject + { + public Guid StoreId { get; set; } + + public Guid ProductId { get; set; } + + public List TagIds { get; set; } + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/ProductTags/Dtos/GetProductTagListDto.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/ProductTags/Dtos/GetProductTagListDto.cs new file mode 100644 index 00000000..00c63de1 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/ProductTags/Dtos/GetProductTagListDto.cs @@ -0,0 +1,15 @@ +using System; +using EasyAbp.EShop.Stores.Stores; +using Volo.Abp.Application.Dtos; + +namespace EasyAbp.EShop.Plugins.ProductTag.ProductTags.Dtos +{ + public class GetProductTagListDto : PagedAndSortedResultRequestDto, IMultiStore + { + public Guid StoreId { get; set; } + + public Guid? TagId { get; set; } + + public Guid? ProductId { get; set; } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/ProductTags/Dtos/ProductTagDto.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/ProductTags/Dtos/ProductTagDto.cs new file mode 100644 index 00000000..8083a1d2 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/ProductTags/Dtos/ProductTagDto.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace EasyAbp.EShop.Plugins.ProductTag.ProductTags.Dtos +{ + public class ProductTagDto : ExtensibleAuditedEntityDto + { + public Guid TagId { get; set; } + + public Guid ProductId { get; set; } + + public int DisplayOrder { get; set; } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/ProductTags/Dtos/UpdateProductTagDto.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/ProductTags/Dtos/UpdateProductTagDto.cs new file mode 100644 index 00000000..194760d0 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/ProductTags/Dtos/UpdateProductTagDto.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace EasyAbp.EShop.Plugins.ProductTag.ProductTags.Dtos +{ + public class UpdateProductTagDto : ExtensibleEntityDto + { + public Guid TagId { get; set; } + + public Guid ProductId { get; set; } + + public int DisplayOrder { get; set; } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/ProductTags/IProductTagAppService.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/ProductTags/IProductTagAppService.cs new file mode 100644 index 00000000..360a5bbc --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/ProductTags/IProductTagAppService.cs @@ -0,0 +1,17 @@ +using EasyAbp.EShop.Plugins.ProductTag.ProductTags.Dtos; +using System; +using System.Threading.Tasks; +using Volo.Abp.Application.Services; + +namespace EasyAbp.EShop.Plugins.ProductTag.ProductTags +{ + public interface IProductTagAppService : + IReadOnlyAppService< + ProductTagDto, + Guid, + GetProductTagListDto>, + IUpdateAppService + { + Task UpdateAsync(CreateUpdateProductTagsDto input); + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/Tags/Dtos/CreateUpdateTagDto.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/Tags/Dtos/CreateUpdateTagDto.cs new file mode 100644 index 00000000..cb5ea626 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/Tags/Dtos/CreateUpdateTagDto.cs @@ -0,0 +1,30 @@ +using System; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Application.Dtos; + +namespace EasyAbp.EShop.Plugins.ProductTag.Tags.Dtos +{ + public class UpdateTagDto : ExtensibleEntityDto + { + [DisplayName("TagParentId")] + public Guid? ParentId { get; set; } + + [Required] + [DisplayName("TagDisplayName")] + public string DisplayName { get; set; } + + [DisplayName("TagDescription")] + public string Description { get; set; } + + [DisplayName("TagMediaResources")] + public string MediaResources { get; set; } + } + + public class CreateTagDto : UpdateTagDto + { + [Required] + [DisplayName("TagStoreId")] + public Guid StoreId { get; set; } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/Tags/Dtos/GetTagListDto.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/Tags/Dtos/GetTagListDto.cs new file mode 100644 index 00000000..6b397a7f --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/Tags/Dtos/GetTagListDto.cs @@ -0,0 +1,15 @@ +using System; +using System.ComponentModel.DataAnnotations; +using EasyAbp.EShop.Stores.Stores; +using Volo.Abp.Application.Dtos; + +namespace EasyAbp.EShop.Plugins.ProductTag.Tags.Dtos +{ + public class GetTagListDto : PagedAndSortedResultRequestDto, IMultiStore + { + [Required] + public Guid StoreId { get; set; } + + public bool ShowHidden { get; set; } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/Tags/Dtos/TagDto.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/Tags/Dtos/TagDto.cs new file mode 100644 index 00000000..934179e1 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/Tags/Dtos/TagDto.cs @@ -0,0 +1,26 @@ +using EasyAbp.EShop.Stores.Stores; +using System; +using System.Collections.Generic; +using Volo.Abp.Application.Dtos; + +namespace EasyAbp.EShop.Plugins.ProductTag.Tags.Dtos +{ + public class TagDto : ExtensibleFullAuditedEntityDto, IMultiStore + { + public Guid StoreId { get; set; } + + public Guid? ParentId { get; set; } + + public string Code { get; set; } + + public int Level { get; set; } + + public string DisplayName { get; set; } + + public string Description { get; set; } + + public string MediaResources { get; set; } + + public ICollection Children { get; set; } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/Tags/ITagAppService.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/Tags/ITagAppService.cs new file mode 100644 index 00000000..33cebd33 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application.Contracts/Tags/ITagAppService.cs @@ -0,0 +1,15 @@ +using System; +using EasyAbp.EShop.Plugins.ProductTag.Tags.Dtos; +using Volo.Abp.Application.Services; + +namespace EasyAbp.EShop.Plugins.ProductTag.Tags +{ + public interface ITagAppService : ICrudAppService< + TagDto, + Guid, + GetTagListDto, + CreateTagDto, + UpdateTagDto> + { + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/EasyAbp.EShop.Plugins.ProductTag.Application.csproj b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/EasyAbp.EShop.Plugins.ProductTag.Application.csproj new file mode 100644 index 00000000..11bdb9a1 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/EasyAbp.EShop.Plugins.ProductTag.Application.csproj @@ -0,0 +1,20 @@ + + + + + + netstandard2.0 + EasyAbp.EShop.Plugins.ProductTag + + + + + + + + + + + + + diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/FodyWeavers.xml b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/FodyWeavers.xml new file mode 100644 index 00000000..be0de3a9 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/FodyWeavers.xsd b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/ProductTagAppService.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/ProductTagAppService.cs new file mode 100644 index 00000000..53b30d75 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/ProductTagAppService.cs @@ -0,0 +1,14 @@ +using EasyAbp.EShop.Plugins.ProductTag.Localization; +using Volo.Abp.Application.Services; + +namespace EasyAbp.EShop.Plugins.ProductTag +{ + public abstract class ProductTagAppService : ApplicationService + { + protected ProductTagAppService() + { + LocalizationResource = typeof(ProductTagResource); + ObjectMapperContext = typeof(ProductTagApplicationModule); + } + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/ProductTagApplicationAutoMapperProfile.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/ProductTagApplicationAutoMapperProfile.cs new file mode 100644 index 00000000..e13e925e --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/ProductTagApplicationAutoMapperProfile.cs @@ -0,0 +1,25 @@ +using AutoMapper; +using EasyAbp.EShop.Plugins.ProductTag.ProductTags.Dtos; +using EasyAbp.EShop.Plugins.ProductTag.Tags; +using EasyAbp.EShop.Plugins.ProductTag.Tags.Dtos; + +namespace EasyAbp.EShop.Plugins.ProductTag +{ + public class ProductTagApplicationAutoMapperProfile : Profile + { + public ProductTagApplicationAutoMapperProfile() + { + /* You can configure your AutoMapper mapping configuration here. + * Alternatively, you can split your mapping configurations + * into multiple profile classes for a better organization. */ + CreateMap(MemberList.Source); + CreateMap(MemberList.Source); + CreateMap(); + CreateMap(MemberList.Source); + CreateMap(MemberList.Source); + + CreateMap(); + CreateMap(MemberList.Source); + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/ProductTagApplicationModule.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/ProductTagApplicationModule.cs new file mode 100644 index 00000000..be07ebcd --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/ProductTagApplicationModule.cs @@ -0,0 +1,27 @@ +using EasyAbp.EShop.Products; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.AutoMapper; +using Volo.Abp.Modularity; +using Volo.Abp.Application; + +namespace EasyAbp.EShop.Plugins.ProductTag +{ + [DependsOn( + typeof(ProductTagDomainModule), + typeof(ProductTagApplicationContractsModule), + typeof(AbpDddApplicationModule), + typeof(AbpAutoMapperModule), + typeof(EShopProductsDomainModule) + )] + public class ProductTagApplicationModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddAutoMapperObjectMapper(); + Configure(options => + { + options.AddMaps(validate: true); + }); + } + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/ProductTags/ProductTagAppService.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/ProductTags/ProductTagAppService.cs new file mode 100644 index 00000000..f279118c --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/ProductTags/ProductTagAppService.cs @@ -0,0 +1,130 @@ +using EasyAbp.EShop.Plugins.ProductTag.ProductTags.Dtos; +using EasyAbp.EShop.Plugins.ProductTag.Tags; +using EasyAbp.EShop.Products.Permissions; +using EasyAbp.EShop.Products.ProductStores; +using EasyAbp.EShop.Stores.Permissions; +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Threading.Tasks; +using EasyAbp.EShop.Products.Products; +using Microsoft.AspNetCore.Authorization; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; +using Volo.Abp.Domain.Repositories; + +namespace EasyAbp.EShop.Plugins.ProductTag.ProductTags +{ + public class ProductTagAppService : ReadOnlyAppService, + IProductTagAppService + { + private readonly IProductTagRepository _repository; + private readonly ITagRepository _tagRepository; + private readonly IProductStoreRepository _productStoreRepository; + + public ProductTagAppService(IProductTagRepository repository, + ITagRepository tagRepository, + IProductStoreRepository productStoreRepository) : base(repository) + { + _repository = repository; + _tagRepository = tagRepository; + _productStoreRepository = productStoreRepository; + } + + protected override string GetListPolicyName { get; set; } = ProductsPermissions.Products.Default; + protected string UpdatePolicyName { get; set; } = ProductsPermissions.Products.Update; + + [RemoteService(false)] + public override Task GetAsync(Guid id) + { + throw new NotSupportedException(); + } + + public override async Task> GetListAsync(GetProductTagListDto input) + { + await CheckGetListPolicyAsync(); + + await AuthorizationService.CheckStoreOwnerAsync(input.StoreId, GetListPolicyName); + + var query = CreateFilteredQuery(input); + + var totalCount = await AsyncExecuter.CountAsync(query); + + query = ApplySorting(query, input); + query = ApplyPaging(query, input); + + var entities = await AsyncExecuter.ToListAsync(query); + + return new PagedResultDto( + totalCount, + entities.Select(MapToGetListOutputDto).ToList()); + } + + protected override IQueryable CreateFilteredQuery(GetProductTagListDto input) + { + var queryable = Repository.AsQueryable(); + + queryable = queryable.Where(x => x.StoreId == input.StoreId); + + if (input.TagId.HasValue) + { + queryable = queryable.Where(x => x.TagId == input.TagId); + } + + if (input.ProductId.HasValue) + { + queryable = queryable.Where(x => x.ProductId == input.ProductId); + } + + return queryable; + } + + public async Task UpdateAsync(Guid id, UpdateProductTagDto input) + { + var entity = await GetEntityByIdAsync(id); + + await AuthorizationService.CheckStoreOwnerAsync(entity.StoreId, UpdatePolicyName); + + MapToEntity(input, entity); + await _repository.UpdateAsync(entity, autoSave: true); + + return MapToGetOutputDto(entity); + } + + public async Task UpdateAsync(CreateUpdateProductTagsDto input) + { + await AuthorizationService.CheckStoreOwnerAsync(input.StoreId, UpdatePolicyName); + + var productStore = await _productStoreRepository.GetAsync(input.ProductId, input.StoreId, false); + + if (!productStore.IsOwner) + { + throw new StoreIsNotProductOwnerException(input.ProductId, input.StoreId); + } + + input.TagIds ??= new List(); + + var storeTags = (await _tagRepository.GetListByAsync(input.StoreId)).Select(x => x.Id); + + var productTags = await _repository.GetListByProductIdAsync(input.ProductId, input.StoreId); + + foreach (var productTag in productTags.Where(x => !input.TagIds.Contains(x.TagId))) + { + await _repository.DeleteAsync(productTag, true); + } + + foreach (var tagId in input.TagIds.Except(productTags.Select(x => x.TagId).Concat(storeTags))) + { + await _repository.InsertAsync( + new ProductTag(GuidGenerator.Create(), CurrentTenant.Id, tagId, input.ProductId), true); + } + } + + protected virtual ProductTag MapToEntity(UpdateProductTagDto input, ProductTag entity) + { + return ObjectMapper.Map(input, entity); + } + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/Tags/TagAppService.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/Tags/TagAppService.cs new file mode 100644 index 00000000..0ea57bb8 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Application/Tags/TagAppService.cs @@ -0,0 +1,110 @@ +using EasyAbp.EShop.Plugins.ProductTag.Permissions; +using EasyAbp.EShop.Plugins.ProductTag.Tags.Dtos; +using EasyAbp.EShop.Stores.Permissions; +using JetBrains.Annotations; +using System; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; +using Volo.Abp.Linq; + +namespace EasyAbp.EShop.Plugins.ProductTag.Tags +{ + public class TagAppService : CrudAppService, + ITagAppService + { + private readonly IAsyncQueryableExecuter _asyncQueryableExecuter; + protected override string CreatePolicyName { get; set; } = ProductTagPermissions.Tags.Create; + protected override string DeletePolicyName { get; set; } = ProductTagPermissions.Tags.Delete; + protected override string UpdatePolicyName { get; set; } = ProductTagPermissions.Tags.Update; + protected override string GetPolicyName { get; set; } = ProductTagPermissions.Tags.Default; + protected override string GetListPolicyName { get; set; } = ProductTagPermissions.Tags.Default; + + public TagAppService(ITagRepository repository, + [NotNull] IAsyncQueryableExecuter asyncQueryableExecuter) : base(repository) + { + _asyncQueryableExecuter = asyncQueryableExecuter ?? throw new ArgumentNullException(nameof(asyncQueryableExecuter)); + } + + protected override IQueryable CreateFilteredQuery(GetTagListDto input) + { + var query = base.CreateFilteredQuery(input); + + query = query.Where(x => x.StoreId == input.StoreId); + + return input.ShowHidden ? query : query.Where(x => !x.IsHidden); + } + + public override async Task GetAsync(Guid id) + { + await CheckGetPolicyAsync(); + + var entity = await GetEntityByIdAsync(id); + + await AuthorizationService.CheckStoreOwnerAsync(entity.StoreId, GetPolicyName, entity); + + return MapToGetOutputDto(entity); + } + + public override async Task> GetListAsync(GetTagListDto input) + { + await CheckGetListPolicyAsync(); + + await AuthorizationService.CheckStoreOwnerAsync(input.StoreId, GetListPolicyName); + + var query = CreateFilteredQuery(input); + + var totalCount = await _asyncQueryableExecuter.CountAsync(query); + + query = ApplySorting(query, input); + query = ApplyPaging(query, input); + + var entities = await _asyncQueryableExecuter.ToListAsync(query); + + return new PagedResultDto( + totalCount, + entities.Select(MapToGetListOutputDto).ToList()); + } + + public override async Task CreateAsync(CreateTagDto input) + { + await CheckCreatePolicyAsync(); + + var entity = MapToEntity(input); + + await AuthorizationService.CheckStoreOwnerAsync(entity.StoreId, CreatePolicyName, entity); + + TryToSetTenantId(entity); + + await Repository.InsertAsync(entity, autoSave: true); + + return MapToGetOutputDto(entity); + } + + public override async Task UpdateAsync(Guid id, UpdateTagDto input) + { + await CheckUpdatePolicyAsync(); + + var entity = await GetEntityByIdAsync(id); + + await AuthorizationService.CheckStoreOwnerAsync(entity.StoreId, UpdatePolicyName, entity); + + MapToEntity(input, entity); + await Repository.UpdateAsync(entity, autoSave: true); + + return MapToGetOutputDto(entity); + } + + public override async Task DeleteAsync(Guid id) + { + await CheckDeletePolicyAsync(); + + var entity = await GetEntityByIdAsync(id); + + await AuthorizationService.CheckStoreOwnerAsync(entity.StoreId, DeletePolicyName, entity); + + await DeleteByIdAsync(id); + } + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared.csproj b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared.csproj new file mode 100644 index 00000000..8e9296cb --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared.csproj @@ -0,0 +1,24 @@ + + + + + + netstandard2.0 + EasyAbp.EShop.Plugins.ProductTag + true + + + + + + + + + + + + + + + + diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/FodyWeavers.xml b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/FodyWeavers.xml new file mode 100644 index 00000000..be0de3a9 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/FodyWeavers.xsd b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/cs.json b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/cs.json new file mode 100644 index 00000000..081cdb8a --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/cs.json @@ -0,0 +1,21 @@ +{ + "culture": "cs", + "texts": { + "ManageYourProfile": "Spravovat profil", + "Menu:Tag": "MenuTag", + "Tag": "Tag", + "TagTenantId": "TagTenantId", + "TagStoreId": "TagStoreId", + "TagDisplayName": "TagDisplayName", + "TagDescription": "TagDescription", + "TagMediaResources": "TagMediaResources", + "CreateTag": "CreateTag", + "EditTag": "EditTag", + "TagDeletionConfirmationMessage": "Are you sure to delete the tag {0}?", + "Permission:ProductTag": "ProductTag", + "Permission:Tag": "Tag", + "Permission:Create": "Create", + "Permission:Update": "Update", + "Permission:Delete": "Delete" + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/en.json b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/en.json new file mode 100644 index 00000000..41833bb9 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/en.json @@ -0,0 +1,22 @@ +{ + "culture": "en", + "texts": { + "ManageYourProfile": "Manage your profile", + "SamplePageMessage": "A sample page for the ProductTag module", + "Menu:Tag": "MenuTag", + "Tag": "Tag", + "TagTenantId": "TagTenantId", + "TagStoreId": "TagStoreId", + "TagDisplayName": "TagDisplayName", + "TagDescription": "TagDescription", + "TagMediaResources": "TagMediaResources", + "CreateTag": "CreateTag", + "EditTag": "EditTag", + "TagDeletionConfirmationMessage": "Are you sure to delete the tag {0}?", + "Permission:ProductTag": "ProductTag", + "Permission:Tag": "Tag", + "Permission:Create": "Create", + "Permission:Update": "Update", + "Permission:Delete": "Delete" + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/pl-PL.json b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/pl-PL.json new file mode 100644 index 00000000..aa76992a --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/pl-PL.json @@ -0,0 +1,20 @@ +{ + "culture": "pl-PL", + "texts": { + "Menu:Tag": "MenuTag", + "Tag": "Tag", + "TagTenantId": "TagTenantId", + "TagStoreId": "TagStoreId", + "TagDisplayName": "TagDisplayName", + "TagDescription": "TagDescription", + "TagMediaResources": "TagMediaResources", + "CreateTag": "CreateTag", + "EditTag": "EditTag", + "TagDeletionConfirmationMessage": "Are you sure to delete the tag {0}?", + "Permission:ProductTag": "ProductTag", + "Permission:Tag": "Tag", + "Permission:Create": "Create", + "Permission:Update": "Update", + "Permission:Delete": "Delete" + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/pt-BR.json b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/pt-BR.json new file mode 100644 index 00000000..7c6362cb --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/pt-BR.json @@ -0,0 +1,20 @@ +{ + "culture": "pt-BR", + "texts": { + "Menu:Tag": "MenuTag", + "Tag": "Tag", + "TagTenantId": "TagTenantId", + "TagStoreId": "TagStoreId", + "TagDisplayName": "TagDisplayName", + "TagDescription": "TagDescription", + "TagMediaResources": "TagMediaResources", + "CreateTag": "CreateTag", + "EditTag": "EditTag", + "TagDeletionConfirmationMessage": "Are you sure to delete the tag {0}?", + "Permission:ProductTag": "ProductTag", + "Permission:Tag": "Tag", + "Permission:Create": "Create", + "Permission:Update": "Update", + "Permission:Delete": "Delete" + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/sl.json b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/sl.json new file mode 100644 index 00000000..298da6dd --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/sl.json @@ -0,0 +1,21 @@ +{ + "culture": "sl", + "texts": { + "ManageYourProfile": "Upravljajte svojim profilom", + "Menu:Tag": "MenuTag", + "Tag": "Tag", + "TagTenantId": "TagTenantId", + "TagStoreId": "TagStoreId", + "TagDisplayName": "TagDisplayName", + "TagDescription": "TagDescription", + "TagMediaResources": "TagMediaResources", + "CreateTag": "CreateTag", + "EditTag": "EditTag", + "TagDeletionConfirmationMessage": "Are you sure to delete the tag {0}?", + "Permission:ProductTag": "ProductTag", + "Permission:Tag": "Tag", + "Permission:Create": "Create", + "Permission:Update": "Update", + "Permission:Delete": "Delete" + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/tr.json b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/tr.json new file mode 100644 index 00000000..34f9901c --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/tr.json @@ -0,0 +1,22 @@ +{ + "culture": "tr", + "texts": { + "ManageYourProfile": "Profil yönetimi", + "SamplePageMessage": "ProductTag modulünden örnek bir sayfa", + "Menu:Tag": "MenuTag", + "Tag": "Tag", + "TagTenantId": "TagTenantId", + "TagStoreId": "TagStoreId", + "TagDisplayName": "TagDisplayName", + "TagDescription": "TagDescription", + "TagMediaResources": "TagMediaResources", + "CreateTag": "CreateTag", + "EditTag": "EditTag", + "TagDeletionConfirmationMessage": "Are you sure to delete the tag {0}?", + "Permission:ProductTag": "ProductTag", + "Permission:Tag": "Tag", + "Permission:Create": "Create", + "Permission:Update": "Update", + "Permission:Delete": "Delete" + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/vi.json b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/vi.json new file mode 100644 index 00000000..1319bc8d --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/vi.json @@ -0,0 +1,20 @@ +{ + "culture": "vi", + "texts": { + "Menu:Tag": "MenuTag", + "Tag": "Tag", + "TagTenantId": "TagTenantId", + "TagStoreId": "TagStoreId", + "TagDisplayName": "TagDisplayName", + "TagDescription": "TagDescription", + "TagMediaResources": "TagMediaResources", + "CreateTag": "CreateTag", + "EditTag": "EditTag", + "TagDeletionConfirmationMessage": "Are you sure to delete the tag {0}?", + "Permission:ProductTag": "ProductTag", + "Permission:Tag": "Tag", + "Permission:Create": "Create", + "Permission:Update": "Update", + "Permission:Delete": "Delete" + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/zh-Hans.json b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/zh-Hans.json new file mode 100644 index 00000000..05a31078 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/zh-Hans.json @@ -0,0 +1,21 @@ +{ + "culture": "zh-Hans", + "texts": { + "ManageYourProfile": "管理个人资料", + "Menu:Tag": "MenuTag", + "Tag": "Tag", + "TagTenantId": "TagTenantId", + "TagStoreId": "TagStoreId", + "TagDisplayName": "TagDisplayName", + "TagDescription": "TagDescription", + "TagMediaResources": "TagMediaResources", + "CreateTag": "CreateTag", + "EditTag": "EditTag", + "TagDeletionConfirmationMessage": "Are you sure to delete the tag {0}?", + "Permission:ProductTag": "ProductTag", + "Permission:Tag": "Tag", + "Permission:Create": "Create", + "Permission:Update": "Update", + "Permission:Delete": "Delete" + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/zh-Hant.json b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/zh-Hant.json new file mode 100644 index 00000000..fd2b044a --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTag/zh-Hant.json @@ -0,0 +1,21 @@ +{ + "culture": "zh-Hant", + "texts": { + "ManageYourProfile": "管理個人資料", + "Menu:Tag": "MenuTag", + "Tag": "Tag", + "TagTenantId": "TagTenantId", + "TagStoreId": "TagStoreId", + "TagDisplayName": "TagDisplayName", + "TagDescription": "TagDescription", + "TagMediaResources": "TagMediaResources", + "CreateTag": "CreateTag", + "EditTag": "EditTag", + "TagDeletionConfirmationMessage": "Are you sure to delete the tag {0}?", + "Permission:ProductTag": "ProductTag", + "Permission:Tag": "Tag", + "Permission:Create": "Create", + "Permission:Update": "Update", + "Permission:Delete": "Delete" + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTagResource.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTagResource.cs new file mode 100644 index 00000000..8024441c --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/Localization/ProductTagResource.cs @@ -0,0 +1,10 @@ +using Volo.Abp.Localization; + +namespace EasyAbp.EShop.Plugins.ProductTag.Localization +{ + [LocalizationResourceName("ProductTag")] + public class ProductTagResource + { + + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/ProductTagDomainSharedModule.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/ProductTagDomainSharedModule.cs new file mode 100644 index 00000000..d4b2ba4d --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/ProductTagDomainSharedModule.cs @@ -0,0 +1,37 @@ +using Volo.Abp.Modularity; +using Volo.Abp.Localization; +using EasyAbp.EShop.Plugins.ProductTag.Localization; +using Volo.Abp.Localization.ExceptionHandling; +using Volo.Abp.Validation; +using Volo.Abp.Validation.Localization; +using Volo.Abp.VirtualFileSystem; + +namespace EasyAbp.EShop.Plugins.ProductTag +{ + [DependsOn( + typeof(AbpValidationModule) + )] + public class ProductTagDomainSharedModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.FileSets.AddEmbedded(); + }); + + Configure(options => + { + options.Resources + .Add("en") + .AddBaseTypes(typeof(AbpValidationResource)) + .AddVirtualJson("/Localization/ProductTag"); + }); + + Configure(options => + { + options.MapCodeNamespace("ProductTag", typeof(ProductTagResource)); + }); + } + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/ProductTagErrorCodes.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/ProductTagErrorCodes.cs new file mode 100644 index 00000000..ff528d99 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain.Shared/ProductTagErrorCodes.cs @@ -0,0 +1,7 @@ +namespace EasyAbp.EShop.Plugins.ProductTag +{ + public static class ProductTagErrorCodes + { + //Add your business exception error codes here... + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/EasyAbp.EShop.Plugins.ProductTag.Domain.csproj b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/EasyAbp.EShop.Plugins.ProductTag.Domain.csproj new file mode 100644 index 00000000..c3a84dc7 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/EasyAbp.EShop.Plugins.ProductTag.Domain.csproj @@ -0,0 +1,17 @@ + + + + + + netstandard2.0 + EasyAbp.EShop.Plugins.ProductTag + + + + + + + + + + diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/FodyWeavers.xml b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/FodyWeavers.xml new file mode 100644 index 00000000..be0de3a9 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/FodyWeavers.xsd b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/ProductTagDbProperties.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/ProductTagDbProperties.cs new file mode 100644 index 00000000..70233f15 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/ProductTagDbProperties.cs @@ -0,0 +1,11 @@ +namespace EasyAbp.EShop.Plugins.ProductTag +{ + public static class ProductTagDbProperties + { + public static string DbTablePrefix { get; set; } = "ProductTag"; + + public static string DbSchema { get; set; } = null; + + public const string ConnectionStringName = "ProductTag"; + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/ProductTagDomainModule.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/ProductTagDomainModule.cs new file mode 100644 index 00000000..ad1a21de --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/ProductTagDomainModule.cs @@ -0,0 +1,16 @@ +using EasyAbp.Abp.Trees; +using EasyAbp.EShop.Stores; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Plugins.ProductTag +{ + [DependsOn( + typeof(ProductTagDomainSharedModule), + typeof(AbpTreesDomainModule), + typeof(EShopStoresDomainSharedModule) + )] + public class ProductTagDomainModule : AbpModule + { + + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/ProductTags/IProductTagRepository.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/ProductTags/IProductTagRepository.cs new file mode 100644 index 00000000..e6d0168c --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/ProductTags/IProductTagRepository.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; + +namespace EasyAbp.EShop.Plugins.ProductTag.ProductTags +{ + public interface IProductTagRepository : IRepository + { + Task> GetListByTagIdAsync(Guid tagId, Guid? storeId = null, CancellationToken cancellationToken = default); + + Task> GetListByProductIdAsync(Guid productId, Guid? storeId = null, CancellationToken cancellationToken = default); + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/ProductTags/ProductTags.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/ProductTags/ProductTags.cs new file mode 100644 index 00000000..570d3449 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/ProductTags/ProductTags.cs @@ -0,0 +1,37 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace EasyAbp.EShop.Plugins.ProductTag.ProductTags +{ + public class ProductTag : AuditedAggregateRoot, IMultiTenant + { + public virtual Guid? TenantId { get; protected set; } + + public virtual Guid StoreId { get; set; } + + public virtual Guid TagId { get; protected set; } + + public virtual Guid ProductId { get; protected set; } + + public virtual int DisplayOrder { get; protected set; } + + protected ProductTag() + { + } + + public ProductTag( + Guid id, + Guid? tenantId, + Guid tagId, + Guid productId, + int displayOrder = 0 + ) : base(id) + { + TenantId = tenantId; + TagId = tagId; + ProductId = productId; + DisplayOrder = displayOrder; + } + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/Settings/ProductTagSettingDefinitionProvider.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/Settings/ProductTagSettingDefinitionProvider.cs new file mode 100644 index 00000000..919c64ea --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/Settings/ProductTagSettingDefinitionProvider.cs @@ -0,0 +1,14 @@ +using Volo.Abp.Settings; + +namespace EasyAbp.EShop.Plugins.ProductTag.Settings +{ + public class ProductTagSettingDefinitionProvider : SettingDefinitionProvider + { + public override void Define(ISettingDefinitionContext context) + { + /* Define module settings here. + * Use names from ProductTagSettings class. + */ + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/Settings/ProductTagSettings.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/Settings/ProductTagSettings.cs new file mode 100644 index 00000000..40555821 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/Settings/ProductTagSettings.cs @@ -0,0 +1,11 @@ +namespace EasyAbp.EShop.Plugins.ProductTag.Settings +{ + public static class ProductTagSettings + { + public const string GroupName = "ProductTag"; + + /* Add constants for setting names. Example: + * public const string MySettingName = GroupName + ".MySettingName"; + */ + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/Tags/ITagRepository.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/Tags/ITagRepository.cs new file mode 100644 index 00000000..dfb32dfe --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/Tags/ITagRepository.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; + +namespace EasyAbp.EShop.Plugins.ProductTag.Tags +{ + public interface ITagRepository : IRepository + { + Task> GetListByAsync(Guid storeId, bool includeDetails = false, CancellationToken cancellationToken = default); + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/Tags/Tag.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/Tags/Tag.cs new file mode 100644 index 00000000..91ac332b --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Domain/Tags/Tag.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using EasyAbp.Abp.Trees; +using EasyAbp.EShop.Stores.Stores; +using JetBrains.Annotations; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace EasyAbp.EShop.Plugins.ProductTag.Tags +{ + public class Tag : FullAuditedAggregateRoot, ITree, IMultiTenant, IMultiStore + { + public virtual Guid? TenantId { get; protected set; } + + public virtual Guid StoreId { get; protected set; } + + [CanBeNull] + public virtual string Description { get; protected set; } + + [CanBeNull] + public virtual string MediaResources { get; protected set; } + + public virtual bool IsHidden { get; protected set; } + + #region Properties of ITree + + [NotNull] + public virtual string DisplayName { get; set; } + + [NotNull] + public virtual string Code { get; set; } + + public virtual int Level { get; set; } + + public virtual Guid? ParentId { get; set; } + + public virtual Tag Parent { get; set; } + + public virtual ICollection Children { get; set; } + + #endregion + + protected Tag() + { + } + + public Tag( + Guid id, + Guid? tenantId, + Guid storeId, + Guid? parentId, + string displayName, + string description, + string mediaResources, + bool isHidden + ) : base(id) + { + TenantId = tenantId; + StoreId = storeId; + ParentId = parentId; + DisplayName = displayName; + Description = description; + MediaResources = mediaResources; + IsHidden = isHidden; + } + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore.csproj b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore.csproj new file mode 100644 index 00000000..db7d2960 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore.csproj @@ -0,0 +1,16 @@ + + + + + + netstandard2.0 + EasyAbp.EShop.Plugins.ProductTag + + + + + + + + + diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/EntityFrameworkCore/IProductTagDbContext.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/EntityFrameworkCore/IProductTagDbContext.cs new file mode 100644 index 00000000..8d481613 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/EntityFrameworkCore/IProductTagDbContext.cs @@ -0,0 +1,17 @@ +using EasyAbp.EShop.Plugins.ProductTag.Tags; +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Data; +using Volo.Abp.EntityFrameworkCore; + +namespace EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore +{ + [ConnectionStringName(ProductTagDbProperties.ConnectionStringName)] + public interface IProductTagDbContext : IEfCoreDbContext + { + /* Add DbSet for each Aggregate Root here. Example: + * DbSet Questions { get; } + */ + DbSet Tags { get; set; } + DbSet ProductTags { get; set; } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/EntityFrameworkCore/ProductTagDbContext.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/EntityFrameworkCore/ProductTagDbContext.cs new file mode 100644 index 00000000..19d93b2f --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/EntityFrameworkCore/ProductTagDbContext.cs @@ -0,0 +1,31 @@ +using EasyAbp.EShop.Plugins.ProductTag.Tags; +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Data; +using Volo.Abp.EntityFrameworkCore; + +namespace EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore +{ + [ConnectionStringName(ProductTagDbProperties.ConnectionStringName)] + public class ProductTagDbContext : AbpDbContext, IProductTagDbContext + { + /* Add DbSet for each Aggregate Root here. Example: + * public DbSet Questions { get; set; } + */ + + public DbSet Tags { get; set; } + public DbSet ProductTags { get; set; } + + public ProductTagDbContext(DbContextOptions options) + : base(options) + { + + } + + protected override void OnModelCreating(ModelBuilder builder) + { + base.OnModelCreating(builder); + + builder.ConfigureProductTag(); + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/EntityFrameworkCore/ProductTagDbContextModelCreatingExtensions.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/EntityFrameworkCore/ProductTagDbContextModelCreatingExtensions.cs new file mode 100644 index 00000000..01a377d1 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/EntityFrameworkCore/ProductTagDbContextModelCreatingExtensions.cs @@ -0,0 +1,66 @@ +using System; +using EasyAbp.EShop.Plugins.ProductTag.Tags; +using Microsoft.EntityFrameworkCore; +using Volo.Abp; +using Volo.Abp.EntityFrameworkCore.Modeling; + +namespace EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore +{ + public static class ProductTagDbContextModelCreatingExtensions + { + public static void ConfigureProductTag( + this ModelBuilder builder, + Action optionsAction = null) + { + Check.NotNull(builder, nameof(builder)); + + var options = new ProductTagModelBuilderConfigurationOptions( + ProductTagDbProperties.DbTablePrefix, + ProductTagDbProperties.DbSchema + ); + + optionsAction?.Invoke(options); + + /* Configure all entities here. Example: + + builder.Entity(b => + { + //Configure table & schema name + b.ToTable(options.TablePrefix + "Questions", options.Schema); + + b.ConfigureByConvention(); + + //Properties + b.Property(q => q.Title).IsRequired().HasMaxLength(QuestionConsts.MaxTitleLength); + + //Relations + b.HasMany(question => question.Tags).WithOne().HasForeignKey(qt => qt.QuestionId); + + //Indexes + b.HasIndex(q => q.CreationTime); + }); + */ + + + + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "Tags", options.Schema); + b.ConfigureByConvention(); + /* Configure more properties here */ + + b.HasIndex(x => x.StoreId); + }); + + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "ProductTags", options.Schema); + b.ConfigureByConvention(); + /* Configure more properties here */ + + b.HasIndex(x => x.TagId); + b.HasIndex(x => x.ProductId); + }); + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/EntityFrameworkCore/ProductTagEntityFrameworkCoreModule.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/EntityFrameworkCore/ProductTagEntityFrameworkCoreModule.cs new file mode 100644 index 00000000..6022e551 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/EntityFrameworkCore/ProductTagEntityFrameworkCoreModule.cs @@ -0,0 +1,29 @@ +using EasyAbp.Abp.Trees.EntityFrameworkCore; +using EasyAbp.EShop.Plugins.ProductTag.ProductTags; +using EasyAbp.EShop.Plugins.ProductTag.Tags; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore +{ + [DependsOn( + typeof(ProductTagDomainModule), + typeof(AbpEntityFrameworkCoreModule), + typeof(AbpTreesEntityFrameworkCoreModule) + )] + public class ProductTagEntityFrameworkCoreModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddAbpDbContext(options => + { + /* Add custom repositories here. Example: + * options.AddRepository(); + */ + options.AddRepository(); + options.AddRepository(); + }); + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/EntityFrameworkCore/ProductTagModelBuilderConfigurationOptions.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/EntityFrameworkCore/ProductTagModelBuilderConfigurationOptions.cs new file mode 100644 index 00000000..f234aee5 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/EntityFrameworkCore/ProductTagModelBuilderConfigurationOptions.cs @@ -0,0 +1,18 @@ +using JetBrains.Annotations; +using Volo.Abp.EntityFrameworkCore.Modeling; + +namespace EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore +{ + public class ProductTagModelBuilderConfigurationOptions : AbpModelBuilderConfigurationOptions + { + public ProductTagModelBuilderConfigurationOptions( + [NotNull] string tablePrefix = "", + [CanBeNull] string schema = null) + : base( + tablePrefix, + schema) + { + + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/FodyWeavers.xml b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/FodyWeavers.xml new file mode 100644 index 00000000..be0de3a9 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/FodyWeavers.xsd b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/ProductTags/ProductTagRepository.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/ProductTags/ProductTagRepository.cs new file mode 100644 index 00000000..052993ec --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/ProductTags/ProductTagRepository.cs @@ -0,0 +1,43 @@ +using EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; + +namespace EasyAbp.EShop.Plugins.ProductTag.ProductTags +{ + public class ProductTagRepository : EfCoreRepository, IProductTagRepository + { + public ProductTagRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + + public virtual async Task> GetListByTagIdAsync(Guid categoryId, Guid? storeId = null, + CancellationToken cancellationToken = default) + { + var queryable = GetQueryable(); + if (storeId.HasValue) + { + queryable = queryable.Where(x => x.StoreId == storeId.Value); + } + + return await queryable.Where(pc => pc.TagId == categoryId).ToListAsync(cancellationToken); + } + + public virtual async Task> GetListByProductIdAsync(Guid productId, Guid? storeId = null, + CancellationToken cancellationToken = default) + { + var queryable = GetQueryable(); + if (storeId.HasValue) + { + queryable = queryable.Where(x => x.StoreId == storeId.Value); + } + + return await queryable.Where(pc => pc.ProductId == productId).ToListAsync(cancellationToken); + } + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/Tags/TagRepository.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/Tags/TagRepository.cs new file mode 100644 index 00000000..2e528cab --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore/Tags/TagRepository.cs @@ -0,0 +1,32 @@ +using EasyAbp.Abp.Trees; +using EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.EntityFrameworkCore; + +namespace EasyAbp.EShop.Plugins.ProductTag.Tags +{ + public class TagRepository : EfCoreTreeRepository, ITagRepository + { + public TagRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + + public async Task> GetListByAsync(Guid storeId, bool includeDetails = false, CancellationToken cancellationToken = default) + { + return includeDetails + ? await WithDetails().Where(x => x.StoreId == storeId).ToListAsync(GetCancellationToken(cancellationToken)) + : await GetQueryable().Where(x => x.StoreId == storeId).ToListAsync(GetCancellationToken(cancellationToken)); + } + + [Obsolete("Should use GetListByAsync(Guid storeId, bool includeDetails, CancellationToken cancellationToken)")] + public override Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = new CancellationToken()) + { + return base.GetListAsync(includeDetails, cancellationToken); + } + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.csproj b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.csproj new file mode 100644 index 00000000..6d083269 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.csproj @@ -0,0 +1,15 @@ + + + + + + netstandard2.0 + EasyAbp.EShop.Plugins.ProductTag + + + + + + + + diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client/FodyWeavers.xml b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client/FodyWeavers.xml new file mode 100644 index 00000000..be0de3a9 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client/FodyWeavers.xsd b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client/ProductTagHttpApiClientModule.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client/ProductTagHttpApiClientModule.cs new file mode 100644 index 00000000..264a411f --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client/ProductTagHttpApiClientModule.cs @@ -0,0 +1,22 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Http.Client; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Plugins.ProductTag +{ + [DependsOn( + typeof(ProductTagApplicationContractsModule), + typeof(AbpHttpClientModule))] + public class ProductTagHttpApiClientModule : AbpModule + { + public const string RemoteServiceName = "ProductTag"; + + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddHttpClientProxies( + typeof(ProductTagApplicationContractsModule).Assembly, + RemoteServiceName + ); + } + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi/EasyAbp.EShop.Plugins.ProductTag.HttpApi.csproj b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi/EasyAbp.EShop.Plugins.ProductTag.HttpApi.csproj new file mode 100644 index 00000000..decfa3db --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi/EasyAbp.EShop.Plugins.ProductTag.HttpApi.csproj @@ -0,0 +1,15 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Plugins.ProductTag + + + + + + + + diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi/FodyWeavers.xml b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi/FodyWeavers.xml new file mode 100644 index 00000000..be0de3a9 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi/FodyWeavers.xsd b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi/ProductTagBaseController.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi/ProductTagBaseController.cs new file mode 100644 index 00000000..3d123e0c --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi/ProductTagBaseController.cs @@ -0,0 +1,13 @@ +using EasyAbp.EShop.Plugins.ProductTag.Localization; +using Volo.Abp.AspNetCore.Mvc; + +namespace EasyAbp.EShop.Plugins.ProductTag +{ + public abstract class ProductTagBaseController : AbpController + { + protected ProductTagBaseController() + { + LocalizationResource = typeof(ProductTagResource); + } + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi/ProductTagHttpApiModule.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi/ProductTagHttpApiModule.cs new file mode 100644 index 00000000..90825e4d --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi/ProductTagHttpApiModule.cs @@ -0,0 +1,33 @@ +using Localization.Resources.AbpUi; +using EasyAbp.EShop.Plugins.ProductTag.Localization; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.Localization; +using Volo.Abp.Modularity; +using Microsoft.Extensions.DependencyInjection; + +namespace EasyAbp.EShop.Plugins.ProductTag +{ + [DependsOn( + typeof(ProductTagApplicationContractsModule), + typeof(AbpAspNetCoreMvcModule))] + public class ProductTagHttpApiModule : AbpModule + { + public override void PreConfigureServices(ServiceConfigurationContext context) + { + PreConfigure(mvcBuilder => + { + mvcBuilder.AddApplicationPartIfNotExists(typeof(ProductTagHttpApiModule).Assembly); + }); + } + + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.Resources + .Get() + .AddBaseTypes(typeof(AbpUiResource)); + }); + } + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi/ProductTags/ProductTagController.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi/ProductTags/ProductTagController.cs new file mode 100644 index 00000000..ab622bc1 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi/ProductTags/ProductTagController.cs @@ -0,0 +1,48 @@ +using EasyAbp.EShop.Plugins.ProductTag.ProductTags.Dtos; +using System; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp; +using Volo.Abp.Application.Dtos; + +namespace EasyAbp.EShop.Plugins.ProductTag.ProductTags +{ + [RemoteService(Name = "ProductTagService")] + [Route("/api/eShop/products/productTag")] + public class ProductTagController : ProductTagBaseController, IProductTagAppService + { + private readonly IProductTagAppService _service; + + public ProductTagController(IProductTagAppService service) + { + _service = service; + } + + [HttpPut] + public virtual Task UpdateAsync(CreateUpdateProductTagsDto input) + { + return _service.UpdateAsync(input); + } + + [RemoteService(false)] + [NonAction] + public Task GetAsync(Guid id) + { + throw new NotSupportedException(); + } + + [HttpGet] + public Task> GetListAsync(GetProductTagListDto input) + { + return _service.GetListAsync(input); + } + + + [HttpPut] + [Route("{id}")] + public Task UpdateAsync(Guid id, UpdateProductTagDto input) + { + return _service.UpdateAsync(id, input); + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi/Tags/TagController.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi/Tags/TagController.cs new file mode 100644 index 00000000..c9acb3d2 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.HttpApi/Tags/TagController.cs @@ -0,0 +1,54 @@ +using System; +using System.Threading.Tasks; +using EasyAbp.EShop.Plugins.ProductTag.Tags.Dtos; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp; +using Volo.Abp.Application.Dtos; + +namespace EasyAbp.EShop.Plugins.ProductTag.Tags +{ + [RemoteService(Name = "TagService")] + [Route("/api/eShop/products/tag")] + public class TagController : ProductTagBaseController, ITagAppService + { + private readonly ITagAppService _service; + + public TagController(ITagAppService service) + { + _service = service; + } + + [HttpGet] + [Route("{id}")] + public Task GetAsync(Guid id) + { + return _service.GetAsync(id); + } + + [HttpGet] + public Task> GetListAsync(GetTagListDto input) + { + return _service.GetListAsync(input); + } + + [HttpPost] + public Task CreateAsync(CreateTagDto input) + { + return _service.CreateAsync(input); + } + + [HttpPut] + [Route("{id}")] + public Task UpdateAsync(Guid id, UpdateTagDto input) + { + return _service.UpdateAsync(id, input); + } + + [HttpDelete] + [Route("{id}")] + public Task DeleteAsync(Guid id) + { + return _service.DeleteAsync(id); + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/EasyAbp.EShop.Plugins.ProductTag.MongoDB.csproj b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/EasyAbp.EShop.Plugins.ProductTag.MongoDB.csproj new file mode 100644 index 00000000..951ad0ea --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/EasyAbp.EShop.Plugins.ProductTag.MongoDB.csproj @@ -0,0 +1,15 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Plugins.ProductTag + + + + + + + + diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/FodyWeavers.xml b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/FodyWeavers.xml new file mode 100644 index 00000000..00e1d9a1 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/FodyWeavers.xsd b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/MongoDB/IProductTagMongoDbContext.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/MongoDB/IProductTagMongoDbContext.cs new file mode 100644 index 00000000..c82594b7 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/MongoDB/IProductTagMongoDbContext.cs @@ -0,0 +1,13 @@ +using Volo.Abp.Data; +using Volo.Abp.MongoDB; + +namespace EasyAbp.EShop.Plugins.ProductTag.MongoDB +{ + [ConnectionStringName(ProductTagDbProperties.ConnectionStringName)] + public interface IProductTagMongoDbContext : IAbpMongoDbContext + { + /* Define mongo collections here. Example: + * IMongoCollection Questions { get; } + */ + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/MongoDB/ProductTagMongoDbContext.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/MongoDB/ProductTagMongoDbContext.cs new file mode 100644 index 00000000..2bfe8f87 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/MongoDB/ProductTagMongoDbContext.cs @@ -0,0 +1,20 @@ +using Volo.Abp.Data; +using Volo.Abp.MongoDB; + +namespace EasyAbp.EShop.Plugins.ProductTag.MongoDB +{ + [ConnectionStringName(ProductTagDbProperties.ConnectionStringName)] + public class ProductTagMongoDbContext : AbpMongoDbContext, IProductTagMongoDbContext + { + /* Add mongo collections here. Example: + * public IMongoCollection Questions => Collection(); + */ + + protected override void CreateModel(IMongoModelBuilder modelBuilder) + { + base.CreateModel(modelBuilder); + + modelBuilder.ConfigureProductTag(); + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/MongoDB/ProductTagMongoDbContextExtensions.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/MongoDB/ProductTagMongoDbContextExtensions.cs new file mode 100644 index 00000000..00b88801 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/MongoDB/ProductTagMongoDbContextExtensions.cs @@ -0,0 +1,22 @@ +using System; +using Volo.Abp; +using Volo.Abp.MongoDB; + +namespace EasyAbp.EShop.Plugins.ProductTag.MongoDB +{ + public static class ProductTagMongoDbContextExtensions + { + public static void ConfigureProductTag( + this IMongoModelBuilder builder, + Action optionsAction = null) + { + Check.NotNull(builder, nameof(builder)); + + var options = new ProductTagMongoModelBuilderConfigurationOptions( + ProductTagDbProperties.DbTablePrefix + ); + + optionsAction?.Invoke(options); + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/MongoDB/ProductTagMongoDbModule.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/MongoDB/ProductTagMongoDbModule.cs new file mode 100644 index 00000000..2b28a721 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/MongoDB/ProductTagMongoDbModule.cs @@ -0,0 +1,23 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Modularity; +using Volo.Abp.MongoDB; + +namespace EasyAbp.EShop.Plugins.ProductTag.MongoDB +{ + [DependsOn( + typeof(ProductTagDomainModule), + typeof(AbpMongoDbModule) + )] + public class ProductTagMongoDbModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddMongoDbContext(options => + { + /* Add custom repositories here. Example: + * options.AddRepository(); + */ + }); + } + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/MongoDB/ProductTagMongoModelBuilderConfigurationOptions.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/MongoDB/ProductTagMongoModelBuilderConfigurationOptions.cs new file mode 100644 index 00000000..b052723e --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.MongoDB/MongoDB/ProductTagMongoModelBuilderConfigurationOptions.cs @@ -0,0 +1,14 @@ +using JetBrains.Annotations; +using Volo.Abp.MongoDB; + +namespace EasyAbp.EShop.Plugins.ProductTag.MongoDB +{ + public class ProductTagMongoModelBuilderConfigurationOptions : AbpMongoModelBuilderConfigurationOptions + { + public ProductTagMongoModelBuilderConfigurationOptions( + [NotNull] string collectionPrefix = "") + : base(collectionPrefix) + { + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/EasyAbp.EShop.Plugins.ProductTag.Web.csproj b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/EasyAbp.EShop.Plugins.ProductTag.Web.csproj new file mode 100644 index 00000000..6a8d8589 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/EasyAbp.EShop.Plugins.ProductTag.Web.csproj @@ -0,0 +1,47 @@ + + + + + + netcoreapp3.1 + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + true + Library + EasyAbp.EShop.Plugins.ProductTag.Web + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/FodyWeavers.xml b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/FodyWeavers.xml new file mode 100644 index 00000000..be0de3a9 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/FodyWeavers.xsd b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Menus/ProductTagMenuContributor.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Menus/ProductTagMenuContributor.cs new file mode 100644 index 00000000..23344d33 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Menus/ProductTagMenuContributor.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using EasyAbp.EShop.Plugins.ProductTag.Localization; +using EasyAbp.EShop.Plugins.ProductTag.Permissions; +using EasyAbp.EShop.Products.Web.Menus; +using System.Threading.Tasks; +using Volo.Abp.UI.Navigation; + +namespace EasyAbp.EShop.Plugins.ProductTag.Web.Menus +{ + public class ProductTagMenuContributor : IMenuContributor + { + public async Task ConfigureMenuAsync(MenuConfigurationContext context) + { + if (context.Menu.Name == StandardMenus.Main) + { + await ConfigureMainMenu(context); + } + } + + private async Task ConfigureMainMenu(MenuConfigurationContext context) + { + //Add main menu items. + var l = context.GetLocalizer(); + + var eShopMenuItem = context.Menu.Items.GetOrAdd(i => i.Name == ProductsMenus.ModuleGroupPrefix, + () => new ApplicationMenuItem(ProductsMenus.ModuleGroupPrefix, l["Menu:EasyAbpEShop"])); + + var productManagementMenuItem = eShopMenuItem.Items.GetOrAdd(x => x.Name == ProductsMenus.Prefix, + () => new ApplicationMenuItem(ProductsMenus.Prefix, l["Menu:ProductManagement"])); + + if (await context.IsGrantedAsync(ProductTagPermissions.Tags.Default)) + { + productManagementMenuItem.AddItem( + new ApplicationMenuItem(ProductTagMenus.Tag, l["Menu:Tag"], "/EShop/Products/Tags/Tag") + ); + } + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Menus/ProductTagMenus.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Menus/ProductTagMenus.cs new file mode 100644 index 00000000..9d59ae47 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Menus/ProductTagMenus.cs @@ -0,0 +1,13 @@ +namespace EasyAbp.EShop.Plugins.ProductTag.Web.Menus +{ + public class ProductTagMenus + { + private const string Prefix = "ProductTag"; + + //Add your menu items here... + //public const string Home = Prefix + ".MyNewMenuItem"; + + + public const string Tag = Prefix + ".Tag"; + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/ProductTag/Index.cshtml b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/ProductTag/Index.cshtml new file mode 100644 index 00000000..85b85366 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/ProductTag/Index.cshtml @@ -0,0 +1,9 @@ +@page +@using Microsoft.Extensions.Localization +@using EasyAbp.EShop.Plugins.ProductTag.Localization +@model EasyAbp.EShop.Plugins.ProductTag.Web.Pages.EShop.Products.ProductTag.IndexModel +@inject IStringLocalizer L +@{ +} +

ProductTag

+

@L["SamplePageMessage"]

diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/ProductTag/Index.cshtml.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/ProductTag/Index.cshtml.cs new file mode 100644 index 00000000..c4fc906c --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/ProductTag/Index.cshtml.cs @@ -0,0 +1,9 @@ +namespace EasyAbp.EShop.Plugins.ProductTag.Web.Pages.EShop.Products.ProductTag +{ + public class IndexModel : ProductTagPageModel + { + public void OnGet() + { + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/ProductTag/_ViewImports.cshtml b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/ProductTag/_ViewImports.cshtml new file mode 100644 index 00000000..c1da1f5f --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/ProductTag/_ViewImports.cshtml @@ -0,0 +1,4 @@ +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI +@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap +@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/Tags/Tag/CreateModal.cshtml b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/Tags/Tag/CreateModal.cshtml new file mode 100644 index 00000000..07cc44da --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/Tags/Tag/CreateModal.cshtml @@ -0,0 +1,18 @@ +@page +@using EasyAbp.EShop.Plugins.ProductTag.Localization +@using Microsoft.AspNetCore.Mvc.Localization +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal; +@inject IHtmlLocalizer L +@model EasyAbp.EShop.Plugins.ProductTag.Web.Pages.EShop.Products.Tags.Tag.CreateModalModel +@{ + Layout = null; +} + + + + + + + + + \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/Tags/Tag/CreateModal.cshtml.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/Tags/Tag/CreateModal.cshtml.cs new file mode 100644 index 00000000..134cb57e --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/Tags/Tag/CreateModal.cshtml.cs @@ -0,0 +1,26 @@ +using System.Threading.Tasks; +using EasyAbp.EShop.Plugins.ProductTag.Tags; +using EasyAbp.EShop.Plugins.ProductTag.Tags.Dtos; +using Microsoft.AspNetCore.Mvc; + +namespace EasyAbp.EShop.Plugins.ProductTag.Web.Pages.EShop.Products.Tags.Tag +{ + public class CreateModalModel : ProductTagPageModel + { + [BindProperty] + public CreateTagDto ViewModel { get; set; } + + private readonly ITagAppService _service; + + public CreateModalModel(ITagAppService service) + { + _service = service; + } + + public virtual async Task OnPostAsync() + { + await _service.CreateAsync(ViewModel); + return NoContent(); + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/Tags/Tag/EditModal.cshtml b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/Tags/Tag/EditModal.cshtml new file mode 100644 index 00000000..ffb257f8 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/Tags/Tag/EditModal.cshtml @@ -0,0 +1,19 @@ +@page +@using EasyAbp.EShop.Plugins.ProductTag.Localization +@using Microsoft.AspNetCore.Mvc.Localization +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal; +@inject IHtmlLocalizer L +@model EasyAbp.EShop.Plugins.ProductTag.Web.Pages.EShop.Products.Tags.Tag.EditModalModel +@{ + Layout = null; +} + + + + + + + + + + diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/Tags/Tag/EditModal.cshtml.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/Tags/Tag/EditModal.cshtml.cs new file mode 100644 index 00000000..61595422 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/Tags/Tag/EditModal.cshtml.cs @@ -0,0 +1,37 @@ +using System; +using System.Threading.Tasks; +using EasyAbp.EShop.Plugins.ProductTag.Tags; +using EasyAbp.EShop.Plugins.ProductTag.Tags.Dtos; +using Microsoft.AspNetCore.Mvc; + +namespace EasyAbp.EShop.Plugins.ProductTag.Web.Pages.EShop.Products.Tags.Tag +{ + public class EditModalModel : ProductTagPageModel + { + [HiddenInput] + [BindProperty(SupportsGet = true)] + public Guid Id { get; set; } + + [BindProperty] + public UpdateTagDto ViewModel { get; set; } + + private readonly ITagAppService _service; + + public EditModalModel(ITagAppService service) + { + _service = service; + } + + public virtual async Task OnGetAsync() + { + var dto = await _service.GetAsync(Id); + ViewModel = ObjectMapper.Map(dto); + } + + public virtual async Task OnPostAsync() + { + await _service.UpdateAsync(Id, ViewModel); + return NoContent(); + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/Tags/Tag/Index.cshtml b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/Tags/Tag/Index.cshtml new file mode 100644 index 00000000..4de9187d --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/Tags/Tag/Index.cshtml @@ -0,0 +1,61 @@ +@page +@using EasyAbp.EShop.Plugins.ProductTag.Localization +@using EasyAbp.EShop.Plugins.ProductTag.Web.Menus +@using Microsoft.AspNetCore.Mvc.Localization +@using Volo.Abp.AspNetCore.Mvc.UI.Layout +@model EasyAbp.EShop.Plugins.ProductTag.Web.Pages.EShop.Products.Tags.Tag.IndexModel +@inject IPageLayout PageLayout +@inject IHtmlLocalizer L +@{ + PageLayout.Content.Title = L["Tag"].Value; + PageLayout.Content.BreadCrumb.Add(L["Menu:Tag"].Value); + PageLayout.Content.MenuItemName = ProductTagMenus.Tag; +} + +@section scripts +{ + +} +@section styles +{ + +} + + + + + + + @L["Tag"] - @Model.StoreName + + + + + + + + + + + @L["Actions"] + Id + @*@L["TagStoreId"]*@ + @L["TagDescription"] + @L["TagMediaResources"] + @*@L["TagIsHidden"]*@ + @L["TagDisplayName"] + @*@L["TagCode"]*@ + @*@L["TagLevel"]*@ + @L["TagParentId"] + @*@L["TagParent"] + @L["TagChildren"]*@ + + + + + \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/Tags/Tag/Index.cshtml.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/Tags/Tag/Index.cshtml.cs new file mode 100644 index 00000000..ec5a07d9 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/Tags/Tag/Index.cshtml.cs @@ -0,0 +1,51 @@ +using EasyAbp.EShop.Stores.StoreOwners; +using EasyAbp.EShop.Stores.StoreOwners.Dtos; +using EasyAbp.EShop.Stores.Stores; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Linq; +using System.Threading.Tasks; + +namespace EasyAbp.EShop.Plugins.ProductTag.Web.Pages.EShop.Products.Tags.Tag +{ + public class IndexModel : ProductTagPageModel + { + private readonly IStoreAppService _storeAppService; + private readonly IStoreOwnerAppService _storeOwnerAppService; + + [BindProperty(SupportsGet = true)] + public Guid? StoreId { get; set; } + + public string StoreName { get; set; } + + public IndexModel(IStoreAppService storeAppService, + IStoreOwnerAppService storeOwnerAppService) + { + _storeAppService = storeAppService; + _storeOwnerAppService = storeOwnerAppService; + } + + public virtual async Task OnGetAsync() + { + //TODO: Need to handle: when StoreId is empty, and current user owns multiple store + if (!StoreId.HasValue && CurrentUser.Id.HasValue) + { + var storeOwners = await _storeOwnerAppService.GetListAsync(new GetStoreOwnerListDto + { + OwnerId = CurrentUser.Id.Value, + }); + + StoreId = storeOwners.Items.FirstOrDefault()?.StoreId; + } + + //show default store + if (!StoreId.HasValue) + { + var defaultStore = await _storeAppService.GetDefaultAsync(); + StoreId = defaultStore.Id; + } + + StoreName = (await _storeAppService.GetAsync(StoreId.Value)).Name; + } + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/Tags/Tag/index.css b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/Tags/Tag/index.css new file mode 100644 index 00000000..e69de29b diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/Tags/Tag/index.js b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/Tags/Tag/index.js new file mode 100644 index 00000000..1617ed57 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/EShop/Products/Tags/Tag/index.js @@ -0,0 +1,80 @@ +$(function () { + + var l = abp.localization.getResource('Products'); + + var service = easyAbp.eShop.products.tags.tag; + var createModal = new abp.ModalManager(abp.appPath + 'EShop/Products/Tags/Tag/CreateModal'); + var editModal = new abp.ModalManager(abp.appPath + 'EShop/Products/Tags/Tag/EditModal'); + + var dataTable = $('#TagTable').DataTable(abp.libs.datatables.normalizeConfiguration({ + processing: true, + serverSide: true, + paging: true, + searching: false, + autoWidth: false, + scrollCollapse: true, + order: [[1, "asc"]], + ajax: abp.libs.datatables.createAjax(service.getList, function () { + return { storeId: storeId, showHidden: true } + }), + columnDefs: [ + { + rowAction: { + items: + [ + { + text: l('Product'), + action: function (data) { + document.location.href = document.location.origin + + '/EShop/Products/Products/Product?StoreId=' + storeId + '&TagId=' + data.record.id; + } + }, + { + text: l('Edit'), + action: function (data) { + editModal.open({ id: data.record.id }); + } + }, + { + text: l('Delete'), + confirmMessage: function (data) { + return l('TagDeletionConfirmationMessage', data.record.id); + }, + action: function (data) { + service.delete(data.record.id) + .then(function () { + abp.notify.info(l('SuccessfullyDeleted')); + dataTable.ajax.reload(); + }); + } + } + ] + } + }, + { data: "id"}, + //{ data: "storeId" }, + { data: "description" }, + { data: "mediaResources" }, + //{ data: "isHidden" }, + { data: "displayName" }, + //{ data: "code" }, + //{ data: "level" }, + { data: "parentId" }, + //{ data: "parent" }, + //{ data: "children" }, + ] + })); + + createModal.onResult(function () { + dataTable.ajax.reload(); + }); + + editModal.onResult(function () { + dataTable.ajax.reload(); + }); + + $('#NewTagButton').click(function (e) { + e.preventDefault(); + createModal.open(); + }); +}); \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/ProductTagPageModel.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/ProductTagPageModel.cs new file mode 100644 index 00000000..7cb25b39 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Pages/ProductTagPageModel.cs @@ -0,0 +1,16 @@ +using EasyAbp.EShop.Plugins.ProductTag.Localization; +using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; + +namespace EasyAbp.EShop.Plugins.ProductTag.Web.Pages +{ + /* Inherit your PageModel classes from this class. + */ + public abstract class ProductTagPageModel : AbpPageModel + { + protected ProductTagPageModel() + { + LocalizationResourceType = typeof(ProductTagResource); + ObjectMapperContext = typeof(ProductTagWebModule); + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/ProductTagWebAutoMapperProfile.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/ProductTagWebAutoMapperProfile.cs new file mode 100644 index 00000000..e6196b15 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/ProductTagWebAutoMapperProfile.cs @@ -0,0 +1,18 @@ +using AutoMapper; +using EasyAbp.EShop.Plugins.ProductTag.Tags.Dtos; + +namespace EasyAbp.EShop.Plugins.ProductTag.Web +{ + public class ProductTagWebAutoMapperProfile : Profile + { + public ProductTagWebAutoMapperProfile() + { + /* You can configure your AutoMapper mapping configuration here. + * Alternatively, you can split your mapping configurations + * into multiple profile classes for a better organization. */ + + CreateMap(); + CreateMap(); + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/ProductTagWebModule.cs b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/ProductTagWebModule.cs new file mode 100644 index 00000000..79dbc117 --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/ProductTagWebModule.cs @@ -0,0 +1,58 @@ +using EasyAbp.EShop.Plugins.ProductTag.Localization; +using EasyAbp.EShop.Plugins.ProductTag.Web.Menus; +using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.AspNetCore.Mvc.Localization; +using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; +using Volo.Abp.AutoMapper; +using Volo.Abp.Modularity; +using Volo.Abp.UI.Navigation; +using Volo.Abp.VirtualFileSystem; + +namespace EasyAbp.EShop.Plugins.ProductTag.Web +{ + [DependsOn( + typeof(ProductTagHttpApiModule), + typeof(AbpAspNetCoreMvcUiThemeSharedModule), + typeof(AbpAutoMapperModule) + )] + public class ProductTagWebModule : AbpModule + { + public override void PreConfigureServices(ServiceConfigurationContext context) + { + context.Services.PreConfigure(options => + { + options.AddAssemblyResource(typeof(ProductTagResource), typeof(ProductTagWebModule).Assembly); + }); + + PreConfigure(mvcBuilder => + { + mvcBuilder.AddApplicationPartIfNotExists(typeof(ProductTagWebModule).Assembly); + }); + } + + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.MenuContributors.Add(new ProductTagMenuContributor()); + }); + + Configure(options => + { + options.FileSets.AddEmbedded(); + }); + + context.Services.AddAutoMapperObjectMapper(); + Configure(options => + { + options.AddMaps(validate: true); + }); + + Configure(options => + { + //Configure authorization. + }); + } + } +} diff --git a/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Properties/launchSettings.json b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Properties/launchSettings.json new file mode 100644 index 00000000..0f428ebe --- /dev/null +++ b/plugins/ProductTag/src/EasyAbp.EShop.Plugins.ProductTag.Web/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:1625/", + "sslPort": 44392 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "EasyAbp.EShop.Plugins.ProductTag.Web": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:5001;http://localhost:5000" + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Application.Tests/EasyAbp.EShop.Plugins.ProductTag.Application.Tests.csproj b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Application.Tests/EasyAbp.EShop.Plugins.ProductTag.Application.Tests.csproj new file mode 100644 index 00000000..0d0e5054 --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Application.Tests/EasyAbp.EShop.Plugins.ProductTag.Application.Tests.csproj @@ -0,0 +1,16 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Plugins.ProductTag + + + + + + + + + diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Application.Tests/ProductTagApplicationTestBase.cs b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Application.Tests/ProductTagApplicationTestBase.cs new file mode 100644 index 00000000..aa019db8 --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Application.Tests/ProductTagApplicationTestBase.cs @@ -0,0 +1,10 @@ +namespace EasyAbp.EShop.Plugins.ProductTag +{ + /* Inherit from this class for your application layer tests. + * See SampleAppService_Tests for example. + */ + public abstract class ProductTagApplicationTestBase : ProductTagTestBase + { + + } +} \ No newline at end of file diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Application.Tests/ProductTagApplicationTestModule.cs b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Application.Tests/ProductTagApplicationTestModule.cs new file mode 100644 index 00000000..662e0188 --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Application.Tests/ProductTagApplicationTestModule.cs @@ -0,0 +1,13 @@ +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Plugins.ProductTag +{ + [DependsOn( + typeof(ProductTagApplicationModule), + typeof(ProductTagDomainTestModule) + )] + public class ProductTagApplicationTestModule : AbpModule + { + + } +} diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Application.Tests/Samples/SampleAppService_Tests.cs b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Application.Tests/Samples/SampleAppService_Tests.cs new file mode 100644 index 00000000..6e5f4666 --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Application.Tests/Samples/SampleAppService_Tests.cs @@ -0,0 +1,30 @@ +using System.Threading.Tasks; +using Shouldly; +using Xunit; + +namespace EasyAbp.EShop.Plugins.ProductTag.Samples +{ + public class SampleAppService_Tests : ProductTagApplicationTestBase + { + private readonly ISampleAppService _sampleAppService; + + public SampleAppService_Tests() + { + _sampleAppService = GetRequiredService(); + } + + [Fact] + public async Task GetAsync() + { + var result = await _sampleAppService.GetAsync(); + result.Value.ShouldBe(42); + } + + [Fact] + public async Task GetAuthorizedAsync() + { + var result = await _sampleAppService.GetAuthorizedAsync(); + result.Value.ShouldBe(42); + } + } +} diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Domain.Tests/EasyAbp.EShop.Plugins.ProductTag.Domain.Tests.csproj b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Domain.Tests/EasyAbp.EShop.Plugins.ProductTag.Domain.Tests.csproj new file mode 100644 index 00000000..5ced1389 --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Domain.Tests/EasyAbp.EShop.Plugins.ProductTag.Domain.Tests.csproj @@ -0,0 +1,15 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Plugins.ProductTag + + + + + + + + diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Domain.Tests/ProductTagDomainTestBase.cs b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Domain.Tests/ProductTagDomainTestBase.cs new file mode 100644 index 00000000..9ea5f5aa --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Domain.Tests/ProductTagDomainTestBase.cs @@ -0,0 +1,10 @@ +namespace EasyAbp.EShop.Plugins.ProductTag +{ + /* Inherit from this class for your domain layer tests. + * See SampleManager_Tests for example. + */ + public abstract class ProductTagDomainTestBase : ProductTagTestBase + { + + } +} \ No newline at end of file diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Domain.Tests/ProductTagDomainTestModule.cs b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Domain.Tests/ProductTagDomainTestModule.cs new file mode 100644 index 00000000..a287e7b9 --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Domain.Tests/ProductTagDomainTestModule.cs @@ -0,0 +1,17 @@ +using EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Plugins.ProductTag +{ + /* Domain tests are configured to use the EF Core provider. + * You can switch to MongoDB, however your domain tests should be + * database independent anyway. + */ + [DependsOn( + typeof(ProductTagEntityFrameworkCoreTestModule) + )] + public class ProductTagDomainTestModule : AbpModule + { + + } +} diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Domain.Tests/Samples/SampleManager_Tests.cs b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Domain.Tests/Samples/SampleManager_Tests.cs new file mode 100644 index 00000000..529935d2 --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.Domain.Tests/Samples/SampleManager_Tests.cs @@ -0,0 +1,21 @@ +using System.Threading.Tasks; +using Xunit; + +namespace EasyAbp.EShop.Plugins.ProductTag.Samples +{ + public class SampleManager_Tests : ProductTagDomainTestBase + { + //private readonly SampleManager _sampleManager; + + public SampleManager_Tests() + { + //_sampleManager = GetRequiredService(); + } + + [Fact] + public async Task Method1Async() + { + + } + } +} diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore.Tests/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore.Tests.csproj b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore.Tests/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore.Tests.csproj new file mode 100644 index 00000000..ae7e53ba --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore.Tests/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore.Tests.csproj @@ -0,0 +1,18 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Plugins.ProductTag + + + + + + + + + + + diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore.Tests/EntityFrameworkCore/ProductTagEntityFrameworkCoreTestBase.cs b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore.Tests/EntityFrameworkCore/ProductTagEntityFrameworkCoreTestBase.cs new file mode 100644 index 00000000..daa009b6 --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore.Tests/EntityFrameworkCore/ProductTagEntityFrameworkCoreTestBase.cs @@ -0,0 +1,10 @@ +namespace EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore +{ + /* This class can be used as a base class for EF Core integration tests, + * while SampleRepository_Tests uses a different approach. + */ + public abstract class ProductTagEntityFrameworkCoreTestBase : ProductTagTestBase + { + + } +} \ No newline at end of file diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore.Tests/EntityFrameworkCore/ProductTagEntityFrameworkCoreTestModule.cs b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore.Tests/EntityFrameworkCore/ProductTagEntityFrameworkCoreTestModule.cs new file mode 100644 index 00000000..388da505 --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore.Tests/EntityFrameworkCore/ProductTagEntityFrameworkCoreTestModule.cs @@ -0,0 +1,43 @@ +using Microsoft.Data.Sqlite; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage; +using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore.Sqlite; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore +{ + [DependsOn( + typeof(ProductTagTestBaseModule), + typeof(ProductTagEntityFrameworkCoreModule), + typeof(AbpEntityFrameworkCoreSqliteModule) + )] + public class ProductTagEntityFrameworkCoreTestModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + var sqliteConnection = CreateDatabaseAndGetConnection(); + + Configure(options => + { + options.Configure(abpDbContextConfigurationContext => + { + abpDbContextConfigurationContext.DbContextOptions.UseSqlite(sqliteConnection); + }); + }); + } + + private static SqliteConnection CreateDatabaseAndGetConnection() + { + var connection = new SqliteConnection("Data Source=:memory:"); + connection.Open(); + + new ProductTagDbContext( + new DbContextOptionsBuilder().UseSqlite(connection).Options + ).GetService().CreateTables(); + + return connection; + } + } +} diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepository_Tests.cs b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepository_Tests.cs new file mode 100644 index 00000000..4b161b23 --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepository_Tests.cs @@ -0,0 +1,12 @@ +using EasyAbp.EShop.Plugins.ProductTag.Samples; + +namespace EasyAbp.EShop.Plugins.ProductTag.EntityFrameworkCore.Samples +{ + public class SampleRepository_Tests : SampleRepository_Tests + { + /* Don't write custom repository tests here, instead write to + * the base class. + * One exception can be some specific tests related to EF core. + */ + } +} diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs new file mode 100644 index 00000000..cffdd8fb --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs @@ -0,0 +1,156 @@ +using System; +using System.Net.Http; +using System.Threading.Tasks; +using IdentityModel.Client; +using Microsoft.Extensions.Configuration; +using EasyAbp.EShop.Plugins.ProductTag.Samples; +using Volo.Abp.DependencyInjection; +using Volo.Abp.IdentityModel; + +namespace EasyAbp.EShop.Plugins.ProductTag +{ + public class ClientDemoService : ITransientDependency + { + private readonly ISampleAppService _sampleAppService; + private readonly IIdentityModelAuthenticationService _authenticationService; + private readonly IConfiguration _configuration; + + public ClientDemoService( + ISampleAppService sampleAppService, + IIdentityModelAuthenticationService authenticationService, + IConfiguration configuration) + { + _sampleAppService = sampleAppService; + _authenticationService = authenticationService; + _configuration = configuration; + } + + public async Task RunAsync() + { + await TestWithDynamicProxiesAsync(); + await TestWithHttpClientAndIdentityModelAuthenticationServiceAsync(); + await TestAllManuallyAsync(); + } + + /* Shows how to perform an HTTP request to the API using ABP's dynamic c# proxy + * feature. It is just simple as calling a local service method. + * Authorization and HTTP request details are handled by the ABP framework. + */ + private async Task TestWithDynamicProxiesAsync() + { + Console.WriteLine(); + Console.WriteLine($"***** {nameof(TestWithDynamicProxiesAsync)} *****"); + + var result = await _sampleAppService.GetAsync(); + Console.WriteLine("Result: " + result.Value); + + result = await _sampleAppService.GetAuthorizedAsync(); + Console.WriteLine("Result (authorized): " + result.Value); + } + + /* Shows how to use HttpClient to perform a request to the HTTP API. + * It uses ABP's IIdentityModelAuthenticationService to simplify obtaining access tokens. + */ + private async Task TestWithHttpClientAndIdentityModelAuthenticationServiceAsync() + { + Console.WriteLine(); + Console.WriteLine($"***** {nameof(TestWithHttpClientAndIdentityModelAuthenticationServiceAsync)} *****"); + + //Get access token using ABP's IIdentityModelAuthenticationService + + var accessToken = await _authenticationService.GetAccessTokenAsync( + new IdentityClientConfiguration( + _configuration["IdentityClients:Default:Authority"], + _configuration["IdentityClients:Default:Scope"], + _configuration["IdentityClients:Default:ClientId"], + _configuration["IdentityClients:Default:ClientSecret"], + _configuration["IdentityClients:Default:GrantType"], + _configuration["IdentityClients:Default:UserName"], + _configuration["IdentityClients:Default:UserPassword"] + ) + ); + + //Perform the actual HTTP request + + using (var httpClient = new HttpClient()) + { + httpClient.SetBearerToken(accessToken); + + var url = _configuration["RemoteServices:ProductTag:BaseUrl"] + + "api/ProductTag/sample/authorized"; + + var responseMessage = await httpClient.GetAsync(url); + if (responseMessage.IsSuccessStatusCode) + { + var responseString = await responseMessage.Content.ReadAsStringAsync(); + Console.WriteLine("Result: " + responseString); + } + else + { + throw new Exception("Remote server returns error code: " + responseMessage.StatusCode); + } + } + } + + /* Shows how to use HttpClient to perform a request to the HTTP API. + * It obtains access token using IdentityServer's API. See its documentation: + * https://identityserver4.readthedocs.io/en/latest/quickstarts/2_resource_owner_passwords.html + */ + private async Task TestAllManuallyAsync() + { + Console.WriteLine(); + Console.WriteLine($"***** {nameof(TestAllManuallyAsync)} *****"); + + //Obtain access token from the IDS4 server + + // discover endpoints from metadata + var client = new HttpClient(); + var disco = await client.GetDiscoveryDocumentAsync(_configuration["IdentityClients:Default:Authority"]); + if (disco.IsError) + { + Console.WriteLine(disco.Error); + return; + } + + // request token + var tokenResponse = await client.RequestPasswordTokenAsync(new PasswordTokenRequest + { + Address = disco.TokenEndpoint, + ClientId = _configuration["IdentityClients:Default:ClientId"], + ClientSecret = _configuration["IdentityClients:Default:ClientSecret"], + UserName = _configuration["IdentityClients:Default:UserName"], + Password = _configuration["IdentityClients:Default:UserPassword"], + Scope = _configuration["IdentityClients:Default:Scope"] + }); + + if (tokenResponse.IsError) + { + Console.WriteLine(tokenResponse.Error); + return; + } + + Console.WriteLine(tokenResponse.Json); + + //Perform the actual HTTP request + + using (var httpClient = new HttpClient()) + { + httpClient.SetBearerToken(tokenResponse.AccessToken); + + var url = _configuration["RemoteServices:ProductTag:BaseUrl"] + + "api/ProductTag/sample/authorized"; + + var responseMessage = await httpClient.GetAsync(url); + if (responseMessage.IsSuccessStatusCode) + { + var responseString = await responseMessage.Content.ReadAsStringAsync(); + Console.WriteLine("Result: " + responseString); + } + else + { + throw new Exception("Remote server returns error code: " + responseMessage.StatusCode); + } + } + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs new file mode 100644 index 00000000..06b96ffe --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs @@ -0,0 +1,26 @@ +using Microsoft.Extensions.Hosting; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; + +namespace EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp +{ + public class ConsoleTestAppHostedService : IHostedService + { + public async Task StartAsync(CancellationToken cancellationToken) + { + using (var application = AbpApplicationFactory.Create()) + { + application.Initialize(); + + var demo = application.ServiceProvider.GetRequiredService(); + await demo.RunAsync(); + + application.Shutdown(); + } + } + + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; + } +} diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp.csproj b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp.csproj new file mode 100644 index 00000000..99cf34c2 --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp.csproj @@ -0,0 +1,26 @@ + + + + Exe + netcoreapp3.1 + EasyAbp.EShop.Plugins.ProductTag + + + + + + + + + + + PreserveNewest + Always + + + + + + + + diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp/ProductTagConsoleApiClientModule.cs b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp/ProductTagConsoleApiClientModule.cs new file mode 100644 index 00000000..00c5cb52 --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp/ProductTagConsoleApiClientModule.cs @@ -0,0 +1,14 @@ +using Volo.Abp.Http.Client.IdentityModel; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Plugins.ProductTag +{ + [DependsOn( + typeof(ProductTagHttpApiClientModule), + typeof(AbpHttpClientIdentityModelModule) + )] + public class ProductTagConsoleApiClientModule : AbpModule + { + + } +} diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp/Program.cs b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp/Program.cs new file mode 100644 index 00000000..282fb945 --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp/Program.cs @@ -0,0 +1,21 @@ +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +namespace EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp +{ + class Program + { + static async Task Main(string[] args) + { + await CreateHostBuilder(args).RunConsoleAsync(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureServices((hostContext, services) => + { + services.AddHostedService(); + }); + } +} diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp/appsettings.json b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp/appsettings.json new file mode 100644 index 00000000..220d40f5 --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.HttpApi.Client.ConsoleTestApp/appsettings.json @@ -0,0 +1,21 @@ +{ + "RemoteServices": { + "Default": { + "BaseUrl": "https://localhost:44362/" + }, + "ProductTag": { + "BaseUrl": "https://localhost:44375/" + } + }, + "IdentityClients": { + "Default": { + "GrantType": "password", + "ClientId": "ProductTag_ConsoleTestApp", + "ClientSecret": "1q2w3e*", + "UserName": "admin", + "UserPassword": "1q2w3E*", + "Authority": "https://localhost:44362/", + "Scope": "ProductTag" + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests/EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests.csproj b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests/EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests.csproj new file mode 100644 index 00000000..d0f972bf --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests/EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests.csproj @@ -0,0 +1,17 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Plugins.ProductTag + + + + + + + + + + diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests/MongoDB/MongoDbFixture.cs b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests/MongoDB/MongoDbFixture.cs new file mode 100644 index 00000000..7e1890b4 --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests/MongoDB/MongoDbFixture.cs @@ -0,0 +1,22 @@ +using System; +using Mongo2Go; + +namespace EasyAbp.EShop.Plugins.ProductTag.MongoDB +{ + public class MongoDbFixture : IDisposable + { + private static readonly MongoDbRunner MongoDbRunner; + public static readonly string ConnectionString; + + static MongoDbFixture() + { + MongoDbRunner = MongoDbRunner.Start(); + ConnectionString = MongoDbRunner.ConnectionString; + } + + public void Dispose() + { + MongoDbRunner?.Dispose(); + } + } +} diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests/MongoDB/MongoTestCollection.cs b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests/MongoDB/MongoTestCollection.cs new file mode 100644 index 00000000..5021a6fe --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests/MongoDB/MongoTestCollection.cs @@ -0,0 +1,10 @@ +using Xunit; + +namespace EasyAbp.EShop.Plugins.ProductTag.MongoDB +{ + [CollectionDefinition(Name)] + public class MongoTestCollection : ICollectionFixture + { + public const string Name = "MongoDB Collection"; + } +} \ No newline at end of file diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests/MongoDB/ProductTagMongoDbTestBase.cs b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests/MongoDB/ProductTagMongoDbTestBase.cs new file mode 100644 index 00000000..b4814cc2 --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests/MongoDB/ProductTagMongoDbTestBase.cs @@ -0,0 +1,10 @@ +namespace EasyAbp.EShop.Plugins.ProductTag.MongoDB +{ + /* This class can be used as a base class for MongoDB integration tests, + * while SampleRepository_Tests uses a different approach. + */ + public abstract class ProductTagMongoDbTestBase : ProductTagTestBase + { + + } +} \ No newline at end of file diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests/MongoDB/ProductTagMongoDbTestModule.cs b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests/MongoDB/ProductTagMongoDbTestModule.cs new file mode 100644 index 00000000..f77a5e40 --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests/MongoDB/ProductTagMongoDbTestModule.cs @@ -0,0 +1,25 @@ +using System; +using Volo.Abp.Data; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Plugins.ProductTag.MongoDB +{ + [DependsOn( + typeof(ProductTagTestBaseModule), + typeof(ProductTagMongoDbModule) + )] + public class ProductTagMongoDbTestModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + var connectionString = MongoDbFixture.ConnectionString.EnsureEndsWith('/') + + "Db_" + + Guid.NewGuid().ToString("N"); + + Configure(options => + { + options.ConnectionStrings.Default = connectionString; + }); + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests/MongoDB/Samples/SampleRepository_Tests.cs b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests/MongoDB/Samples/SampleRepository_Tests.cs new file mode 100644 index 00000000..0c1e9333 --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.MongoDB.Tests/MongoDB/Samples/SampleRepository_Tests.cs @@ -0,0 +1,14 @@ +using EasyAbp.EShop.Plugins.ProductTag.Samples; +using Xunit; + +namespace EasyAbp.EShop.Plugins.ProductTag.MongoDB.Samples +{ + [Collection(MongoTestCollection.Name)] + public class SampleRepository_Tests : SampleRepository_Tests + { + /* Don't write custom repository tests here, instead write to + * the base class. + * One exception can be some specific tests related to MongoDB. + */ + } +} diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.TestBase/EasyAbp.EShop.Plugins.ProductTag.TestBase.csproj b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.TestBase/EasyAbp.EShop.Plugins.ProductTag.TestBase.csproj new file mode 100644 index 00000000..d8c26cfe --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.TestBase/EasyAbp.EShop.Plugins.ProductTag.TestBase.csproj @@ -0,0 +1,23 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Plugins.ProductTag + + + + + + + + + + + + + + + + diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.TestBase/ProductTagDataSeedContributor.cs b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.TestBase/ProductTagDataSeedContributor.cs new file mode 100644 index 00000000..5ee6714a --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.TestBase/ProductTagDataSeedContributor.cs @@ -0,0 +1,27 @@ +using System.Threading.Tasks; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Guids; + +namespace EasyAbp.EShop.Plugins.ProductTag +{ + public class ProductTagDataSeedContributor : IDataSeedContributor, ITransientDependency + { + private readonly IGuidGenerator _guidGenerator; + + public ProductTagDataSeedContributor( + IGuidGenerator guidGenerator) + { + _guidGenerator = guidGenerator; + } + + public Task SeedAsync(DataSeedContext context) + { + /* Instead of returning the Task.CompletedTask, you can insert your test data + * at this point! + */ + + return Task.CompletedTask; + } + } +} \ No newline at end of file diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.TestBase/ProductTagTestBase.cs b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.TestBase/ProductTagTestBase.cs new file mode 100644 index 00000000..ffc27da7 --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.TestBase/ProductTagTestBase.cs @@ -0,0 +1,60 @@ +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; +using Volo.Abp.Modularity; +using Volo.Abp.Uow; +using Volo.Abp.Testing; + +namespace EasyAbp.EShop.Plugins.ProductTag +{ + /* All test classes are derived from this class, directly or indirectly. */ + public abstract class ProductTagTestBase : AbpIntegratedTest + where TStartupModule : IAbpModule + { + protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options) + { + options.UseAutofac(); + } + + protected virtual Task WithUnitOfWorkAsync(Func func) + { + return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); + } + + protected virtual async Task WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, Func action) + { + using (var scope = ServiceProvider.CreateScope()) + { + var uowManager = scope.ServiceProvider.GetRequiredService(); + + using (var uow = uowManager.Begin(options)) + { + await action(); + + await uow.CompleteAsync(); + } + } + } + + protected virtual Task WithUnitOfWorkAsync(Func> func) + { + return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); + } + + protected virtual async Task WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, Func> func) + { + using (var scope = ServiceProvider.CreateScope()) + { + var uowManager = scope.ServiceProvider.GetRequiredService(); + + using (var uow = uowManager.Begin(options)) + { + var result = await func(); + await uow.CompleteAsync(); + return result; + } + } + } + } +} diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.TestBase/ProductTagTestBaseModule.cs b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.TestBase/ProductTagTestBaseModule.cs new file mode 100644 index 00000000..f7c7e7a6 --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.TestBase/ProductTagTestBaseModule.cs @@ -0,0 +1,42 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; +using Volo.Abp.Authorization; +using Volo.Abp.Autofac; +using Volo.Abp.Data; +using Volo.Abp.Modularity; +using Volo.Abp.Threading; + +namespace EasyAbp.EShop.Plugins.ProductTag +{ + [DependsOn( + typeof(AbpAutofacModule), + typeof(AbpTestBaseModule), + typeof(AbpAuthorizationModule), + typeof(ProductTagDomainModule) + )] + public class ProductTagTestBaseModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddAlwaysAllowAuthorization(); + } + + public override void OnApplicationInitialization(ApplicationInitializationContext context) + { + SeedTestData(context); + } + + private static void SeedTestData(ApplicationInitializationContext context) + { + AsyncHelper.RunSync(async () => + { + using (var scope = context.ServiceProvider.CreateScope()) + { + await scope.ServiceProvider + .GetRequiredService() + .SeedAsync(); + } + }); + } + } +} diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.TestBase/Samples/SampleRepository_Tests.cs b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.TestBase/Samples/SampleRepository_Tests.cs new file mode 100644 index 00000000..f2eeae67 --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.TestBase/Samples/SampleRepository_Tests.cs @@ -0,0 +1,27 @@ +using System.Threading.Tasks; +using Volo.Abp.Modularity; +using Xunit; + +namespace EasyAbp.EShop.Plugins.ProductTag.Samples +{ + /* Write your custom repository tests like that, in this project, as abstract classes. + * Then inherit these abstract classes from EF Core & MongoDB test projects. + * In this way, both database providers are tests with the same set tests. + */ + public abstract class SampleRepository_Tests : ProductTagTestBase + where TStartupModule : IAbpModule + { + //private readonly ISampleRepository _sampleRepository; + + protected SampleRepository_Tests() + { + //_sampleRepository = GetRequiredService(); + } + + [Fact] + public async Task Method1Async() + { + + } + } +} diff --git a/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.TestBase/Security/FakeCurrentPrincipalAccessor.cs b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.TestBase/Security/FakeCurrentPrincipalAccessor.cs new file mode 100644 index 00000000..25bd2a26 --- /dev/null +++ b/plugins/ProductTag/test/EasyAbp.EShop.Plugins.ProductTag.TestBase/Security/FakeCurrentPrincipalAccessor.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; +using System.Security.Claims; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Security.Claims; + +namespace EasyAbp.EShop.Plugins.ProductTag.Security +{ + [Dependency(ReplaceServices = true)] + public class FakeCurrentPrincipalAccessor : ThreadCurrentPrincipalAccessor + { + protected override ClaimsPrincipal GetClaimsPrincipal() + { + return GetPrincipal(); + } + + private ClaimsPrincipal _principal; + + private ClaimsPrincipal GetPrincipal() + { + if (_principal == null) + { + lock (this) + { + if (_principal == null) + { + _principal = new ClaimsPrincipal( + new ClaimsIdentity( + new List + { + new Claim(AbpClaimTypes.UserId,"2e701e62-0953-4dd3-910b-dc6cc93ccb0d"), + new Claim(AbpClaimTypes.UserName,"admin"), + new Claim(AbpClaimTypes.Email,"admin@abp.io") + } + ) + ); + } + } + } + + return _principal; + } + } +} diff --git a/plugins/StoreApproval/.gitattributes b/plugins/StoreApproval/.gitattributes new file mode 100644 index 00000000..c941e526 --- /dev/null +++ b/plugins/StoreApproval/.gitattributes @@ -0,0 +1 @@ +**/wwwroot/libs/** linguist-vendored diff --git a/plugins/StoreApproval/.gitignore b/plugins/StoreApproval/.gitignore new file mode 100644 index 00000000..8a6cac80 --- /dev/null +++ b/plugins/StoreApproval/.gitignore @@ -0,0 +1,258 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# StoreApproval +host/EasyAbp.EShop.Plugins.StoreApproval.IdentityServer/Logs/logs.txt +host/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Host/Logs/logs.txt +host/EasyAbp.EShop.Plugins.StoreApproval.Web.Host/Logs/logs.txt +host/EasyAbp.EShop.Plugins.StoreApproval.Web.Unified/Logs/logs.txt diff --git a/plugins/StoreApproval/EasyAbp.EShop.Plugins.StoreApproval.sln b/plugins/StoreApproval/EasyAbp.EShop.Plugins.StoreApproval.sln new file mode 100644 index 00000000..7de6603e --- /dev/null +++ b/plugins/StoreApproval/EasyAbp.EShop.Plugins.StoreApproval.sln @@ -0,0 +1,144 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared", "src\EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared\EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared.csproj", "{D64C1577-4929-4B60-939E-96DE1534891A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.StoreApproval.Domain", "src\EasyAbp.EShop.Plugins.StoreApproval.Domain\EasyAbp.EShop.Plugins.StoreApproval.Domain.csproj", "{F2840BC7-0188-4606-9126-DADD0F5ABF7A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts", "src\EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts\EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts.csproj", "{BD65D04F-08D5-40C1-8C24-77CA0BACB877}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.StoreApproval.Application", "src\EasyAbp.EShop.Plugins.StoreApproval.Application\EasyAbp.EShop.Plugins.StoreApproval.Application.csproj", "{78040F9E-3501-4A40-82DF-00A597710F35}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{649A3FFA-182F-4E56-9717-E6A9A2BEC545}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "host", "host", "{E400416D-2895-4512-9D17-90681EEC7E0A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore", "src\EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore\EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.csproj", "{0CE86223-D31D-4315-A1F5-87BA3EE1B844}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.StoreApproval.MongoDB", "src\EasyAbp.EShop.Plugins.StoreApproval.MongoDB\EasyAbp.EShop.Plugins.StoreApproval.MongoDB.csproj", "{F1C58097-4C08-4D88-8976-6B3389391481}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.StoreApproval.HttpApi", "src\EasyAbp.EShop.Plugins.StoreApproval.HttpApi\EasyAbp.EShop.Plugins.StoreApproval.HttpApi.csproj", "{077AA5F8-8B61-420C-A6B5-0150A66FDB34}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client", "src\EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client\EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.csproj", "{36E2735F-CEAB-44C8-A6D1-2CDAFF399751}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.StoreApproval.TestBase", "test\EasyAbp.EShop.Plugins.StoreApproval.TestBase\EasyAbp.EShop.Plugins.StoreApproval.TestBase.csproj", "{C5BB573D-3030-4BCB-88B7-F6A85C32766C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests", "test\EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests\EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests.csproj", "{527F645C-C1FC-406E-8479-81386C8ECF13}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests", "test\EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests\EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests.csproj", "{D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests", "test\EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests\EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests.csproj", "{E60895E5-79C4-447D-88B7-85CB5BA336A4}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.StoreApproval.Application.Tests", "test\EasyAbp.EShop.Plugins.StoreApproval.Application.Tests\EasyAbp.EShop.Plugins.StoreApproval.Application.Tests.csproj", "{90CB5DC4-C040-45C7-8900-9688B26405BC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.StoreApproval.Web", "src\EasyAbp.EShop.Plugins.StoreApproval.Web\EasyAbp.EShop.Plugins.StoreApproval.Web.csproj", "{3B7B6317-1B85-4164-8E11-75574F80AE17}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp", "test\EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp\EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp.csproj", "{1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Plugins.StoreApproval.Host.Shared", "host\EasyAbp.EShop.Plugins.StoreApproval.Host.Shared\EasyAbp.EShop.Plugins.StoreApproval.Host.Shared.csproj", "{F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{654F3755-D4A8-4C3A-9BB6-339D757EBC20}" + ProjectSection(SolutionItems) = preProject + common.props = common.props + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D64C1577-4929-4B60-939E-96DE1534891A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D64C1577-4929-4B60-939E-96DE1534891A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D64C1577-4929-4B60-939E-96DE1534891A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D64C1577-4929-4B60-939E-96DE1534891A}.Release|Any CPU.Build.0 = Release|Any CPU + {F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Release|Any CPU.Build.0 = Release|Any CPU + {BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Release|Any CPU.Build.0 = Release|Any CPU + {78040F9E-3501-4A40-82DF-00A597710F35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {78040F9E-3501-4A40-82DF-00A597710F35}.Debug|Any CPU.Build.0 = Debug|Any CPU + {78040F9E-3501-4A40-82DF-00A597710F35}.Release|Any CPU.ActiveCfg = Release|Any CPU + {78040F9E-3501-4A40-82DF-00A597710F35}.Release|Any CPU.Build.0 = Release|Any CPU + {0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Release|Any CPU.Build.0 = Release|Any CPU + {F1C58097-4C08-4D88-8976-6B3389391481}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F1C58097-4C08-4D88-8976-6B3389391481}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F1C58097-4C08-4D88-8976-6B3389391481}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F1C58097-4C08-4D88-8976-6B3389391481}.Release|Any CPU.Build.0 = Release|Any CPU + {077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Debug|Any CPU.Build.0 = Debug|Any CPU + {077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Release|Any CPU.ActiveCfg = Release|Any CPU + {077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Release|Any CPU.Build.0 = Release|Any CPU + {36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Debug|Any CPU.Build.0 = Debug|Any CPU + {36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Release|Any CPU.ActiveCfg = Release|Any CPU + {36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Release|Any CPU.Build.0 = Release|Any CPU + {C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Release|Any CPU.Build.0 = Release|Any CPU + {527F645C-C1FC-406E-8479-81386C8ECF13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {527F645C-C1FC-406E-8479-81386C8ECF13}.Debug|Any CPU.Build.0 = Debug|Any CPU + {527F645C-C1FC-406E-8479-81386C8ECF13}.Release|Any CPU.ActiveCfg = Release|Any CPU + {527F645C-C1FC-406E-8479-81386C8ECF13}.Release|Any CPU.Build.0 = Release|Any CPU + {D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}.Release|Any CPU.Build.0 = Release|Any CPU + {E60895E5-79C4-447D-88B7-85CB5BA336A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E60895E5-79C4-447D-88B7-85CB5BA336A4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E60895E5-79C4-447D-88B7-85CB5BA336A4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E60895E5-79C4-447D-88B7-85CB5BA336A4}.Release|Any CPU.Build.0 = Release|Any CPU + {90CB5DC4-C040-45C7-8900-9688B26405BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {90CB5DC4-C040-45C7-8900-9688B26405BC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {90CB5DC4-C040-45C7-8900-9688B26405BC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {90CB5DC4-C040-45C7-8900-9688B26405BC}.Release|Any CPU.Build.0 = Release|Any CPU + {3B7B6317-1B85-4164-8E11-75574F80AE17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3B7B6317-1B85-4164-8E11-75574F80AE17}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3B7B6317-1B85-4164-8E11-75574F80AE17}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3B7B6317-1B85-4164-8E11-75574F80AE17}.Release|Any CPU.Build.0 = Release|Any CPU + {1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Release|Any CPU.Build.0 = Release|Any CPU + {F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {D64C1577-4929-4B60-939E-96DE1534891A} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {F2840BC7-0188-4606-9126-DADD0F5ABF7A} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {BD65D04F-08D5-40C1-8C24-77CA0BACB877} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {78040F9E-3501-4A40-82DF-00A597710F35} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {0CE86223-D31D-4315-A1F5-87BA3EE1B844} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {F1C58097-4C08-4D88-8976-6B3389391481} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {077AA5F8-8B61-420C-A6B5-0150A66FDB34} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {36E2735F-CEAB-44C8-A6D1-2CDAFF399751} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {C5BB573D-3030-4BCB-88B7-F6A85C32766C} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {527F645C-C1FC-406E-8479-81386C8ECF13} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {E60895E5-79C4-447D-88B7-85CB5BA336A4} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {90CB5DC4-C040-45C7-8900-9688B26405BC} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {3B7B6317-1B85-4164-8E11-75574F80AE17} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB} = {E400416D-2895-4512-9D17-90681EEC7E0A} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4324B3B4-B60B-4E3C-91D8-59576B4E26DD} + EndGlobalSection +EndGlobal diff --git a/plugins/StoreApproval/EasyAbp.EShop.Plugins.StoreApproval.sln.DotSettings b/plugins/StoreApproval/EasyAbp.EShop.Plugins.StoreApproval.sln.DotSettings new file mode 100644 index 00000000..8572f56c --- /dev/null +++ b/plugins/StoreApproval/EasyAbp.EShop.Plugins.StoreApproval.sln.DotSettings @@ -0,0 +1,25 @@ + + True + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + Required + Required + Required + Required + False + True + False + False + True + False + False + SQL + True + True + \ No newline at end of file diff --git a/plugins/StoreApproval/common.props b/plugins/StoreApproval/common.props new file mode 100644 index 00000000..d9519ad8 --- /dev/null +++ b/plugins/StoreApproval/common.props @@ -0,0 +1,30 @@ + + + latest + 0.1.0 + $(NoWarn);CS1591 + module + true + EasyAbp Team + An abp application module group that provides basic e-shop service. + https://avatars3.githubusercontent.com/u/58311641?s=128 + https://github.com/EasyAbp/EShop + https://github.com/EasyAbp/EShop + abp module easyabp EShop shopping shop ordering product payment store mall + EasyAbp + MIT + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers + + + + \ No newline at end of file diff --git a/plugins/StoreApproval/docker-compose.migrations.yml b/plugins/StoreApproval/docker-compose.migrations.yml new file mode 100644 index 00000000..c753f66f --- /dev/null +++ b/plugins/StoreApproval/docker-compose.migrations.yml @@ -0,0 +1,13 @@ +version: '3.4' + +services: + migrations: + build: + context: ../../ + dockerfile: templates/service/database/Dockerfile + depends_on: + - sqlserver + environment: + - IdentityServer_DB=StoreApproval_Identity + - StoreApproval_DB=StoreApproval_ModuleDb + - SA_PASSWORD=yourStrong(!)Password diff --git a/plugins/StoreApproval/docker-compose.override.yml b/plugins/StoreApproval/docker-compose.override.yml new file mode 100644 index 00000000..a9c8aece --- /dev/null +++ b/plugins/StoreApproval/docker-compose.override.yml @@ -0,0 +1,29 @@ +version: '3.4' + +services: + sqlserver: + environment: + - SA_PASSWORD=yourStrong(!)Password + - ACCEPT_EULA=Y + ports: + - "51599:1433" + + identity-server: + environment: + - ASPNETCORE_URLS=http://0.0.0.0:80 + - ConnectionStrings__Default=Server=sqlserver;Database=StoreApproval_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - ConnectionStrings__SqlServerCache=Server=sqlserver;Database=StoreApproval_Cache;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + ports: + - "51600:80" + + store-approval: + environment: + - ASPNETCORE_URLS=http://0.0.0.0:80 + - ConnectionStrings__Default=Server=sqlserver;Database=StoreApproval_ModuleDb;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - ConnectionStrings__AbpSettingManagement=Server=sqlserver;Database=StoreApproval_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - ConnectionStrings__AbpPermissionManagement=Server=sqlserver;Database=StoreApproval_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - ConnectionStrings__AbpAuditLogging=Server=sqlserver;Database=StoreApproval_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - ConnectionStrings__SqlServerCache=Server=sqlserver;Database=StoreApproval_Cache;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - AuthServer__Authority=http://identity-server + ports: + - "51601:80" \ No newline at end of file diff --git a/plugins/StoreApproval/docker-compose.yml b/plugins/StoreApproval/docker-compose.yml new file mode 100644 index 00000000..f327a3e6 --- /dev/null +++ b/plugins/StoreApproval/docker-compose.yml @@ -0,0 +1,25 @@ +version: '3.4' + +services: + sqlserver: + image: mcr.microsoft.com/mssql/server + volumes: + - dbdata:/var/opt/mssql + + identity-server: + build: + context: ../../ + dockerfile: templates/service/host/IdentityServerHost/Dockerfile + depends_on: + - sqlserver + + store-approval: + build: + context: ../../ + dockerfile: templates/service/host/EasyAbp.EShop.Plugins.StoreApproval.Host/Dockerfile + depends_on: + - sqlserver + - identity-server + +volumes: + dbdata: \ No newline at end of file diff --git a/plugins/StoreApproval/host/EasyAbp.EShop.Plugins.StoreApproval.Host.Shared/EasyAbp.EShop.Plugins.StoreApproval.Host.Shared.csproj b/plugins/StoreApproval/host/EasyAbp.EShop.Plugins.StoreApproval.Host.Shared/EasyAbp.EShop.Plugins.StoreApproval.Host.Shared.csproj new file mode 100644 index 00000000..79121eff --- /dev/null +++ b/plugins/StoreApproval/host/EasyAbp.EShop.Plugins.StoreApproval.Host.Shared/EasyAbp.EShop.Plugins.StoreApproval.Host.Shared.csproj @@ -0,0 +1,10 @@ + + + + + + netstandard2.0 + EasyAbp.EShop.Plugins.StoreApproval + + + diff --git a/plugins/StoreApproval/host/EasyAbp.EShop.Plugins.StoreApproval.Host.Shared/FodyWeavers.xml b/plugins/StoreApproval/host/EasyAbp.EShop.Plugins.StoreApproval.Host.Shared/FodyWeavers.xml new file mode 100644 index 00000000..be0de3a9 --- /dev/null +++ b/plugins/StoreApproval/host/EasyAbp.EShop.Plugins.StoreApproval.Host.Shared/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/StoreApproval/host/EasyAbp.EShop.Plugins.StoreApproval.Host.Shared/FodyWeavers.xsd b/plugins/StoreApproval/host/EasyAbp.EShop.Plugins.StoreApproval.Host.Shared/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/StoreApproval/host/EasyAbp.EShop.Plugins.StoreApproval.Host.Shared/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/StoreApproval/host/EasyAbp.EShop.Plugins.StoreApproval.Host.Shared/MultiTenancy/MultiTenancyConsts.cs b/plugins/StoreApproval/host/EasyAbp.EShop.Plugins.StoreApproval.Host.Shared/MultiTenancy/MultiTenancyConsts.cs new file mode 100644 index 00000000..2afcefc5 --- /dev/null +++ b/plugins/StoreApproval/host/EasyAbp.EShop.Plugins.StoreApproval.Host.Shared/MultiTenancy/MultiTenancyConsts.cs @@ -0,0 +1,10 @@ +namespace EasyAbp.EShop.Plugins.StoreApproval.MultiTenancy +{ + public static class MultiTenancyConsts + { + /* Enable/disable multi-tenancy in a single point + * to test your module with multi-tenancy. + */ + public const bool IsEnabled = false; + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts.csproj b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts.csproj new file mode 100644 index 00000000..bca008da --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts.csproj @@ -0,0 +1,16 @@ + + + + + + netstandard2.0 + EasyAbp.EShop.Plugins.StoreApproval + + + + + + + + + diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/FodyWeavers.xml b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/FodyWeavers.xml new file mode 100644 index 00000000..bd6def33 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/FodyWeavers.xsd b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/Permissions/StoreApprovalPermissionDefinitionProvider.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/Permissions/StoreApprovalPermissionDefinitionProvider.cs new file mode 100644 index 00000000..944dbb18 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/Permissions/StoreApprovalPermissionDefinitionProvider.cs @@ -0,0 +1,25 @@ +using EasyAbp.EShop.Plugins.StoreApproval.Localization; +using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Localization; + +namespace EasyAbp.EShop.Plugins.StoreApproval.Permissions +{ + public class StoreApprovalPermissionDefinitionProvider : PermissionDefinitionProvider + { + public override void Define(IPermissionDefinitionContext context) + { + var myGroup = context.AddGroup(StoreApprovalPermissions.GroupName, L("Permission:StoreApproval")); + + var storeApplicationPermission = myGroup.AddPermission(StoreApprovalPermissions.StoreApplication.Default, L("Permission:StoreApplication")); + storeApplicationPermission.AddChild(StoreApprovalPermissions.StoreApplication.Create, L("Permission:Create")); + storeApplicationPermission.AddChild(StoreApprovalPermissions.StoreApplication.Update, L("Permission:Update")); + storeApplicationPermission.AddChild(StoreApprovalPermissions.StoreApplication.Delete, L("Permission:Delete")); + storeApplicationPermission.AddChild(StoreApprovalPermissions.StoreApplication.Approval, L("Permission:Approval")); + } + + private static LocalizableString L(string name) + { + return LocalizableString.Create(name); + } + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/Permissions/StoreApprovalPermissions.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/Permissions/StoreApprovalPermissions.cs new file mode 100644 index 00000000..c526c6da --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/Permissions/StoreApprovalPermissions.cs @@ -0,0 +1,23 @@ +using Volo.Abp.Reflection; + +namespace EasyAbp.EShop.Plugins.StoreApproval.Permissions +{ + public class StoreApprovalPermissions + { + public const string GroupName = "StoreApproval"; + + public static string[] GetAll() + { + return ReflectionHelper.GetPublicConstantsRecursively(typeof(StoreApprovalPermissions)); + } + + public class StoreApplication + { + public const string Default = GroupName + ".StoreApplication"; + public const string Update = Default + ".Update"; + public const string Create = Default + ".Create"; + public const string Delete = Default + ".Delete"; + public const string Approval = Default + ".Approval"; + } + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/StoreApplications/Dtos/CreateUpdateStoreApplicationDto.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/StoreApplications/Dtos/CreateUpdateStoreApplicationDto.cs new file mode 100644 index 00000000..bbad0b85 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/StoreApplications/Dtos/CreateUpdateStoreApplicationDto.cs @@ -0,0 +1,64 @@ +using System; +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; + +namespace EasyAbp.EShop.Plugins.StoreApproval.StoreApplications.Dtos +{ + [Serializable] + public class CreateStoreApplicationDto : UpdateStoreApplicationDto + { + [Required] + public Guid ApplicantId { get; set; } + } + + [Serializable] + public class UpdateStoreApplicationDto + { + [Required] + [DynamicMaxLength(typeof(StoreApplicationConsts), nameof(StoreApplicationConsts.MaxNameLength))] + public string StoreName { get; set; } + + [Required] + [DynamicMaxLength(typeof(StoreApplicationConsts), nameof(StoreApplicationConsts.MaxNameLength))] + public string BusinessCategory { get; set; } + + [Required] + [DynamicMaxLength(typeof(StoreApplicationConsts), nameof(StoreApplicationConsts.MaxAddressLength))] + public string Address { get; set; } + + [Required] + [DynamicMaxLength(typeof(StoreApplicationConsts), nameof(StoreApplicationConsts.MaxNameLength))] + public string UnifiedCreditCode { get; set; } + + [DynamicMaxLength(typeof(StoreApplicationConsts), nameof(StoreApplicationConsts.MaxNameLength))] + public string HouseNumber { get; set; } + + [Required] + [DynamicMaxLength(typeof(StoreApplicationConsts), nameof(StoreApplicationConsts.MaxImageResourcesLength))] + public string BusinessLicenseImage { get; set; } + + [Required] + [DynamicMaxLength(typeof(StoreApplicationConsts), nameof(StoreApplicationConsts.MaxNameLength))] + public string Name { get; set; } + + [Required] + [DynamicMaxLength(typeof(StoreApplicationConsts), nameof(StoreApplicationConsts.MaxNameLength))] + public string IdNumber { get; set; } + + [Required] + [DynamicMaxLength(typeof(StoreApplicationConsts), nameof(StoreApplicationConsts.MaxImageResourcesLength))] + public string IdCardFrontImage { get; set; } + + [Required] + [DynamicMaxLength(typeof(StoreApplicationConsts), nameof(StoreApplicationConsts.MaxImageResourcesLength))] + public string IdCardBackImage { get; set; } + + [Required] + [DynamicMaxLength(typeof(StoreApplicationConsts), nameof(StoreApplicationConsts.MaxImageResourcesLength))] + public string StoreImage { get; set; } + + [DynamicMaxLength(typeof(StoreApplicationConsts), nameof(StoreApplicationConsts.MaxNoteLength))] + public string Note { get; set; } + } + +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/StoreApplications/Dtos/GetStoreApplicationListDto.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/StoreApplications/Dtos/GetStoreApplicationListDto.cs new file mode 100644 index 00000000..8d89b5d6 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/StoreApplications/Dtos/GetStoreApplicationListDto.cs @@ -0,0 +1,20 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace EasyAbp.EShop.Plugins.StoreApproval.StoreApplications.Dtos +{ + public class GetStoreApplicationListDto : PagedAndSortedResultRequestDto + { + public Guid? ApplicantId { get; set; } + + public string StoreName { get; set; } + + public string BusinessCategory { get; protected set; } + + public string UnifiedCreditCode { get; protected set; } + + public string Name { get; protected set; } + + public string IdNumber { get; protected set; } + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/StoreApplications/Dtos/StoreApplicationDto.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/StoreApplications/Dtos/StoreApplicationDto.cs new file mode 100644 index 00000000..add16dab --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/StoreApplications/Dtos/StoreApplicationDto.cs @@ -0,0 +1,37 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace EasyAbp.EShop.Plugins.StoreApproval.StoreApplications.Dtos +{ + [Serializable] + public class StoreApplicationDto : FullAuditedEntityDto + { + public Guid ApplicantId { get; set; } + + public ApprovalStatusType ApprovalStatus { get; set; } + + public string StoreName { get; set; } + + public string BusinessCategory { get; set; } + + public string Address { get; set; } + + public string UnifiedCreditCode { get; set; } + + public string HouseNumber { get; set; } + + public string BusinessLicenseImage { get; set; } + + public string Name { get; set; } + + public string IdNumber { get; set; } + + public string IdCardFrontImage { get; set; } + + public string IdCardBackImage { get; set; } + + public string StoreImage { get; set; } + + public string Note { get; set; } + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/StoreApplications/IStoreApplicationAppService.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/StoreApplications/IStoreApplicationAppService.cs new file mode 100644 index 00000000..08d8b37d --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/StoreApplications/IStoreApplicationAppService.cs @@ -0,0 +1,22 @@ +using EasyAbp.EShop.Plugins.StoreApproval.StoreApplications.Dtos; +using System; +using System.Threading.Tasks; +using Volo.Abp.Application.Services; + +namespace EasyAbp.EShop.Plugins.StoreApproval.StoreApplications +{ + public interface IStoreApplicationAppService : + ICrudAppService< + StoreApplicationDto, + Guid, + GetStoreApplicationListDto, + CreateStoreApplicationDto, + UpdateStoreApplicationDto> + { + Task SubmitAsync(Guid id); + + Task ApproveAsync(Guid id); + + Task RejectAsync(Guid id); + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/StoreApprovalApplicationContractsModule.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/StoreApprovalApplicationContractsModule.cs new file mode 100644 index 00000000..d41877b2 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application.Contracts/StoreApprovalApplicationContractsModule.cs @@ -0,0 +1,16 @@ +using Volo.Abp.Application; +using Volo.Abp.Modularity; +using Volo.Abp.Authorization; + +namespace EasyAbp.EShop.Plugins.StoreApproval +{ + [DependsOn( + typeof(StoreApprovalDomainSharedModule), + typeof(AbpDddApplicationContractsModule), + typeof(AbpAuthorizationModule) + )] + public class StoreApprovalApplicationContractsModule : AbpModule + { + + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application/EasyAbp.EShop.Plugins.StoreApproval.Application.csproj b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application/EasyAbp.EShop.Plugins.StoreApproval.Application.csproj new file mode 100644 index 00000000..8903c456 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application/EasyAbp.EShop.Plugins.StoreApproval.Application.csproj @@ -0,0 +1,17 @@ + + + + + + netstandard2.0 + EasyAbp.EShop.Plugins.StoreApproval + + + + + + + + + + diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application/FodyWeavers.xml b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application/FodyWeavers.xml new file mode 100644 index 00000000..be0de3a9 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application/FodyWeavers.xsd b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application/StoreApplications/StoreApplicationAppService.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application/StoreApplications/StoreApplicationAppService.cs new file mode 100644 index 00000000..234be2aa --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application/StoreApplications/StoreApplicationAppService.cs @@ -0,0 +1,118 @@ +using EasyAbp.EShop.Plugins.StoreApproval.Permissions; +using EasyAbp.EShop.Plugins.StoreApproval.StoreApplications.Dtos; +using System; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Identity; + +namespace EasyAbp.EShop.Plugins.StoreApproval.StoreApplications +{ + public class StoreApplicationAppService : CrudAppService, + IStoreApplicationAppService + { + protected IdentityUserManager UserManager; + protected override string GetPolicyName { get; set; } = StoreApprovalPermissions.StoreApplication.Default; + protected override string GetListPolicyName { get; set; } = StoreApprovalPermissions.StoreApplication.Default; + protected override string CreatePolicyName { get; set; } = StoreApprovalPermissions.StoreApplication.Create; + protected override string UpdatePolicyName { get; set; } = StoreApprovalPermissions.StoreApplication.Update; + protected override string DeletePolicyName { get; set; } = StoreApprovalPermissions.StoreApplication.Delete; + protected virtual string ApprovalPolicyName { get; set; } = StoreApprovalPermissions.StoreApplication.Approval; + + public StoreApplicationAppService(IRepository repository, + IdentityUserManager userManager) : base(repository) + { + UserManager = userManager; + } + + protected override IQueryable CreateFilteredQuery(GetStoreApplicationListDto input) + { + var queryable = base.CreateFilteredQuery(input); + + if (input.ApplicantId.HasValue) + { + queryable = queryable.Where(x => x.ApplicantId == input.ApplicantId.Value); + } + + if (!input.Name.IsNullOrWhiteSpace()) + { + queryable = queryable.Where(x => x.Name == input.Name); + } + + if (!input.StoreName.IsNullOrWhiteSpace()) + { + queryable = queryable.Where(x => x.StoreName == input.StoreName); + } + + if (!input.BusinessCategory.IsNullOrWhiteSpace()) + { + queryable = queryable.Where(x => x.BusinessCategory == input.BusinessCategory); + } + + if (!input.IdNumber.IsNullOrWhiteSpace()) + { + queryable = queryable.Where(x => x.IdNumber == input.IdNumber); + } + + if (!input.UnifiedCreditCode.IsNullOrWhiteSpace()) + { + queryable = queryable.Where(x => x.UnifiedCreditCode == input.UnifiedCreditCode); + } + + return queryable; + } + + public override async Task CreateAsync(CreateStoreApplicationDto input) + { + await CheckCreatePolicyAsync(); + + var user = await UserManager.GetByIdAsync(input.ApplicantId); + + var entity = MapToEntity(input); + + TryToSetTenantId(entity); + + await Repository.InsertAsync(entity, autoSave: true); + + return MapToGetOutputDto(entity); + } + + public async Task SubmitAsync(Guid id) + { + await CheckCreatePolicyAsync(); + + var entity = await GetEntityByIdAsync(id); + entity.Submit(); + + await Repository.UpdateAsync(entity); + + return ObjectMapper.Map(entity); + } + + public async Task ApproveAsync(Guid id) + { + await CheckPolicyAsync(ApprovalPolicyName); + + var entity = await GetEntityByIdAsync(id); + entity.Approve(); + + await Repository.UpdateAsync(entity); + + return ObjectMapper.Map(entity); + } + + public async Task RejectAsync(Guid id) + { + await CheckPolicyAsync(ApprovalPolicyName); + + var entity = await GetEntityByIdAsync(id); + entity.Reject(); + + await Repository.UpdateAsync(entity); + + return ObjectMapper.Map(entity); + } + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application/StoreApprovalAppService.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application/StoreApprovalAppService.cs new file mode 100644 index 00000000..cc5eb9b7 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application/StoreApprovalAppService.cs @@ -0,0 +1,14 @@ +using EasyAbp.EShop.Plugins.StoreApproval.Localization; +using Volo.Abp.Application.Services; + +namespace EasyAbp.EShop.Plugins.StoreApproval +{ + public abstract class StoreApprovalAppService : ApplicationService + { + protected StoreApprovalAppService() + { + LocalizationResource = typeof(StoreApprovalResource); + ObjectMapperContext = typeof(StoreApprovalApplicationModule); + } + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application/StoreApprovalApplicationAutoMapperProfile.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application/StoreApprovalApplicationAutoMapperProfile.cs new file mode 100644 index 00000000..a1f6cab9 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application/StoreApprovalApplicationAutoMapperProfile.cs @@ -0,0 +1,19 @@ +using EasyAbp.EShop.Plugins.StoreApproval.StoreApplications; +using EasyAbp.EShop.Plugins.StoreApproval.StoreApplications.Dtos; +using AutoMapper; + +namespace EasyAbp.EShop.Plugins.StoreApproval +{ + public class StoreApprovalApplicationAutoMapperProfile : Profile + { + public StoreApprovalApplicationAutoMapperProfile() + { + /* You can configure your AutoMapper mapping configuration here. + * Alternatively, you can split your mapping configurations + * into multiple profile classes for a better organization. */ + CreateMap(); + CreateMap(MemberList.Source); + CreateMap(MemberList.Source); + } + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application/StoreApprovalApplicationModule.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application/StoreApprovalApplicationModule.cs new file mode 100644 index 00000000..d1bb4c05 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Application/StoreApprovalApplicationModule.cs @@ -0,0 +1,25 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.AutoMapper; +using Volo.Abp.Modularity; +using Volo.Abp.Application; + +namespace EasyAbp.EShop.Plugins.StoreApproval +{ + [DependsOn( + typeof(StoreApprovalDomainModule), + typeof(StoreApprovalApplicationContractsModule), + typeof(AbpDddApplicationModule), + typeof(AbpAutoMapperModule) + )] + public class StoreApprovalApplicationModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddAutoMapperObjectMapper(); + Configure(options => + { + options.AddMaps(validate: true); + }); + } + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared.csproj b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared.csproj new file mode 100644 index 00000000..d478ff43 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared.csproj @@ -0,0 +1,24 @@ + + + + + + netstandard2.0 + EasyAbp.EShop.Plugins.StoreApproval + true + + + + + + + + + + + + + + + + diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/FodyWeavers.xml b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/FodyWeavers.xml new file mode 100644 index 00000000..be0de3a9 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/FodyWeavers.xsd b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/cs.json b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/cs.json new file mode 100644 index 00000000..c6271538 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/cs.json @@ -0,0 +1,31 @@ +{ + "culture": "cs", + "texts": { + "ManageYourProfile": "Spravovat profil", + "Permission:StoreApplication": "StoreApplication", + "Permission:Create": "Create", + "Permission:Update": "Update", + "Permission:Delete": "Delete", + "Permission:Approval": "Approval", + "Menu:StoreApplication": "MenuStoreApplication", + "StoreApplication": "StoreApplication", + "StoreApplicationApplicantId": "StoreApplicationApplicantId", + "StoreApplicationApprovalStatus": "StoreApplicationApprovalStatus", + "StoreApplicationStoreName": "StoreApplicationStoreName", + "StoreApplicationBusinessCategory": "StoreApplicationBusinessCategory", + "StoreApplicationAddress": "StoreApplicationAddress", + "StoreApplicationUnifiedCreditCode": "StoreApplicationUnifiedCreditCode", + "StoreApplicationHouseNumber": "StoreApplicationHouseNumber", + "StoreApplicationBusinessLicenseImage": "StoreApplicationBusinessLicenseImage", + "StoreApplicationName": "StoreApplicationName", + "StoreApplicationIdNumber": "StoreApplicationIdNumber", + "StoreApplicationIdCardFrontImage": "StoreApplicationIdCardFrontImage", + "StoreApplicationIdCardBackImage": "StoreApplicationIdCardBackImage", + "StoreApplicationStoreImage": "StoreApplicationStoreImage", + "StoreApplicationNote": "StoreApplicationNote", + "CreateStoreApplication": "CreateStoreApplication", + "EditStoreApplication": "EditStoreApplication", + "StoreApplicationDeletionConfirmationMessage": "Are you sure to delete the storeApplication {0}?", + "SuccessfullyDeleted": "Successfully deleted" + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/en.json b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/en.json new file mode 100644 index 00000000..8d4fc4b6 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/en.json @@ -0,0 +1,32 @@ +{ + "culture": "en", + "texts": { + "ManageYourProfile": "Manage your profile", + "SamplePageMessage": "A sample page for the StoreApproval module", + "Permission:StoreApplication": "StoreApplication", + "Permission:Create": "Create", + "Permission:Update": "Update", + "Permission:Delete": "Delete", + "Permission:Approval": "Approval", + "Menu:StoreApplication": "MenuStoreApplication", + "StoreApplication": "StoreApplication", + "StoreApplicationApplicantId": "StoreApplicationApplicantId", + "StoreApplicationApprovalStatus": "StoreApplicationApprovalStatus", + "StoreApplicationStoreName": "StoreApplicationStoreName", + "StoreApplicationBusinessCategory": "StoreApplicationBusinessCategory", + "StoreApplicationAddress": "StoreApplicationAddress", + "StoreApplicationUnifiedCreditCode": "StoreApplicationUnifiedCreditCode", + "StoreApplicationHouseNumber": "StoreApplicationHouseNumber", + "StoreApplicationBusinessLicenseImage": "StoreApplicationBusinessLicenseImage", + "StoreApplicationName": "StoreApplicationName", + "StoreApplicationIdNumber": "StoreApplicationIdNumber", + "StoreApplicationIdCardFrontImage": "StoreApplicationIdCardFrontImage", + "StoreApplicationIdCardBackImage": "StoreApplicationIdCardBackImage", + "StoreApplicationStoreImage": "StoreApplicationStoreImage", + "StoreApplicationNote": "StoreApplicationNote", + "CreateStoreApplication": "CreateStoreApplication", + "EditStoreApplication": "EditStoreApplication", + "StoreApplicationDeletionConfirmationMessage": "Are you sure to delete the storeApplication {0}?", + "SuccessfullyDeleted": "Successfully deleted" + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/pl-PL.json b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/pl-PL.json new file mode 100644 index 00000000..4cb155d4 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/pl-PL.json @@ -0,0 +1,30 @@ +{ + "culture": "pl-PL", + "texts": { + "Permission:StoreApplication": "StoreApplication", + "Permission:Create": "Create", + "Permission:Update": "Update", + "Permission:Delete": "Delete", + "Permission:Approval": "Approval", + "Menu:StoreApplication": "MenuStoreApplication", + "StoreApplication": "StoreApplication", + "StoreApplicationApplicantId": "StoreApplicationApplicantId", + "StoreApplicationApprovalStatus": "StoreApplicationApprovalStatus", + "StoreApplicationStoreName": "StoreApplicationStoreName", + "StoreApplicationBusinessCategory": "StoreApplicationBusinessCategory", + "StoreApplicationAddress": "StoreApplicationAddress", + "StoreApplicationUnifiedCreditCode": "StoreApplicationUnifiedCreditCode", + "StoreApplicationHouseNumber": "StoreApplicationHouseNumber", + "StoreApplicationBusinessLicenseImage": "StoreApplicationBusinessLicenseImage", + "StoreApplicationName": "StoreApplicationName", + "StoreApplicationIdNumber": "StoreApplicationIdNumber", + "StoreApplicationIdCardFrontImage": "StoreApplicationIdCardFrontImage", + "StoreApplicationIdCardBackImage": "StoreApplicationIdCardBackImage", + "StoreApplicationStoreImage": "StoreApplicationStoreImage", + "StoreApplicationNote": "StoreApplicationNote", + "CreateStoreApplication": "CreateStoreApplication", + "EditStoreApplication": "EditStoreApplication", + "StoreApplicationDeletionConfirmationMessage": "Are you sure to delete the storeApplication {0}?", + "SuccessfullyDeleted": "Successfully deleted" + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/pt-BR.json b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/pt-BR.json new file mode 100644 index 00000000..faf80305 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/pt-BR.json @@ -0,0 +1,30 @@ +{ + "culture": "pt-BR", + "texts": { + "Permission:StoreApplication": "StoreApplication", + "Permission:Create": "Create", + "Permission:Update": "Update", + "Permission:Delete": "Delete", + "Permission:Approval": "Approval", + "Menu:StoreApplication": "MenuStoreApplication", + "StoreApplication": "StoreApplication", + "StoreApplicationApplicantId": "StoreApplicationApplicantId", + "StoreApplicationApprovalStatus": "StoreApplicationApprovalStatus", + "StoreApplicationStoreName": "StoreApplicationStoreName", + "StoreApplicationBusinessCategory": "StoreApplicationBusinessCategory", + "StoreApplicationAddress": "StoreApplicationAddress", + "StoreApplicationUnifiedCreditCode": "StoreApplicationUnifiedCreditCode", + "StoreApplicationHouseNumber": "StoreApplicationHouseNumber", + "StoreApplicationBusinessLicenseImage": "StoreApplicationBusinessLicenseImage", + "StoreApplicationName": "StoreApplicationName", + "StoreApplicationIdNumber": "StoreApplicationIdNumber", + "StoreApplicationIdCardFrontImage": "StoreApplicationIdCardFrontImage", + "StoreApplicationIdCardBackImage": "StoreApplicationIdCardBackImage", + "StoreApplicationStoreImage": "StoreApplicationStoreImage", + "StoreApplicationNote": "StoreApplicationNote", + "CreateStoreApplication": "CreateStoreApplication", + "EditStoreApplication": "EditStoreApplication", + "StoreApplicationDeletionConfirmationMessage": "Are you sure to delete the storeApplication {0}?", + "SuccessfullyDeleted": "Successfully deleted" + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/sl.json b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/sl.json new file mode 100644 index 00000000..6b4e8b9b --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/sl.json @@ -0,0 +1,31 @@ +{ + "culture": "sl", + "texts": { + "ManageYourProfile": "Upravljajte svojim profilom", + "Permission:StoreApplication": "StoreApplication", + "Permission:Create": "Create", + "Permission:Update": "Update", + "Permission:Delete": "Delete", + "Permission:Approval": "Approval", + "Menu:StoreApplication": "MenuStoreApplication", + "StoreApplication": "StoreApplication", + "StoreApplicationApplicantId": "StoreApplicationApplicantId", + "StoreApplicationApprovalStatus": "StoreApplicationApprovalStatus", + "StoreApplicationStoreName": "StoreApplicationStoreName", + "StoreApplicationBusinessCategory": "StoreApplicationBusinessCategory", + "StoreApplicationAddress": "StoreApplicationAddress", + "StoreApplicationUnifiedCreditCode": "StoreApplicationUnifiedCreditCode", + "StoreApplicationHouseNumber": "StoreApplicationHouseNumber", + "StoreApplicationBusinessLicenseImage": "StoreApplicationBusinessLicenseImage", + "StoreApplicationName": "StoreApplicationName", + "StoreApplicationIdNumber": "StoreApplicationIdNumber", + "StoreApplicationIdCardFrontImage": "StoreApplicationIdCardFrontImage", + "StoreApplicationIdCardBackImage": "StoreApplicationIdCardBackImage", + "StoreApplicationStoreImage": "StoreApplicationStoreImage", + "StoreApplicationNote": "StoreApplicationNote", + "CreateStoreApplication": "CreateStoreApplication", + "EditStoreApplication": "EditStoreApplication", + "StoreApplicationDeletionConfirmationMessage": "Are you sure to delete the storeApplication {0}?", + "SuccessfullyDeleted": "Successfully deleted" + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/tr.json b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/tr.json new file mode 100644 index 00000000..74815d15 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/tr.json @@ -0,0 +1,32 @@ +{ + "culture": "tr", + "texts": { + "ManageYourProfile": "Profil yönetimi", + "SamplePageMessage": "StoreApproval modulünden örnek bir sayfa", + "Permission:StoreApplication": "StoreApplication", + "Permission:Create": "Create", + "Permission:Update": "Update", + "Permission:Delete": "Delete", + "Permission:Approval": "Approval", + "Menu:StoreApplication": "MenuStoreApplication", + "StoreApplication": "StoreApplication", + "StoreApplicationApplicantId": "StoreApplicationApplicantId", + "StoreApplicationApprovalStatus": "StoreApplicationApprovalStatus", + "StoreApplicationStoreName": "StoreApplicationStoreName", + "StoreApplicationBusinessCategory": "StoreApplicationBusinessCategory", + "StoreApplicationAddress": "StoreApplicationAddress", + "StoreApplicationUnifiedCreditCode": "StoreApplicationUnifiedCreditCode", + "StoreApplicationHouseNumber": "StoreApplicationHouseNumber", + "StoreApplicationBusinessLicenseImage": "StoreApplicationBusinessLicenseImage", + "StoreApplicationName": "StoreApplicationName", + "StoreApplicationIdNumber": "StoreApplicationIdNumber", + "StoreApplicationIdCardFrontImage": "StoreApplicationIdCardFrontImage", + "StoreApplicationIdCardBackImage": "StoreApplicationIdCardBackImage", + "StoreApplicationStoreImage": "StoreApplicationStoreImage", + "StoreApplicationNote": "StoreApplicationNote", + "CreateStoreApplication": "CreateStoreApplication", + "EditStoreApplication": "EditStoreApplication", + "StoreApplicationDeletionConfirmationMessage": "Are you sure to delete the storeApplication {0}?", + "SuccessfullyDeleted": "Successfully deleted" + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/vi.json b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/vi.json new file mode 100644 index 00000000..ced4802f --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/vi.json @@ -0,0 +1,30 @@ +{ + "culture": "vi", + "texts": { + "Permission:StoreApplication": "StoreApplication", + "Permission:Create": "Create", + "Permission:Update": "Update", + "Permission:Delete": "Delete", + "Permission:Approval": "Approval", + "Menu:StoreApplication": "MenuStoreApplication", + "StoreApplication": "StoreApplication", + "StoreApplicationApplicantId": "StoreApplicationApplicantId", + "StoreApplicationApprovalStatus": "StoreApplicationApprovalStatus", + "StoreApplicationStoreName": "StoreApplicationStoreName", + "StoreApplicationBusinessCategory": "StoreApplicationBusinessCategory", + "StoreApplicationAddress": "StoreApplicationAddress", + "StoreApplicationUnifiedCreditCode": "StoreApplicationUnifiedCreditCode", + "StoreApplicationHouseNumber": "StoreApplicationHouseNumber", + "StoreApplicationBusinessLicenseImage": "StoreApplicationBusinessLicenseImage", + "StoreApplicationName": "StoreApplicationName", + "StoreApplicationIdNumber": "StoreApplicationIdNumber", + "StoreApplicationIdCardFrontImage": "StoreApplicationIdCardFrontImage", + "StoreApplicationIdCardBackImage": "StoreApplicationIdCardBackImage", + "StoreApplicationStoreImage": "StoreApplicationStoreImage", + "StoreApplicationNote": "StoreApplicationNote", + "CreateStoreApplication": "CreateStoreApplication", + "EditStoreApplication": "EditStoreApplication", + "StoreApplicationDeletionConfirmationMessage": "Are you sure to delete the storeApplication {0}?", + "SuccessfullyDeleted": "Successfully deleted" + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/zh-Hans.json b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/zh-Hans.json new file mode 100644 index 00000000..05987cbc --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/zh-Hans.json @@ -0,0 +1,31 @@ +{ + "culture": "zh-Hans", + "texts": { + "ManageYourProfile": "管理个人资料", + "Permission:StoreApplication": "StoreApplication", + "Permission:Create": "Create", + "Permission:Update": "Update", + "Permission:Delete": "Delete", + "Permission:Approval": "Approval", + "Menu:StoreApplication": "MenuStoreApplication", + "StoreApplication": "StoreApplication", + "StoreApplicationApplicantId": "StoreApplicationApplicantId", + "StoreApplicationApprovalStatus": "StoreApplicationApprovalStatus", + "StoreApplicationStoreName": "StoreApplicationStoreName", + "StoreApplicationBusinessCategory": "StoreApplicationBusinessCategory", + "StoreApplicationAddress": "StoreApplicationAddress", + "StoreApplicationUnifiedCreditCode": "StoreApplicationUnifiedCreditCode", + "StoreApplicationHouseNumber": "StoreApplicationHouseNumber", + "StoreApplicationBusinessLicenseImage": "StoreApplicationBusinessLicenseImage", + "StoreApplicationName": "StoreApplicationName", + "StoreApplicationIdNumber": "StoreApplicationIdNumber", + "StoreApplicationIdCardFrontImage": "StoreApplicationIdCardFrontImage", + "StoreApplicationIdCardBackImage": "StoreApplicationIdCardBackImage", + "StoreApplicationStoreImage": "StoreApplicationStoreImage", + "StoreApplicationNote": "StoreApplicationNote", + "CreateStoreApplication": "CreateStoreApplication", + "EditStoreApplication": "EditStoreApplication", + "StoreApplicationDeletionConfirmationMessage": "Are you sure to delete the storeApplication {0}?", + "SuccessfullyDeleted": "Successfully deleted" + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/zh-Hant.json b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/zh-Hant.json new file mode 100644 index 00000000..f04735e8 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApproval/zh-Hant.json @@ -0,0 +1,31 @@ +{ + "culture": "zh-Hant", + "texts": { + "ManageYourProfile": "管理個人資料", + "Permission:StoreApplication": "StoreApplication", + "Permission:Create": "Create", + "Permission:Update": "Update", + "Permission:Delete": "Delete", + "Permission:Approval": "Approval", + "Menu:StoreApplication": "MenuStoreApplication", + "StoreApplication": "StoreApplication", + "StoreApplicationApplicantId": "StoreApplicationApplicantId", + "StoreApplicationApprovalStatus": "StoreApplicationApprovalStatus", + "StoreApplicationStoreName": "StoreApplicationStoreName", + "StoreApplicationBusinessCategory": "StoreApplicationBusinessCategory", + "StoreApplicationAddress": "StoreApplicationAddress", + "StoreApplicationUnifiedCreditCode": "StoreApplicationUnifiedCreditCode", + "StoreApplicationHouseNumber": "StoreApplicationHouseNumber", + "StoreApplicationBusinessLicenseImage": "StoreApplicationBusinessLicenseImage", + "StoreApplicationName": "StoreApplicationName", + "StoreApplicationIdNumber": "StoreApplicationIdNumber", + "StoreApplicationIdCardFrontImage": "StoreApplicationIdCardFrontImage", + "StoreApplicationIdCardBackImage": "StoreApplicationIdCardBackImage", + "StoreApplicationStoreImage": "StoreApplicationStoreImage", + "StoreApplicationNote": "StoreApplicationNote", + "CreateStoreApplication": "CreateStoreApplication", + "EditStoreApplication": "EditStoreApplication", + "StoreApplicationDeletionConfirmationMessage": "Are you sure to delete the storeApplication {0}?", + "SuccessfullyDeleted": "Successfully deleted" + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApprovalResource.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApprovalResource.cs new file mode 100644 index 00000000..2154af53 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/Localization/StoreApprovalResource.cs @@ -0,0 +1,10 @@ +using Volo.Abp.Localization; + +namespace EasyAbp.EShop.Plugins.StoreApproval.Localization +{ + [LocalizationResourceName("StoreApproval")] + public class StoreApprovalResource + { + + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/StoreApplications/ApprovalStatusType.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/StoreApplications/ApprovalStatusType.cs new file mode 100644 index 00000000..1287a974 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/StoreApplications/ApprovalStatusType.cs @@ -0,0 +1,13 @@ +namespace EasyAbp.EShop.Plugins.StoreApproval.StoreApplications +{ + public enum ApprovalStatusType + { + Preparing, + + ReadyForReview, + + Rejected, + + Approved, + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/StoreApplications/StoreApplicationConsts.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/StoreApplications/StoreApplicationConsts.cs new file mode 100644 index 00000000..b12397d3 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/StoreApplications/StoreApplicationConsts.cs @@ -0,0 +1,13 @@ +namespace EasyAbp.EShop.Plugins.StoreApproval.StoreApplications +{ + public static class StoreApplicationConsts + { + public static int MaxNameLength { get; set; } = 32; + + public static int MaxAddressLength { get; set; } = 128; + + public static int MaxImageResourcesLength { get; set; } = 64; + + public static int MaxNoteLength { get; set; } = 1024; + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/StoreApprovalDomainSharedModule.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/StoreApprovalDomainSharedModule.cs new file mode 100644 index 00000000..ade9b92f --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/StoreApprovalDomainSharedModule.cs @@ -0,0 +1,37 @@ +using Volo.Abp.Modularity; +using Volo.Abp.Localization; +using EasyAbp.EShop.Plugins.StoreApproval.Localization; +using Volo.Abp.Localization.ExceptionHandling; +using Volo.Abp.Validation; +using Volo.Abp.Validation.Localization; +using Volo.Abp.VirtualFileSystem; + +namespace EasyAbp.EShop.Plugins.StoreApproval +{ + [DependsOn( + typeof(AbpValidationModule) + )] + public class StoreApprovalDomainSharedModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.FileSets.AddEmbedded(); + }); + + Configure(options => + { + options.Resources + .Add("en") + .AddBaseTypes(typeof(AbpValidationResource)) + .AddVirtualJson("/Localization/StoreApproval"); + }); + + Configure(options => + { + options.MapCodeNamespace("StoreApproval", typeof(StoreApprovalResource)); + }); + } + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/StoreApprovalErrorCodes.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/StoreApprovalErrorCodes.cs new file mode 100644 index 00000000..1a8dd2a7 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain.Shared/StoreApprovalErrorCodes.cs @@ -0,0 +1,11 @@ +namespace EasyAbp.EShop.Plugins.StoreApproval +{ + public static class StoreApprovalErrorCodes + { + public const string Namespace = "EasyAbp.EShop.Plugins.StoreApproval"; + + public const string AlreadySubmitted = Namespace + ":" + "000001"; + public const string AlreadyApproved = Namespace + ":" + "000002"; + public const string NotSubmitted = Namespace + ":" + "000003"; + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/EasyAbp.EShop.Plugins.StoreApproval.Domain.csproj b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/EasyAbp.EShop.Plugins.StoreApproval.Domain.csproj new file mode 100644 index 00000000..ab0263a4 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/EasyAbp.EShop.Plugins.StoreApproval.Domain.csproj @@ -0,0 +1,17 @@ + + + + + + netstandard2.0 + EasyAbp.EShop.Plugins.StoreApproval + + + + + + + + + + diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/FodyWeavers.xml b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/FodyWeavers.xml new file mode 100644 index 00000000..00e1d9a1 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/FodyWeavers.xsd b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/Settings/StoreApprovalSettingDefinitionProvider.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/Settings/StoreApprovalSettingDefinitionProvider.cs new file mode 100644 index 00000000..b4bab658 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/Settings/StoreApprovalSettingDefinitionProvider.cs @@ -0,0 +1,14 @@ +using Volo.Abp.Settings; + +namespace EasyAbp.EShop.Plugins.StoreApproval.Settings +{ + public class StoreApprovalSettingDefinitionProvider : SettingDefinitionProvider + { + public override void Define(ISettingDefinitionContext context) + { + /* Define module settings here. + * Use names from StoreApprovalSettings class. + */ + } + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/Settings/StoreApprovalSettings.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/Settings/StoreApprovalSettings.cs new file mode 100644 index 00000000..b1a9cf84 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/Settings/StoreApprovalSettings.cs @@ -0,0 +1,11 @@ +namespace EasyAbp.EShop.Plugins.StoreApproval.Settings +{ + public static class StoreApprovalSettings + { + public const string GroupName = "StoreApproval"; + + /* Add constants for setting names. Example: + * public const string MySettingName = GroupName + ".MySettingName"; + */ + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApplications/IStoreApplicationRepository.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApplications/IStoreApplicationRepository.cs new file mode 100644 index 00000000..e1dea6d8 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApplications/IStoreApplicationRepository.cs @@ -0,0 +1,9 @@ +using System; +using Volo.Abp.Domain.Repositories; + +namespace EasyAbp.EShop.Plugins.StoreApproval.StoreApplications +{ + public interface IStoreApplicationRepository : IRepository + { + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApplications/StoreApplication.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApplications/StoreApplication.cs new file mode 100644 index 00000000..735e7217 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApplications/StoreApplication.cs @@ -0,0 +1,129 @@ +using System; +using JetBrains.Annotations; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace EasyAbp.EShop.Plugins.StoreApproval.StoreApplications +{ + public class StoreApplication : FullAuditedAggregateRoot, IMultiTenant + { + public virtual Guid? TenantId { get; protected set; } + + public virtual Guid ApplicantId { get; protected set; } + + public virtual ApprovalStatusType ApprovalStatus { get; protected set; } + + [NotNull] + public virtual string StoreName { get; protected set; } + + [NotNull] + public virtual string BusinessCategory { get; protected set; } + + [NotNull] + public virtual string Address { get; protected set; } + + [NotNull] + public virtual string UnifiedCreditCode { get; protected set; } + + [CanBeNull] + public virtual string HouseNumber { get; protected set; } + + [NotNull] + public virtual string BusinessLicenseImage { get; protected set; } + + [NotNull] + public virtual string Name { get; protected set; } + + [NotNull] + public virtual string IdNumber { get; protected set; } + + [NotNull] + public virtual string IdCardFrontImage { get; protected set; } + + [NotNull] + public virtual string IdCardBackImage { get; protected set; } + + [NotNull] + public virtual string StoreImage { get; protected set; } + + [CanBeNull] + public virtual string Note { get; protected set; } + + protected StoreApplication() + { + } + + public StoreApplication(Guid id, Guid? tenantId, Guid applicantId, ApprovalStatusType approvalStatus, string storeName, string businessCategory, string address, string unifiedCreditCode, string houseNumber, string businessLicenseImage, string name, string idNumber, string idCardFrontImage, string idCardBackImage, string storeImage, string note) : base(id) + { + TenantId = tenantId; + ApplicantId = applicantId; + ApprovalStatus = approvalStatus; + StoreName = storeName; + BusinessCategory = businessCategory; + Address = address; + UnifiedCreditCode = unifiedCreditCode; + HouseNumber = houseNumber; + BusinessLicenseImage = businessLicenseImage; + Name = name; + IdNumber = idNumber; + IdCardFrontImage = idCardFrontImage; + IdCardBackImage = idCardBackImage; + StoreImage = storeImage; + Note = note; + } + + public void Submit() + { + switch (ApprovalStatus) + { + case ApprovalStatusType.Preparing: + case ApprovalStatusType.Rejected: + ApprovalStatus = ApprovalStatusType.ReadyForReview; + //TODO event + break; + case ApprovalStatusType.ReadyForReview: + throw new StoreApplicationAlreadySubmittedException(); + case ApprovalStatusType.Approved: + throw new StoreApplicationAlreadyApprovedException(); + default: + throw new ArgumentOutOfRangeException(); + } + } + + public void Approve() + { + switch (ApprovalStatus) + { + case ApprovalStatusType.ReadyForReview: + ApprovalStatus = ApprovalStatusType.Approved; + //TODO event + break; + case ApprovalStatusType.Preparing: + case ApprovalStatusType.Rejected: + throw new StoreApplicationNotSubmittedException(); + case ApprovalStatusType.Approved: + throw new StoreApplicationAlreadyApprovedException(); + default: + throw new ArgumentOutOfRangeException(); + } + } + + public void Reject() + { + switch (ApprovalStatus) + { + case ApprovalStatusType.ReadyForReview: + ApprovalStatus = ApprovalStatusType.Rejected; + //TODO event + break; + case ApprovalStatusType.Preparing: + case ApprovalStatusType.Rejected: + throw new StoreApplicationNotSubmittedException(); + case ApprovalStatusType.Approved: + throw new StoreApplicationAlreadyApprovedException(); + default: + throw new ArgumentOutOfRangeException(); + } + } + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApplications/StoreApplicationAlreadyApprovedException.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApplications/StoreApplicationAlreadyApprovedException.cs new file mode 100644 index 00000000..f0e1ea8d --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApplications/StoreApplicationAlreadyApprovedException.cs @@ -0,0 +1,13 @@ +using Volo.Abp; + +namespace EasyAbp.EShop.Plugins.StoreApproval.StoreApplications +{ + public class StoreApplicationAlreadyApprovedException : BusinessException + { + public StoreApplicationAlreadyApprovedException() + :base(StoreApprovalErrorCodes.AlreadyApproved) + { + + } + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApplications/StoreApplicationAlreadySubmittedException.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApplications/StoreApplicationAlreadySubmittedException.cs new file mode 100644 index 00000000..08d65acb --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApplications/StoreApplicationAlreadySubmittedException.cs @@ -0,0 +1,13 @@ +using Volo.Abp; + +namespace EasyAbp.EShop.Plugins.StoreApproval.StoreApplications +{ + public class StoreApplicationAlreadySubmittedException : BusinessException + { + public StoreApplicationAlreadySubmittedException() + : base(StoreApprovalErrorCodes.AlreadySubmitted) + { + + } + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApplications/StoreApplicationNotSubmittedException.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApplications/StoreApplicationNotSubmittedException.cs new file mode 100644 index 00000000..eb2e24f0 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApplications/StoreApplicationNotSubmittedException.cs @@ -0,0 +1,13 @@ +using Volo.Abp; + +namespace EasyAbp.EShop.Plugins.StoreApproval.StoreApplications +{ + public class StoreApplicationNotSubmittedException : BusinessException + { + public StoreApplicationNotSubmittedException() + : base(StoreApprovalErrorCodes.NotSubmitted) + { + + } + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApplications/StoreApplicationUpdatedEventHandler.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApplications/StoreApplicationUpdatedEventHandler.cs new file mode 100644 index 00000000..e6eedabe --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApplications/StoreApplicationUpdatedEventHandler.cs @@ -0,0 +1,65 @@ +using System; +using System.Threading.Tasks; +using EasyAbp.EShop.Stores.Stores; +using Microsoft.AspNetCore.Identity; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Entities.Events; +using Volo.Abp.EventBus; +using Volo.Abp.Guids; +using Volo.Abp.Identity; +using Volo.Abp.MultiTenancy; + +namespace EasyAbp.EShop.Plugins.StoreApproval.StoreApplications +{ + public class StoreApplicationUpdatedEventHandler + : ILocalEventHandler>, + ITransientDependency + { + private readonly IStoreManager _storeManager; + private readonly IGuidGenerator _guidGenerator; + private readonly ICurrentTenant _currentTenant; + private readonly IdentityUserManager _userManager; + + public StoreApplicationUpdatedEventHandler(IStoreManager storeManager, + IGuidGenerator guidGenerator, + ICurrentTenant currentTenant, + IdentityUserManager userManager) + { + _storeManager = storeManager; + _guidGenerator = guidGenerator; + _currentTenant = currentTenant; + _userManager = userManager; + } + + public async Task HandleEventAsync( + EntityUpdatedEventData eventData) + { + switch (eventData.Entity.ApprovalStatus) + { + case ApprovalStatusType.Preparing: + case ApprovalStatusType.ReadyForReview: + case ApprovalStatusType.Rejected: + break; + case ApprovalStatusType.Approved: + await CreateStore(eventData.Entity.StoreName, eventData.Entity.ApplicantId); + break; + default: + throw new ArgumentOutOfRangeException(); + } + } + + private async Task CreateStore(string storeName, Guid userId) + { + const string merchant = nameof(merchant); + + var user = await _userManager.GetByIdAsync(userId); + + var store = await _storeManager.CreateAsync(new Store( + _guidGenerator.Create(), + _currentTenant.Id, + storeName), new []{ userId }); + + (await _userManager.SetRolesAsync(user, new []{ merchant })).CheckErrors(); + } + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApprovalDbProperties.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApprovalDbProperties.cs new file mode 100644 index 00000000..4ec63638 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApprovalDbProperties.cs @@ -0,0 +1,11 @@ +namespace EasyAbp.EShop.Plugins.StoreApproval +{ + public static class StoreApprovalDbProperties + { + public static string DbTablePrefix { get; set; } = "StoreApproval"; + + public static string DbSchema { get; set; } = null; + + public const string ConnectionStringName = "StoreApproval"; + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApprovalDomainModule.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApprovalDomainModule.cs new file mode 100644 index 00000000..109dc1ce --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Domain/StoreApprovalDomainModule.cs @@ -0,0 +1,12 @@ +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Plugins.StoreApproval +{ + [DependsOn( + typeof(StoreApprovalDomainSharedModule) + )] + public class StoreApprovalDomainModule : AbpModule + { + + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.csproj b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.csproj new file mode 100644 index 00000000..67bb7fac --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.csproj @@ -0,0 +1,15 @@ + + + + + + netstandard2.0 + EasyAbp.EShop.Plugins.StoreApproval + + + + + + + + diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/EntityFrameworkCore/IStoreApprovalDbContext.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/EntityFrameworkCore/IStoreApprovalDbContext.cs new file mode 100644 index 00000000..3903b575 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/EntityFrameworkCore/IStoreApprovalDbContext.cs @@ -0,0 +1,16 @@ +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Data; +using Volo.Abp.EntityFrameworkCore; +using EasyAbp.EShop.Plugins.StoreApproval.StoreApplications; + +namespace EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore +{ + [ConnectionStringName(StoreApprovalDbProperties.ConnectionStringName)] + public interface IStoreApprovalDbContext : IEfCoreDbContext + { + /* Add DbSet for each Aggregate Root here. Example: + * DbSet Questions { get; } + */ + DbSet StoreApplications { get; set; } + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/EntityFrameworkCore/StoreApprovalDbContext.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/EntityFrameworkCore/StoreApprovalDbContext.cs new file mode 100644 index 00000000..6283c96b --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/EntityFrameworkCore/StoreApprovalDbContext.cs @@ -0,0 +1,29 @@ +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Data; +using Volo.Abp.EntityFrameworkCore; +using EasyAbp.EShop.Plugins.StoreApproval.StoreApplications; + +namespace EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore +{ + [ConnectionStringName(StoreApprovalDbProperties.ConnectionStringName)] + public class StoreApprovalDbContext : AbpDbContext, IStoreApprovalDbContext + { + /* Add DbSet for each Aggregate Root here. Example: + * public DbSet Questions { get; set; } + */ + public DbSet StoreApplications { get; set; } + + public StoreApprovalDbContext(DbContextOptions options) + : base(options) + { + + } + + protected override void OnModelCreating(ModelBuilder builder) + { + base.OnModelCreating(builder); + + builder.ConfigureStoreApproval(); + } + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/EntityFrameworkCore/StoreApprovalDbContextModelCreatingExtensions.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/EntityFrameworkCore/StoreApprovalDbContextModelCreatingExtensions.cs new file mode 100644 index 00000000..d5b5245e --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/EntityFrameworkCore/StoreApprovalDbContextModelCreatingExtensions.cs @@ -0,0 +1,54 @@ +using EasyAbp.EShop.Plugins.StoreApproval.StoreApplications; +using System; +using Microsoft.EntityFrameworkCore; +using Volo.Abp; +using Volo.Abp.EntityFrameworkCore.Modeling; + +namespace EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore +{ + public static class StoreApprovalDbContextModelCreatingExtensions + { + public static void ConfigureStoreApproval( + this ModelBuilder builder, + Action optionsAction = null) + { + Check.NotNull(builder, nameof(builder)); + + var options = new StoreApprovalModelBuilderConfigurationOptions( + StoreApprovalDbProperties.DbTablePrefix, + StoreApprovalDbProperties.DbSchema + ); + + optionsAction?.Invoke(options); + + /* Configure all entities here. Example: + + builder.Entity(b => + { + //Configure table & schema name + b.ToTable(options.TablePrefix + "Questions", options.Schema); + + b.ConfigureByConvention(); + + //Properties + b.Property(q => q.Title).IsRequired().HasMaxLength(QuestionConsts.MaxTitleLength); + + //Relations + b.HasMany(question => question.Tags).WithOne().HasForeignKey(qt => qt.QuestionId); + + //Indexes + b.HasIndex(q => q.CreationTime); + }); + */ + + + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "StoreApplications", options.Schema); + b.ConfigureByConvention(); + + /* Configure more properties here */ + }); + } + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/EntityFrameworkCore/StoreApprovalEntityFrameworkCoreModule.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/EntityFrameworkCore/StoreApprovalEntityFrameworkCoreModule.cs new file mode 100644 index 00000000..1d98af3b --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/EntityFrameworkCore/StoreApprovalEntityFrameworkCoreModule.cs @@ -0,0 +1,26 @@ +using EasyAbp.EShop.Plugins.StoreApproval.StoreApplications; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore +{ + [DependsOn( + typeof(StoreApprovalDomainModule), + typeof(AbpEntityFrameworkCoreModule) + )] + public class StoreApprovalEntityFrameworkCoreModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddAbpDbContext(options => + { + /* Add custom repositories here. Example: + * options.AddRepository(); + */ + + options.AddRepository(); + }); + } + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/EntityFrameworkCore/StoreApprovalModelBuilderConfigurationOptions.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/EntityFrameworkCore/StoreApprovalModelBuilderConfigurationOptions.cs new file mode 100644 index 00000000..49fb4601 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/EntityFrameworkCore/StoreApprovalModelBuilderConfigurationOptions.cs @@ -0,0 +1,18 @@ +using JetBrains.Annotations; +using Volo.Abp.EntityFrameworkCore.Modeling; + +namespace EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore +{ + public class StoreApprovalModelBuilderConfigurationOptions : AbpModelBuilderConfigurationOptions + { + public StoreApprovalModelBuilderConfigurationOptions( + [NotNull] string tablePrefix = "", + [CanBeNull] string schema = null) + : base( + tablePrefix, + schema) + { + + } + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/FodyWeavers.xml b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/FodyWeavers.xml new file mode 100644 index 00000000..be0de3a9 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/FodyWeavers.xsd b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/StoreApplications/EfCoreStoreApplicationRepository.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/StoreApplications/EfCoreStoreApplicationRepository.cs new file mode 100644 index 00000000..eb6652a6 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore/StoreApplications/EfCoreStoreApplicationRepository.cs @@ -0,0 +1,14 @@ +using EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore; +using System; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; + +namespace EasyAbp.EShop.Plugins.StoreApproval.StoreApplications +{ + public class EfCoreStoreApplicationRepository : EfCoreRepository, IStoreApplicationRepository + { + public EfCoreStoreApplicationRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.csproj b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.csproj new file mode 100644 index 00000000..fab85913 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.csproj @@ -0,0 +1,15 @@ + + + + + + netstandard2.0 + EasyAbp.EShop.Plugins.StoreApproval + + + + + + + + diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client/FodyWeavers.xml b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client/FodyWeavers.xml new file mode 100644 index 00000000..00e1d9a1 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client/FodyWeavers.xsd b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client/StoreApprovalHttpApiClientModule.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client/StoreApprovalHttpApiClientModule.cs new file mode 100644 index 00000000..d6b739f8 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client/StoreApprovalHttpApiClientModule.cs @@ -0,0 +1,22 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Http.Client; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Plugins.StoreApproval +{ + [DependsOn( + typeof(StoreApprovalApplicationContractsModule), + typeof(AbpHttpClientModule))] + public class StoreApprovalHttpApiClientModule : AbpModule + { + public const string RemoteServiceName = "StoreApproval"; + + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddHttpClientProxies( + typeof(StoreApprovalApplicationContractsModule).Assembly, + RemoteServiceName + ); + } + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.csproj b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.csproj new file mode 100644 index 00000000..fce884bd --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.csproj @@ -0,0 +1,15 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Plugins.StoreApproval + + + + + + + + diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi/FodyWeavers.xml b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi/FodyWeavers.xml new file mode 100644 index 00000000..be0de3a9 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi/FodyWeavers.xsd b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi/StoreApplications/StoreApplicationController.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi/StoreApplications/StoreApplicationController.cs new file mode 100644 index 00000000..076e8c32 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi/StoreApplications/StoreApplicationController.cs @@ -0,0 +1,75 @@ +using System; +using System.Threading.Tasks; +using EasyAbp.EShop.Plugins.StoreApproval.StoreApplications.Dtos; +using Volo.Abp.Application.Dtos; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp; + +namespace EasyAbp.EShop.Plugins.StoreApproval.StoreApplications +{ + [RemoteService(Name = "StoreApprovalStoreApplication")] + [Route("/api/eShop/storeApproval/storeApplication")] + public class StoreApplicationController : StoreApprovalController, IStoreApplicationAppService + { + private readonly IStoreApplicationAppService _service; + + public StoreApplicationController(IStoreApplicationAppService service) + { + _service = service; + } + + [HttpGet] + [Route("{id}")] + public virtual Task GetAsync(Guid id) + { + return _service.GetAsync(id); + } + + [HttpGet] + public virtual Task> GetListAsync(GetStoreApplicationListDto input) + { + return _service.GetListAsync(input); + } + + [HttpPost] + public virtual Task CreateAsync(CreateStoreApplicationDto input) + { + return _service.CreateAsync(input); + } + + [HttpPut] + [Route("{id}")] + public virtual Task UpdateAsync(Guid id, UpdateStoreApplicationDto input) + { + return _service.UpdateAsync(id, input); + } + + [HttpDelete] + [Route("{id}")] + public virtual Task DeleteAsync(Guid id) + { + return _service.DeleteAsync(id); + } + + [HttpPost] + [Route("{id}/submit")] + public virtual Task SubmitAsync(Guid id) + { + return _service.SubmitAsync(id); + } + + [HttpPost] + [Route("{id}/approve")] + public virtual Task ApproveAsync(Guid id) + { + return _service.ApproveAsync(id); + } + + [HttpPost] + [Route("{id}/reject")] + public virtual Task RejectAsync(Guid id) + { + return _service.RejectAsync(id); + } + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi/StoreApprovalController.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi/StoreApprovalController.cs new file mode 100644 index 00000000..ae77fa33 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi/StoreApprovalController.cs @@ -0,0 +1,13 @@ +using EasyAbp.EShop.Plugins.StoreApproval.Localization; +using Volo.Abp.AspNetCore.Mvc; + +namespace EasyAbp.EShop.Plugins.StoreApproval +{ + public abstract class StoreApprovalController : AbpController + { + protected StoreApprovalController() + { + LocalizationResource = typeof(StoreApprovalResource); + } + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi/StoreApprovalHttpApiModule.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi/StoreApprovalHttpApiModule.cs new file mode 100644 index 00000000..15809319 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.HttpApi/StoreApprovalHttpApiModule.cs @@ -0,0 +1,33 @@ +using Localization.Resources.AbpUi; +using EasyAbp.EShop.Plugins.StoreApproval.Localization; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.Localization; +using Volo.Abp.Modularity; +using Microsoft.Extensions.DependencyInjection; + +namespace EasyAbp.EShop.Plugins.StoreApproval +{ + [DependsOn( + typeof(StoreApprovalApplicationContractsModule), + typeof(AbpAspNetCoreMvcModule))] + public class StoreApprovalHttpApiModule : AbpModule + { + public override void PreConfigureServices(ServiceConfigurationContext context) + { + PreConfigure(mvcBuilder => + { + mvcBuilder.AddApplicationPartIfNotExists(typeof(StoreApprovalHttpApiModule).Assembly); + }); + } + + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.Resources + .Get() + .AddBaseTypes(typeof(AbpUiResource)); + }); + } + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.csproj b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.csproj new file mode 100644 index 00000000..57314e99 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.csproj @@ -0,0 +1,15 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Plugins.StoreApproval + + + + + + + + diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/FodyWeavers.xml b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/FodyWeavers.xml new file mode 100644 index 00000000..00e1d9a1 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/FodyWeavers.xsd b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/MongoDB/IStoreApprovalMongoDbContext.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/MongoDB/IStoreApprovalMongoDbContext.cs new file mode 100644 index 00000000..37a35ac2 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/MongoDB/IStoreApprovalMongoDbContext.cs @@ -0,0 +1,13 @@ +using Volo.Abp.Data; +using Volo.Abp.MongoDB; + +namespace EasyAbp.EShop.Plugins.StoreApproval.MongoDB +{ + [ConnectionStringName(StoreApprovalDbProperties.ConnectionStringName)] + public interface IStoreApprovalMongoDbContext : IAbpMongoDbContext + { + /* Define mongo collections here. Example: + * IMongoCollection Questions { get; } + */ + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/MongoDB/StoreApprovalMongoDbContext.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/MongoDB/StoreApprovalMongoDbContext.cs new file mode 100644 index 00000000..d46fd9a3 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/MongoDB/StoreApprovalMongoDbContext.cs @@ -0,0 +1,20 @@ +using Volo.Abp.Data; +using Volo.Abp.MongoDB; + +namespace EasyAbp.EShop.Plugins.StoreApproval.MongoDB +{ + [ConnectionStringName(StoreApprovalDbProperties.ConnectionStringName)] + public class StoreApprovalMongoDbContext : AbpMongoDbContext, IStoreApprovalMongoDbContext + { + /* Add mongo collections here. Example: + * public IMongoCollection Questions => Collection(); + */ + + protected override void CreateModel(IMongoModelBuilder modelBuilder) + { + base.CreateModel(modelBuilder); + + modelBuilder.ConfigureStoreApproval(); + } + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/MongoDB/StoreApprovalMongoDbContextExtensions.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/MongoDB/StoreApprovalMongoDbContextExtensions.cs new file mode 100644 index 00000000..9778a881 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/MongoDB/StoreApprovalMongoDbContextExtensions.cs @@ -0,0 +1,22 @@ +using System; +using Volo.Abp; +using Volo.Abp.MongoDB; + +namespace EasyAbp.EShop.Plugins.StoreApproval.MongoDB +{ + public static class StoreApprovalMongoDbContextExtensions + { + public static void ConfigureStoreApproval( + this IMongoModelBuilder builder, + Action optionsAction = null) + { + Check.NotNull(builder, nameof(builder)); + + var options = new StoreApprovalMongoModelBuilderConfigurationOptions( + StoreApprovalDbProperties.DbTablePrefix + ); + + optionsAction?.Invoke(options); + } + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/MongoDB/StoreApprovalMongoDbModule.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/MongoDB/StoreApprovalMongoDbModule.cs new file mode 100644 index 00000000..d951e3c6 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/MongoDB/StoreApprovalMongoDbModule.cs @@ -0,0 +1,23 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Modularity; +using Volo.Abp.MongoDB; + +namespace EasyAbp.EShop.Plugins.StoreApproval.MongoDB +{ + [DependsOn( + typeof(StoreApprovalDomainModule), + typeof(AbpMongoDbModule) + )] + public class StoreApprovalMongoDbModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddMongoDbContext(options => + { + /* Add custom repositories here. Example: + * options.AddRepository(); + */ + }); + } + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/MongoDB/StoreApprovalMongoModelBuilderConfigurationOptions.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/MongoDB/StoreApprovalMongoModelBuilderConfigurationOptions.cs new file mode 100644 index 00000000..ce957c4e --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.MongoDB/MongoDB/StoreApprovalMongoModelBuilderConfigurationOptions.cs @@ -0,0 +1,14 @@ +using JetBrains.Annotations; +using Volo.Abp.MongoDB; + +namespace EasyAbp.EShop.Plugins.StoreApproval.MongoDB +{ + public class StoreApprovalMongoModelBuilderConfigurationOptions : AbpMongoModelBuilderConfigurationOptions + { + public StoreApprovalMongoModelBuilderConfigurationOptions( + [NotNull] string collectionPrefix = "") + : base(collectionPrefix) + { + } + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/EasyAbp.EShop.Plugins.StoreApproval.Web.csproj b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/EasyAbp.EShop.Plugins.StoreApproval.Web.csproj new file mode 100644 index 00000000..344202a2 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/EasyAbp.EShop.Plugins.StoreApproval.Web.csproj @@ -0,0 +1,40 @@ + + + + + + netcoreapp3.1 + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + true + Library + EasyAbp.EShop.Plugins.StoreApproval.Web + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/FodyWeavers.xml b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/FodyWeavers.xml new file mode 100644 index 00000000..be0de3a9 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/FodyWeavers.xsd b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Menus/StoreApprovalMenuContributor.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Menus/StoreApprovalMenuContributor.cs new file mode 100644 index 00000000..b4ca5328 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Menus/StoreApprovalMenuContributor.cs @@ -0,0 +1,31 @@ +using System.Threading.Tasks; +using EasyAbp.EShop.Plugins.StoreApproval.Localization; +using EasyAbp.EShop.Plugins.StoreApproval.Permissions; +using Volo.Abp.UI.Navigation; + +namespace EasyAbp.EShop.Plugins.StoreApproval.Web.Menus +{ + public class StoreApprovalMenuContributor : IMenuContributor + { + public async Task ConfigureMenuAsync(MenuConfigurationContext context) + { + if (context.Menu.Name == StandardMenus.Main) + { + await ConfigureMainMenu(context); + } + } + + private async Task ConfigureMainMenu(MenuConfigurationContext context) + { + var l = context.GetLocalizer(); + //Add main menu items. + + if (await context.IsGrantedAsync(StoreApprovalPermissions.StoreApplication.Default)) + { + context.Menu.AddItem( + new ApplicationMenuItem("StoreApplication", l["Menu:StoreApplication"], "/StoreApproval/StoreApplications/StoreApplication") + ); + } + } + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Menus/StoreApprovalMenus.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Menus/StoreApprovalMenus.cs new file mode 100644 index 00000000..505b82b6 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Menus/StoreApprovalMenus.cs @@ -0,0 +1,11 @@ +namespace EasyAbp.EShop.Plugins.StoreApproval.Web.Menus +{ + public class StoreApprovalMenus + { + private const string Prefix = "StoreApproval"; + + //Add your menu items here... + //public const string Home = Prefix + ".MyNewMenuItem"; + + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/Index.cshtml b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/Index.cshtml new file mode 100644 index 00000000..cb63a652 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/Index.cshtml @@ -0,0 +1,9 @@ +@page +@using Microsoft.Extensions.Localization +@using EasyAbp.EShop.Plugins.StoreApproval.Localization +@model EasyAbp.EShop.Plugins.StoreApproval.Web.Pages.StoreApproval.IndexModel +@inject IStringLocalizer L +@{ +} +

StoreApproval

+

@L["SamplePageMessage"]

diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/Index.cshtml.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/Index.cshtml.cs new file mode 100644 index 00000000..82edeb48 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/Index.cshtml.cs @@ -0,0 +1,9 @@ +namespace EasyAbp.EShop.Plugins.StoreApproval.Web.Pages.StoreApproval +{ + public class IndexModel : StoreApprovalPageModel + { + public void OnGet() + { + } + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/CreateModal.cshtml b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/CreateModal.cshtml new file mode 100644 index 00000000..ac8353dd --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/CreateModal.cshtml @@ -0,0 +1,18 @@ +@page +@using Microsoft.AspNetCore.Mvc.Localization +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal; +@using EasyAbp.EShop.Plugins.StoreApproval.Localization +@inject IHtmlLocalizer L +@model EasyAbp.EShop.Plugins.StoreApproval.Web.Pages.StoreApproval.StoreApplications.StoreApplication.CreateModalModel +@{ + Layout = null; +} + + + + + + + + + \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/CreateModal.cshtml.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/CreateModal.cshtml.cs new file mode 100644 index 00000000..316bc9c0 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/CreateModal.cshtml.cs @@ -0,0 +1,28 @@ +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using EasyAbp.EShop.Plugins.StoreApproval.StoreApplications; +using EasyAbp.EShop.Plugins.StoreApproval.StoreApplications.Dtos; +using EasyAbp.EShop.Plugins.StoreApproval.Web.Pages.StoreApproval.StoreApplications.StoreApplication.ViewModels; + +namespace EasyAbp.EShop.Plugins.StoreApproval.Web.Pages.StoreApproval.StoreApplications.StoreApplication +{ + public class CreateModalModel : StoreApprovalPageModel + { + [BindProperty] + public CreateStoreApplicationViewModel ViewModel { get; set; } + + private readonly IStoreApplicationAppService _service; + + public CreateModalModel(IStoreApplicationAppService service) + { + _service = service; + } + + public virtual async Task OnPostAsync() + { + var dto = ObjectMapper.Map(ViewModel); + await _service.CreateAsync(dto); + return NoContent(); + } + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/EditModal.cshtml b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/EditModal.cshtml new file mode 100644 index 00000000..6604d450 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/EditModal.cshtml @@ -0,0 +1,19 @@ +@page +@using EasyAbp.EShop.Plugins.StoreApproval.Localization +@using Microsoft.AspNetCore.Mvc.Localization +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal; +@inject IHtmlLocalizer L +@model EasyAbp.EShop.Plugins.StoreApproval.Web.Pages.StoreApproval.StoreApplications.StoreApplication.EditModalModel +@{ + Layout = null; +} + + + + + + + + + + diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/EditModal.cshtml.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/EditModal.cshtml.cs new file mode 100644 index 00000000..0e2d2251 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/EditModal.cshtml.cs @@ -0,0 +1,39 @@ +using System; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using EasyAbp.EShop.Plugins.StoreApproval.StoreApplications; +using EasyAbp.EShop.Plugins.StoreApproval.StoreApplications.Dtos; +using EasyAbp.EShop.Plugins.StoreApproval.Web.Pages.StoreApproval.StoreApplications.StoreApplication.ViewModels; + +namespace EasyAbp.EShop.Plugins.StoreApproval.Web.Pages.StoreApproval.StoreApplications.StoreApplication +{ + public class EditModalModel : StoreApprovalPageModel + { + [HiddenInput] + [BindProperty(SupportsGet = true)] + public Guid Id { get; set; } + + [BindProperty] + public EditStoreApplicationViewModel ViewModel { get; set; } + + private readonly IStoreApplicationAppService _service; + + public EditModalModel(IStoreApplicationAppService service) + { + _service = service; + } + + public virtual async Task OnGetAsync() + { + var dto = await _service.GetAsync(Id); + ViewModel = ObjectMapper.Map(dto); + } + + public virtual async Task OnPostAsync() + { + var dto = ObjectMapper.Map(ViewModel); + await _service.UpdateAsync(Id, dto); + return NoContent(); + } + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/Index.cshtml b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/Index.cshtml new file mode 100644 index 00000000..a51241d6 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/Index.cshtml @@ -0,0 +1,67 @@ +@page +@using EasyAbp.EShop.Plugins.StoreApproval.Permissions +@using Microsoft.AspNetCore.Authorization +@using Microsoft.AspNetCore.Mvc.Localization +@using Volo.Abp.AspNetCore.Mvc.UI.Layout +@using EasyAbp.EShop.Plugins.StoreApproval.Web.Pages.StoreApproval.StoreApplications.StoreApplication +@using EasyAbp.EShop.Plugins.StoreApproval.Localization +@model IndexModel +@inject IPageLayout PageLayout +@inject IHtmlLocalizer L +@inject IAuthorizationService Authorization +@{ + PageLayout.Content.Title = L["StoreApplication"].Value; + PageLayout.Content.BreadCrumb.Add(L["Menu:StoreApplication"].Value); + PageLayout.Content.MenuItemName = "StoreApplication"; +} + +@section scripts +{ + +} +@section styles +{ + +} + + + + + + @L["StoreApplication"] + + + @if (await Authorization.IsGrantedAsync(StoreApprovalPermissions.StoreApplication.Create)) + { + + } + + + + + + + + @L["Actions"] + @L["StoreApplicationApplicantId"] + @L["StoreApplicationApprovalStatus"] + @L["StoreApplicationStoreName"] + @L["StoreApplicationBusinessCategory"] + @L["StoreApplicationAddress"] + @L["StoreApplicationUnifiedCreditCode"] + @L["StoreApplicationHouseNumber"] + @L["StoreApplicationBusinessLicenseImage"] + @L["StoreApplicationName"] + @L["StoreApplicationIdNumber"] + @L["StoreApplicationIdCardFrontImage"] + @L["StoreApplicationIdCardBackImage"] + @L["StoreApplicationStoreImage"] + @L["StoreApplicationNote"] + + + + + \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/Index.cshtml.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/Index.cshtml.cs new file mode 100644 index 00000000..f2f427cc --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/Index.cshtml.cs @@ -0,0 +1,12 @@ +using System.Threading.Tasks; + +namespace EasyAbp.EShop.Plugins.StoreApproval.Web.Pages.StoreApproval.StoreApplications.StoreApplication +{ + public class IndexModel : StoreApprovalPageModel + { + public virtual async Task OnGetAsync() + { + await Task.CompletedTask; + } + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/ViewModels/CreateEditStoreApplicationViewModel.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/ViewModels/CreateEditStoreApplicationViewModel.cs new file mode 100644 index 00000000..2487a804 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/ViewModels/CreateEditStoreApplicationViewModel.cs @@ -0,0 +1,54 @@ +using System; +using System.ComponentModel.DataAnnotations; +using EasyAbp.EShop.Plugins.StoreApproval.StoreApplications; + +namespace EasyAbp.EShop.Plugins.StoreApproval.Web.Pages.StoreApproval.StoreApplications.StoreApplication.ViewModels +{ + public class CreateStoreApplicationViewModel : EditStoreApplicationViewModel + { + [Display(Name = "StoreApplicationApplicantId")] + public Guid ApplicantId { get; set; } + } + + public class EditStoreApplicationViewModel + { + [Display(Name = "StoreApplicationApplicantId")] + public Guid ApplicantId { get; set; } + + [Display(Name = "StoreApplicationStoreName")] + public string StoreName { get; set; } + + [Display(Name = "StoreApplicationBusinessCategory")] + public string BusinessCategory { get; set; } + + [Display(Name = "StoreApplicationAddress")] + public string Address { get; set; } + + [Display(Name = "StoreApplicationUnifiedCreditCode")] + public string UnifiedCreditCode { get; set; } + + [Display(Name = "StoreApplicationHouseNumber")] + public string HouseNumber { get; set; } + + [Display(Name = "StoreApplicationBusinessLicenseImage")] + public string BusinessLicenseImage { get; set; } + + [Display(Name = "StoreApplicationName")] + public string Name { get; set; } + + [Display(Name = "StoreApplicationIdNumber")] + public string IdNumber { get; set; } + + [Display(Name = "StoreApplicationIdCardFrontImage")] + public string IdCardFrontImage { get; set; } + + [Display(Name = "StoreApplicationIdCardBackImage")] + public string IdCardBackImage { get; set; } + + [Display(Name = "StoreApplicationStoreImage")] + public string StoreImage { get; set; } + + [Display(Name = "StoreApplicationNote")] + public string Note { get; set; } + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/index.css b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/index.css new file mode 100644 index 00000000..e69de29b diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/index.js b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/index.js new file mode 100644 index 00000000..922de5e1 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/StoreApplications/StoreApplication/index.js @@ -0,0 +1,76 @@ +$(function () { + + var l = abp.localization.getResource('StoreApproval'); + + var service = easyAbp.eShop.plugins.storeApproval.storeApplications.storeApplication; + var createModal = new abp.ModalManager(abp.appPath + 'StoreApproval/StoreApplications/StoreApplication/CreateModal'); + var editModal = new abp.ModalManager(abp.appPath + 'StoreApproval/StoreApplications/StoreApplication/EditModal'); + + var dataTable = $('#StoreApplicationTable').DataTable(abp.libs.datatables.normalizeConfiguration({ + processing: true, + serverSide: true, + paging: true, + searching: false, + autoWidth: false, + scrollCollapse: true, + order: [[1, "asc"]], + ajax: abp.libs.datatables.createAjax(service.getList), + columnDefs: [ + { + rowAction: { + items: + [ + { + text: l('Edit'), + visible: abp.auth.isGranted('StoreApproval.StoreApplication.Update'), + action: function (data) { + editModal.open({ id: data.record.id }); + } + }, + { + text: l('Delete'), + visible: abp.auth.isGranted('StoreApproval.StoreApplication.Delete'), + confirmMessage: function (data) { + return l('StoreApplicationDeletionConfirmationMessage', data.record.id); + }, + action: function (data) { + service.delete(data.record.id) + .then(function () { + abp.notify.info(l('SuccessfullyDeleted')); + dataTable.ajax.reload(); + }); + } + } + ] + } + }, + { data: "applicantId" }, + { data: "approvalStatus" }, + { data: "storeName" }, + { data: "businessCategory" }, + { data: "address" }, + { data: "unifiedCreditCode" }, + { data: "houseNumber" }, + { data: "businessLicenseImage" }, + { data: "name" }, + { data: "idNumber" }, + { data: "idCardFrontImage" }, + { data: "idCardBackImage" }, + { data: "storeImage" }, + { data: "note" }, + ] + })); + + createModal.onResult(function () { + dataTable.ajax.reload(); + }); + + editModal.onResult(function () { + dataTable.ajax.reload(); + }); + + $('#NewStoreApplicationButton').click(function (e) { + e.preventDefault(); + createModal.open(); + }); +}); \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/_ViewImports.cshtml b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/_ViewImports.cshtml new file mode 100644 index 00000000..c1da1f5f --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApproval/_ViewImports.cshtml @@ -0,0 +1,4 @@ +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI +@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap +@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApprovalPageModel.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApprovalPageModel.cs new file mode 100644 index 00000000..9ffc9e7f --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Pages/StoreApprovalPageModel.cs @@ -0,0 +1,16 @@ +using EasyAbp.EShop.Plugins.StoreApproval.Localization; +using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; + +namespace EasyAbp.EShop.Plugins.StoreApproval.Web.Pages +{ + /* Inherit your PageModel classes from this class. + */ + public abstract class StoreApprovalPageModel : AbpPageModel + { + protected StoreApprovalPageModel() + { + LocalizationResourceType = typeof(StoreApprovalResource); + ObjectMapperContext = typeof(StoreApprovalWebModule); + } + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Properties/launchSettings.json b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Properties/launchSettings.json new file mode 100644 index 00000000..610ee0c0 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:5733/", + "sslPort": 44304 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "EasyAbp.EShop.Plugins.StoreApproval.Web": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:5001;http://localhost:5000" + } + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/StoreApprovalWebAutoMapperProfile.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/StoreApprovalWebAutoMapperProfile.cs new file mode 100644 index 00000000..991d2f47 --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/StoreApprovalWebAutoMapperProfile.cs @@ -0,0 +1,19 @@ +using EasyAbp.EShop.Plugins.StoreApproval.StoreApplications.Dtos; +using EasyAbp.EShop.Plugins.StoreApproval.Web.Pages.StoreApproval.StoreApplications.StoreApplication.ViewModels; +using AutoMapper; + +namespace EasyAbp.EShop.Plugins.StoreApproval.Web +{ + public class StoreApprovalWebAutoMapperProfile : Profile + { + public StoreApprovalWebAutoMapperProfile() + { + /* You can configure your AutoMapper mapping configuration here. + * Alternatively, you can split your mapping configurations + * into multiple profile classes for a better organization. */ + CreateMap(); + CreateMap(); + CreateMap(); + } + } +} diff --git a/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/StoreApprovalWebModule.cs b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/StoreApprovalWebModule.cs new file mode 100644 index 00000000..005030dc --- /dev/null +++ b/plugins/StoreApproval/src/EasyAbp.EShop.Plugins.StoreApproval.Web/StoreApprovalWebModule.cs @@ -0,0 +1,59 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.Extensions.DependencyInjection; +using EasyAbp.EShop.Plugins.StoreApproval.Localization; +using EasyAbp.EShop.Plugins.StoreApproval.Web.Menus; +using Volo.Abp.AspNetCore.Mvc.Localization; +using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; +using Volo.Abp.AutoMapper; +using Volo.Abp.Modularity; +using Volo.Abp.UI.Navigation; +using Volo.Abp.VirtualFileSystem; +using EasyAbp.EShop.Plugins.StoreApproval.Permissions; + +namespace EasyAbp.EShop.Plugins.StoreApproval.Web +{ + [DependsOn( + typeof(StoreApprovalHttpApiModule), + typeof(AbpAspNetCoreMvcUiThemeSharedModule), + typeof(AbpAutoMapperModule) + )] + public class StoreApprovalWebModule : AbpModule + { + public override void PreConfigureServices(ServiceConfigurationContext context) + { + context.Services.PreConfigure(options => + { + options.AddAssemblyResource(typeof(StoreApprovalResource), typeof(StoreApprovalWebModule).Assembly); + }); + + PreConfigure(mvcBuilder => + { + mvcBuilder.AddApplicationPartIfNotExists(typeof(StoreApprovalWebModule).Assembly); + }); + } + + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.MenuContributors.Add(new StoreApprovalMenuContributor()); + }); + + Configure(options => + { + options.FileSets.AddEmbedded(); + }); + + context.Services.AddAutoMapperObjectMapper(); + Configure(options => + { + options.AddMaps(validate: true); + }); + + Configure(options => + { + //Configure authorization. + }); + } + } +} diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Application.Tests/EasyAbp.EShop.Plugins.StoreApproval.Application.Tests.csproj b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Application.Tests/EasyAbp.EShop.Plugins.StoreApproval.Application.Tests.csproj new file mode 100644 index 00000000..36a44182 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Application.Tests/EasyAbp.EShop.Plugins.StoreApproval.Application.Tests.csproj @@ -0,0 +1,16 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Plugins.StoreApproval + + + + + + + + + diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Application.Tests/FodyWeavers.xml b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Application.Tests/FodyWeavers.xml new file mode 100644 index 00000000..be0de3a9 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Application.Tests/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Application.Tests/FodyWeavers.xsd b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Application.Tests/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Application.Tests/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Application.Tests/StoreApplications/StoreApplicationAppServiceTests.cs b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Application.Tests/StoreApplications/StoreApplicationAppServiceTests.cs new file mode 100644 index 00000000..29741b2f --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Application.Tests/StoreApplications/StoreApplicationAppServiceTests.cs @@ -0,0 +1,26 @@ +using Shouldly; +using System.Threading.Tasks; +using Xunit; + +namespace EasyAbp.EShop.Plugins.StoreApproval.StoreApplications +{ + public class StoreApplicationAppServiceTests : StoreApprovalApplicationTestBase + { + private readonly IStoreApplicationAppService _storeApplicationAppService; + + public StoreApplicationAppServiceTests() + { + _storeApplicationAppService = GetRequiredService(); + } + + [Fact] + public async Task Test1() + { + // Arrange + + // Act + + // Assert + } + } +} diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Application.Tests/StoreApprovalApplicationTestBase.cs b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Application.Tests/StoreApprovalApplicationTestBase.cs new file mode 100644 index 00000000..ae6ac519 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Application.Tests/StoreApprovalApplicationTestBase.cs @@ -0,0 +1,10 @@ +namespace EasyAbp.EShop.Plugins.StoreApproval +{ + /* Inherit from this class for your application layer tests. + * See SampleAppService_Tests for example. + */ + public abstract class StoreApprovalApplicationTestBase : StoreApprovalTestBase + { + + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Application.Tests/StoreApprovalApplicationTestModule.cs b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Application.Tests/StoreApprovalApplicationTestModule.cs new file mode 100644 index 00000000..b69fcdd7 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Application.Tests/StoreApprovalApplicationTestModule.cs @@ -0,0 +1,13 @@ +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Plugins.StoreApproval +{ + [DependsOn( + typeof(StoreApprovalApplicationModule), + typeof(StoreApprovalDomainTestModule) + )] + public class StoreApprovalApplicationTestModule : AbpModule + { + + } +} diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests/EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests.csproj b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests/EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests.csproj new file mode 100644 index 00000000..3f05fd71 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests/EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests.csproj @@ -0,0 +1,15 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Plugins.StoreApproval + + + + + + + + diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests/FodyWeavers.xml b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests/FodyWeavers.xml new file mode 100644 index 00000000..bd7fba1b --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests/FodyWeavers.xsd b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests/StoreApplications/StoreApplicationDomainTests.cs b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests/StoreApplications/StoreApplicationDomainTests.cs new file mode 100644 index 00000000..3d63e5f3 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests/StoreApplications/StoreApplicationDomainTests.cs @@ -0,0 +1,23 @@ +using System.Threading.Tasks; +using Shouldly; +using Xunit; + +namespace EasyAbp.EShop.Plugins.StoreApproval.StoreApplications +{ + public class StoreApplicationDomainTests : StoreApprovalDomainTestBase + { + public StoreApplicationDomainTests() + { + } + + [Fact] + public async Task Test1() + { + // Arrange + + // Assert + + // Assert + } + } +} diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests/StoreApprovalDomainTestBase.cs b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests/StoreApprovalDomainTestBase.cs new file mode 100644 index 00000000..8470fe57 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests/StoreApprovalDomainTestBase.cs @@ -0,0 +1,10 @@ +namespace EasyAbp.EShop.Plugins.StoreApproval +{ + /* Inherit from this class for your domain layer tests. + * See SampleManager_Tests for example. + */ + public abstract class StoreApprovalDomainTestBase : StoreApprovalTestBase + { + + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests/StoreApprovalDomainTestModule.cs b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests/StoreApprovalDomainTestModule.cs new file mode 100644 index 00000000..2ac79e91 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.Domain.Tests/StoreApprovalDomainTestModule.cs @@ -0,0 +1,17 @@ +using EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Plugins.StoreApproval +{ + /* Domain tests are configured to use the EF Core provider. + * You can switch to MongoDB, however your domain tests should be + * database independent anyway. + */ + [DependsOn( + typeof(StoreApprovalEntityFrameworkCoreTestModule) + )] + public class StoreApprovalDomainTestModule : AbpModule + { + + } +} diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests.csproj b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests.csproj new file mode 100644 index 00000000..2b828a1a --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests.csproj @@ -0,0 +1,18 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Plugins.StoreApproval + + + + + + + + + + + diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests/EntityFrameworkCore/StoreApplications/StoreApplicationRepositoryTests.cs b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests/EntityFrameworkCore/StoreApplications/StoreApplicationRepositoryTests.cs new file mode 100644 index 00000000..3b432fa7 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests/EntityFrameworkCore/StoreApplications/StoreApplicationRepositoryTests.cs @@ -0,0 +1,31 @@ +using System; +using System.Threading.Tasks; +using EasyAbp.EShop.Plugins.StoreApproval.StoreApplications; +using Volo.Abp.Domain.Repositories; +using Xunit; + +namespace EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.StoreApplications +{ + public class StoreApplicationRepositoryTests : StoreApprovalEntityFrameworkCoreTestBase + { + private readonly IRepository _storeApplicationRepository; + + public StoreApplicationRepositoryTests() + { + _storeApplicationRepository = GetRequiredService>(); + } + + [Fact] + public async Task Test1() + { + await WithUnitOfWorkAsync(async () => + { + // Arrange + + // Act + + //Assert + }); + } + } +} diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests/EntityFrameworkCore/StoreApprovalEntityFrameworkCoreTestBase.cs b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests/EntityFrameworkCore/StoreApprovalEntityFrameworkCoreTestBase.cs new file mode 100644 index 00000000..0246008c --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests/EntityFrameworkCore/StoreApprovalEntityFrameworkCoreTestBase.cs @@ -0,0 +1,10 @@ +namespace EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore +{ + /* This class can be used as a base class for EF Core integration tests, + * while SampleRepository_Tests uses a different approach. + */ + public abstract class StoreApprovalEntityFrameworkCoreTestBase : StoreApprovalTestBase + { + + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests/EntityFrameworkCore/StoreApprovalEntityFrameworkCoreTestModule.cs b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests/EntityFrameworkCore/StoreApprovalEntityFrameworkCoreTestModule.cs new file mode 100644 index 00000000..e8ac8d6c --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests/EntityFrameworkCore/StoreApprovalEntityFrameworkCoreTestModule.cs @@ -0,0 +1,43 @@ +using Microsoft.Data.Sqlite; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage; +using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore.Sqlite; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore +{ + [DependsOn( + typeof(StoreApprovalTestBaseModule), + typeof(StoreApprovalEntityFrameworkCoreModule), + typeof(AbpEntityFrameworkCoreSqliteModule) + )] + public class StoreApprovalEntityFrameworkCoreTestModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + var sqliteConnection = CreateDatabaseAndGetConnection(); + + Configure(options => + { + options.Configure(abpDbContextConfigurationContext => + { + abpDbContextConfigurationContext.DbContextOptions.UseSqlite(sqliteConnection); + }); + }); + } + + private static SqliteConnection CreateDatabaseAndGetConnection() + { + var connection = new SqliteConnection("Data Source=:memory:"); + connection.Open(); + + new StoreApprovalDbContext( + new DbContextOptionsBuilder().UseSqlite(connection).Options + ).GetService().CreateTables(); + + return connection; + } + } +} diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests/FodyWeavers.xml b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests/FodyWeavers.xml new file mode 100644 index 00000000..bd7fba1b --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests/FodyWeavers.xsd b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.EntityFrameworkCore.Tests/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs new file mode 100644 index 00000000..e6c31760 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs @@ -0,0 +1,154 @@ +using System; +using System.Net.Http; +using System.Threading.Tasks; +using IdentityModel.Client; +using Microsoft.Extensions.Configuration; +using Volo.Abp.DependencyInjection; +using Volo.Abp.IdentityModel; + +namespace EasyAbp.EShop.Plugins.StoreApproval +{ + public class ClientDemoService : ITransientDependency + { + private readonly IIdentityModelAuthenticationService _authenticationService; + private readonly IConfiguration _configuration; + + public ClientDemoService( + IIdentityModelAuthenticationService authenticationService, + IConfiguration configuration) + { + _authenticationService = authenticationService; + _configuration = configuration; + } + + public async Task RunAsync() + { + await TestWithDynamicProxiesAsync(); + await TestWithHttpClientAndIdentityModelAuthenticationServiceAsync(); + await TestAllManuallyAsync(); + } + + /* Shows how to perform an HTTP request to the API using ABP's dynamic c# proxy + * feature. It is just simple as calling a local service method. + * Authorization and HTTP request details are handled by the ABP framework. + */ + private Task TestWithDynamicProxiesAsync() + { + Console.WriteLine(); + Console.WriteLine($"***** {nameof(TestWithDynamicProxiesAsync)} *****"); + + return Task.CompletedTask; + + //var result = await _sampleAppService.GetAsync(); + //Console.WriteLine("Result: " + result.Value); + + //result = await _sampleAppService.GetAuthorizedAsync(); + //Console.WriteLine("Result (authorized): " + result.Value); + } + + /* Shows how to use HttpClient to perform a request to the HTTP API. + * It uses ABP's IIdentityModelAuthenticationService to simplify obtaining access tokens. + */ + private async Task TestWithHttpClientAndIdentityModelAuthenticationServiceAsync() + { + Console.WriteLine(); + Console.WriteLine($"***** {nameof(TestWithHttpClientAndIdentityModelAuthenticationServiceAsync)} *****"); + + //Get access token using ABP's IIdentityModelAuthenticationService + + var accessToken = await _authenticationService.GetAccessTokenAsync( + new IdentityClientConfiguration( + _configuration["IdentityClients:Default:Authority"], + _configuration["IdentityClients:Default:Scope"], + _configuration["IdentityClients:Default:ClientId"], + _configuration["IdentityClients:Default:ClientSecret"], + _configuration["IdentityClients:Default:GrantType"], + _configuration["IdentityClients:Default:UserName"], + _configuration["IdentityClients:Default:UserPassword"] + ) + ); + + //Perform the actual HTTP request + + using (var httpClient = new HttpClient()) + { + httpClient.SetBearerToken(accessToken); + + var url = _configuration["RemoteServices:StoreApproval:BaseUrl"] + + "api/StoreApproval/sample/authorized"; + + var responseMessage = await httpClient.GetAsync(url); + if (responseMessage.IsSuccessStatusCode) + { + var responseString = await responseMessage.Content.ReadAsStringAsync(); + Console.WriteLine("Result: " + responseString); + } + else + { + throw new Exception("Remote server returns error code: " + responseMessage.StatusCode); + } + } + } + + /* Shows how to use HttpClient to perform a request to the HTTP API. + * It obtains access token using IdentityServer's API. See its documentation: + * https://identityserver4.readthedocs.io/en/latest/quickstarts/2_resource_owner_passwords.html + */ + private async Task TestAllManuallyAsync() + { + Console.WriteLine(); + Console.WriteLine($"***** {nameof(TestAllManuallyAsync)} *****"); + + //Obtain access token from the IDS4 server + + // discover endpoints from metadata + var client = new HttpClient(); + var disco = await client.GetDiscoveryDocumentAsync(_configuration["IdentityClients:Default:Authority"]); + if (disco.IsError) + { + Console.WriteLine(disco.Error); + return; + } + + // request token + var tokenResponse = await client.RequestPasswordTokenAsync(new PasswordTokenRequest + { + Address = disco.TokenEndpoint, + ClientId = _configuration["IdentityClients:Default:ClientId"], + ClientSecret = _configuration["IdentityClients:Default:ClientSecret"], + UserName = _configuration["IdentityClients:Default:UserName"], + Password = _configuration["IdentityClients:Default:UserPassword"], + Scope = _configuration["IdentityClients:Default:Scope"] + }); + + if (tokenResponse.IsError) + { + Console.WriteLine(tokenResponse.Error); + return; + } + + Console.WriteLine(tokenResponse.Json); + + //Perform the actual HTTP request + + using (var httpClient = new HttpClient()) + { + httpClient.SetBearerToken(tokenResponse.AccessToken); + + var url = _configuration["RemoteServices:StoreApproval:BaseUrl"] + + "api/StoreApproval/sample/authorized"; + + var responseMessage = await httpClient.GetAsync(url); + if (responseMessage.IsSuccessStatusCode) + { + var responseString = await responseMessage.Content.ReadAsStringAsync(); + Console.WriteLine("Result: " + responseString); + } + else + { + throw new Exception("Remote server returns error code: " + responseMessage.StatusCode); + } + } + } + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs new file mode 100644 index 00000000..cd95e937 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs @@ -0,0 +1,26 @@ +using Microsoft.Extensions.Hosting; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; + +namespace EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp +{ + public class ConsoleTestAppHostedService : IHostedService + { + public async Task StartAsync(CancellationToken cancellationToken) + { + using (var application = AbpApplicationFactory.Create()) + { + application.Initialize(); + + var demo = application.ServiceProvider.GetRequiredService(); + await demo.RunAsync(); + + application.Shutdown(); + } + } + + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; + } +} diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp.csproj b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp.csproj new file mode 100644 index 00000000..8d97fa66 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp.csproj @@ -0,0 +1,26 @@ + + + + Exe + netcoreapp3.1 + EasyAbp.EShop.Plugins.StoreApproval + + + + + + + + + + + PreserveNewest + Always + + + + + + + + diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp/Program.cs b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp/Program.cs new file mode 100644 index 00000000..24e88dd5 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp/Program.cs @@ -0,0 +1,21 @@ +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +namespace EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp +{ + class Program + { + static async Task Main(string[] args) + { + await CreateHostBuilder(args).RunConsoleAsync(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureServices((hostContext, services) => + { + services.AddHostedService(); + }); + } +} diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp/StoreApprovalConsoleApiClientModule.cs b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp/StoreApprovalConsoleApiClientModule.cs new file mode 100644 index 00000000..850afaeb --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp/StoreApprovalConsoleApiClientModule.cs @@ -0,0 +1,14 @@ +using Volo.Abp.Http.Client.IdentityModel; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Plugins.StoreApproval +{ + [DependsOn( + typeof(StoreApprovalHttpApiClientModule), + typeof(AbpHttpClientIdentityModelModule) + )] + public class StoreApprovalConsoleApiClientModule : AbpModule + { + + } +} diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp/appsettings.json b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp/appsettings.json new file mode 100644 index 00000000..a505774e --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.HttpApi.Client.ConsoleTestApp/appsettings.json @@ -0,0 +1,21 @@ +{ + "RemoteServices": { + "Default": { + "BaseUrl": "https://localhost:44339/" + }, + "StoreApproval": { + "BaseUrl": "https://localhost:44383/" + } + }, + "IdentityClients": { + "Default": { + "GrantType": "password", + "ClientId": "StoreApproval_ConsoleTestApp", + "ClientSecret": "1q2w3e*", + "UserName": "admin", + "UserPassword": "1q2w3E*", + "Authority": "https://localhost:44339/", + "Scope": "StoreApproval" + } + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests.csproj b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests.csproj new file mode 100644 index 00000000..2c28533c --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests.csproj @@ -0,0 +1,17 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Plugins.StoreApproval + + + + + + + + + + diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests/FodyWeavers.xml b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests/FodyWeavers.xml new file mode 100644 index 00000000..bd7fba1b --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests/FodyWeavers.xsd b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests/MongoDB/MongoDbFixture.cs b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests/MongoDB/MongoDbFixture.cs new file mode 100644 index 00000000..844fedd6 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests/MongoDB/MongoDbFixture.cs @@ -0,0 +1,22 @@ +using System; +using Mongo2Go; + +namespace EasyAbp.EShop.Plugins.StoreApproval.MongoDB +{ + public class MongoDbFixture : IDisposable + { + private static readonly MongoDbRunner MongoDbRunner; + public static readonly string ConnectionString; + + static MongoDbFixture() + { + MongoDbRunner = MongoDbRunner.Start(); + ConnectionString = MongoDbRunner.ConnectionString; + } + + public void Dispose() + { + MongoDbRunner?.Dispose(); + } + } +} diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests/MongoDB/MongoTestCollection.cs b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests/MongoDB/MongoTestCollection.cs new file mode 100644 index 00000000..a9c4161e --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests/MongoDB/MongoTestCollection.cs @@ -0,0 +1,10 @@ +using Xunit; + +namespace EasyAbp.EShop.Plugins.StoreApproval.MongoDB +{ + [CollectionDefinition(Name)] + public class MongoTestCollection : ICollectionFixture + { + public const string Name = "MongoDB Collection"; + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests/MongoDB/StoreApprovalMongoDbTestBase.cs b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests/MongoDB/StoreApprovalMongoDbTestBase.cs new file mode 100644 index 00000000..2a4ac974 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests/MongoDB/StoreApprovalMongoDbTestBase.cs @@ -0,0 +1,10 @@ +namespace EasyAbp.EShop.Plugins.StoreApproval.MongoDB +{ + /* This class can be used as a base class for MongoDB integration tests, + * while SampleRepository_Tests uses a different approach. + */ + public abstract class StoreApprovalMongoDbTestBase : StoreApprovalTestBase + { + + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests/MongoDB/StoreApprovalMongoDbTestModule.cs b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests/MongoDB/StoreApprovalMongoDbTestModule.cs new file mode 100644 index 00000000..a44846e4 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.MongoDB.Tests/MongoDB/StoreApprovalMongoDbTestModule.cs @@ -0,0 +1,25 @@ +using System; +using Volo.Abp.Data; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Plugins.StoreApproval.MongoDB +{ + [DependsOn( + typeof(StoreApprovalTestBaseModule), + typeof(StoreApprovalMongoDbModule) + )] + public class StoreApprovalMongoDbTestModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + var connectionString = MongoDbFixture.ConnectionString.EnsureEndsWith('/') + + "Db_" + + Guid.NewGuid().ToString("N"); + + Configure(options => + { + options.ConnectionStrings.Default = connectionString; + }); + } + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.TestBase/EasyAbp.EShop.Plugins.StoreApproval.TestBase.csproj b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.TestBase/EasyAbp.EShop.Plugins.StoreApproval.TestBase.csproj new file mode 100644 index 00000000..506c5a91 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.TestBase/EasyAbp.EShop.Plugins.StoreApproval.TestBase.csproj @@ -0,0 +1,23 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Plugins.StoreApproval + + + + + + + + + + + + + + + + diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.TestBase/FodyWeavers.xml b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.TestBase/FodyWeavers.xml new file mode 100644 index 00000000..bd7fba1b --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.TestBase/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.TestBase/FodyWeavers.xsd b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.TestBase/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.TestBase/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.TestBase/Security/FakeCurrentPrincipalAccessor.cs b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.TestBase/Security/FakeCurrentPrincipalAccessor.cs new file mode 100644 index 00000000..8d7534f3 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.TestBase/Security/FakeCurrentPrincipalAccessor.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; +using System.Security.Claims; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Security.Claims; + +namespace EasyAbp.EShop.Plugins.StoreApproval.Security +{ + [Dependency(ReplaceServices = true)] + public class FakeCurrentPrincipalAccessor : ThreadCurrentPrincipalAccessor + { + protected override ClaimsPrincipal GetClaimsPrincipal() + { + return GetPrincipal(); + } + + private ClaimsPrincipal _principal; + + private ClaimsPrincipal GetPrincipal() + { + if (_principal == null) + { + lock (this) + { + if (_principal == null) + { + _principal = new ClaimsPrincipal( + new ClaimsIdentity( + new List + { + new Claim(AbpClaimTypes.UserId,"2e701e62-0953-4dd3-910b-dc6cc93ccb0d"), + new Claim(AbpClaimTypes.UserName,"admin"), + new Claim(AbpClaimTypes.Email,"admin@abp.io") + } + ) + ); + } + } + } + + return _principal; + } + } +} diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.TestBase/StoreApprovalDataSeedContributor.cs b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.TestBase/StoreApprovalDataSeedContributor.cs new file mode 100644 index 00000000..47ddeb77 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.TestBase/StoreApprovalDataSeedContributor.cs @@ -0,0 +1,27 @@ +using System.Threading.Tasks; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Guids; + +namespace EasyAbp.EShop.Plugins.StoreApproval +{ + public class StoreApprovalDataSeedContributor : IDataSeedContributor, ITransientDependency + { + private readonly IGuidGenerator _guidGenerator; + + public StoreApprovalDataSeedContributor( + IGuidGenerator guidGenerator) + { + _guidGenerator = guidGenerator; + } + + public Task SeedAsync(DataSeedContext context) + { + /* Instead of returning the Task.CompletedTask, you can insert your test data + * at this point! + */ + + return Task.CompletedTask; + } + } +} \ No newline at end of file diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.TestBase/StoreApprovalTestBase.cs b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.TestBase/StoreApprovalTestBase.cs new file mode 100644 index 00000000..e2861157 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.TestBase/StoreApprovalTestBase.cs @@ -0,0 +1,60 @@ +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; +using Volo.Abp.Modularity; +using Volo.Abp.Uow; +using Volo.Abp.Testing; + +namespace EasyAbp.EShop.Plugins.StoreApproval +{ + /* All test classes are derived from this class, directly or indirectly. */ + public abstract class StoreApprovalTestBase : AbpIntegratedTest + where TStartupModule : IAbpModule + { + protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options) + { + options.UseAutofac(); + } + + protected virtual Task WithUnitOfWorkAsync(Func func) + { + return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); + } + + protected virtual async Task WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, Func action) + { + using (var scope = ServiceProvider.CreateScope()) + { + var uowManager = scope.ServiceProvider.GetRequiredService(); + + using (var uow = uowManager.Begin(options)) + { + await action(); + + await uow.CompleteAsync(); + } + } + } + + protected virtual Task WithUnitOfWorkAsync(Func> func) + { + return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); + } + + protected virtual async Task WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, Func> func) + { + using (var scope = ServiceProvider.CreateScope()) + { + var uowManager = scope.ServiceProvider.GetRequiredService(); + + using (var uow = uowManager.Begin(options)) + { + var result = await func(); + await uow.CompleteAsync(); + return result; + } + } + } + } +} diff --git a/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.TestBase/StoreApprovalTestBaseModule.cs b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.TestBase/StoreApprovalTestBaseModule.cs new file mode 100644 index 00000000..82e41262 --- /dev/null +++ b/plugins/StoreApproval/test/EasyAbp.EShop.Plugins.StoreApproval.TestBase/StoreApprovalTestBaseModule.cs @@ -0,0 +1,42 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; +using Volo.Abp.Authorization; +using Volo.Abp.Autofac; +using Volo.Abp.Data; +using Volo.Abp.Modularity; +using Volo.Abp.Threading; + +namespace EasyAbp.EShop.Plugins.StoreApproval +{ + [DependsOn( + typeof(AbpAutofacModule), + typeof(AbpTestBaseModule), + typeof(AbpAuthorizationModule), + typeof(StoreApprovalDomainModule) + )] + public class StoreApprovalTestBaseModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddAlwaysAllowAuthorization(); + } + + public override void OnApplicationInitialization(ApplicationInitializationContext context) + { + SeedTestData(context); + } + + private static void SeedTestData(ApplicationInitializationContext context) + { + AsyncHelper.RunSync(async () => + { + using (var scope = context.ServiceProvider.CreateScope()) + { + await scope.ServiceProvider + .GetRequiredService() + .SeedAsync(); + } + }); + } + } +} diff --git a/samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSample.Application.Contracts.csproj b/samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSample.Application.Contracts.csproj index 105795fc..d13ecac9 100644 --- a/samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSample.Application.Contracts.csproj +++ b/samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSample.Application.Contracts.csproj @@ -16,12 +16,12 @@ - - - - - - + + + + + + diff --git a/samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSample.Application.csproj b/samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSample.Application.csproj index 2bbb5c1f..516c26df 100644 --- a/samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSample.Application.csproj +++ b/samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSample.Application.csproj @@ -17,11 +17,11 @@ - - - - - + + + + + diff --git a/samples/EShopSample/aspnet-core/src/EShopSample.DbMigrator/EShopSample.DbMigrator.csproj b/samples/EShopSample/aspnet-core/src/EShopSample.DbMigrator/EShopSample.DbMigrator.csproj index d31831c4..215f4e96 100644 --- a/samples/EShopSample/aspnet-core/src/EShopSample.DbMigrator/EShopSample.DbMigrator.csproj +++ b/samples/EShopSample/aspnet-core/src/EShopSample.DbMigrator/EShopSample.DbMigrator.csproj @@ -19,14 +19,14 @@
- + - + diff --git a/samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSample.Domain.Shared.csproj b/samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSample.Domain.Shared.csproj index 1e97397c..f7027a6e 100644 --- a/samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSample.Domain.Shared.csproj +++ b/samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSample.Domain.Shared.csproj @@ -11,14 +11,14 @@ - - - - - - - - + + + + + + + + diff --git a/samples/EShopSample/aspnet-core/src/EShopSample.Domain/EShopSample.Domain.csproj b/samples/EShopSample/aspnet-core/src/EShopSample.Domain/EShopSample.Domain.csproj index 48305783..5a54b2c0 100644 --- a/samples/EShopSample/aspnet-core/src/EShopSample.Domain/EShopSample.Domain.csproj +++ b/samples/EShopSample/aspnet-core/src/EShopSample.Domain/EShopSample.Domain.csproj @@ -17,15 +17,15 @@ - - - - - - - - - + + + + + + + + +
diff --git a/samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore/EShopSample.EntityFrameworkCore.csproj b/samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore/EShopSample.EntityFrameworkCore.csproj index 2d064f25..a5300360 100644 --- a/samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore/EShopSample.EntityFrameworkCore.csproj +++ b/samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore/EShopSample.EntityFrameworkCore.csproj @@ -13,15 +13,15 @@ - - - - - - - - - + + + + + + + + + diff --git a/samples/EShopSample/aspnet-core/src/EShopSample.HttpApi.Client/EShopSample.HttpApi.Client.csproj b/samples/EShopSample/aspnet-core/src/EShopSample.HttpApi.Client/EShopSample.HttpApi.Client.csproj index d26b7316..bf0000d1 100644 --- a/samples/EShopSample/aspnet-core/src/EShopSample.HttpApi.Client/EShopSample.HttpApi.Client.csproj +++ b/samples/EShopSample/aspnet-core/src/EShopSample.HttpApi.Client/EShopSample.HttpApi.Client.csproj @@ -16,11 +16,11 @@ - - - - - + + + + + diff --git a/samples/EShopSample/aspnet-core/src/EShopSample.HttpApi/EShopSample.HttpApi.csproj b/samples/EShopSample/aspnet-core/src/EShopSample.HttpApi/EShopSample.HttpApi.csproj index 39e95391..6e525a93 100644 --- a/samples/EShopSample/aspnet-core/src/EShopSample.HttpApi/EShopSample.HttpApi.csproj +++ b/samples/EShopSample/aspnet-core/src/EShopSample.HttpApi/EShopSample.HttpApi.csproj @@ -16,11 +16,11 @@ - - - - - + + + + + diff --git a/samples/EShopSample/aspnet-core/src/EShopSample.Web/EShopSample.Web.csproj b/samples/EShopSample/aspnet-core/src/EShopSample.Web/EShopSample.Web.csproj index 4be93c09..95ffa914 100644 --- a/samples/EShopSample/aspnet-core/src/EShopSample.Web/EShopSample.Web.csproj +++ b/samples/EShopSample/aspnet-core/src/EShopSample.Web/EShopSample.Web.csproj @@ -48,14 +48,14 @@ - - - - - - - - + + + + + + + +
diff --git a/samples/EShopSample/aspnet-core/test/EShopSample.HttpApi.Client.ConsoleTestApp/EShopSample.HttpApi.Client.ConsoleTestApp.csproj b/samples/EShopSample/aspnet-core/test/EShopSample.HttpApi.Client.ConsoleTestApp/EShopSample.HttpApi.Client.ConsoleTestApp.csproj index 6b93e56b..f1b0c069 100644 --- a/samples/EShopSample/aspnet-core/test/EShopSample.HttpApi.Client.ConsoleTestApp/EShopSample.HttpApi.Client.ConsoleTestApp.csproj +++ b/samples/EShopSample/aspnet-core/test/EShopSample.HttpApi.Client.ConsoleTestApp/EShopSample.HttpApi.Client.ConsoleTestApp.csproj @@ -17,7 +17,7 @@
- + diff --git a/samples/EShopSample/aspnet-core/test/EShopSample.TestBase/EShopSample.TestBase.csproj b/samples/EShopSample/aspnet-core/test/EShopSample.TestBase/EShopSample.TestBase.csproj index 1b249c49..5d4c9e2b 100644 --- a/samples/EShopSample/aspnet-core/test/EShopSample.TestBase/EShopSample.TestBase.csproj +++ b/samples/EShopSample/aspnet-core/test/EShopSample.TestBase/EShopSample.TestBase.csproj @@ -8,9 +8,9 @@ - - - + + + diff --git a/samples/EShopSample/aspnet-core/test/EShopSample.Web.Tests/EShopSample.Web.Tests.csproj b/samples/EShopSample/aspnet-core/test/EShopSample.Web.Tests/EShopSample.Web.Tests.csproj index fbcb9041..6d023827 100644 --- a/samples/EShopSample/aspnet-core/test/EShopSample.Web.Tests/EShopSample.Web.Tests.csproj +++ b/samples/EShopSample/aspnet-core/test/EShopSample.Web.Tests/EShopSample.Web.Tests.csproj @@ -17,7 +17,7 @@ - +