diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/Authorization/OrdersPermissionDefinitionProvider.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/Authorization/OrdersPermissionDefinitionProvider.cs deleted file mode 100644 index ed97a8c8..00000000 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/Authorization/OrdersPermissionDefinitionProvider.cs +++ /dev/null @@ -1,19 +0,0 @@ -using EasyAbp.EShop.Orders.Localization; -using Volo.Abp.Authorization.Permissions; -using Volo.Abp.Localization; - -namespace EasyAbp.EShop.Orders.Authorization -{ - public class OrdersPermissionDefinitionProvider : PermissionDefinitionProvider - { - public override void Define(IPermissionDefinitionContext context) - { - //var moduleGroup = context.AddGroup(OrdersPermissions.GroupName, L("Permission:Orders")); - } - - private static LocalizableString L(string name) - { - return LocalizableString.Create(name); - } - } -} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/Authorization/OrdersPermissions.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/Authorization/OrdersPermissions.cs deleted file mode 100644 index 325d2131..00000000 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/Authorization/OrdersPermissions.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Volo.Abp.Reflection; - -namespace EasyAbp.EShop.Orders.Authorization -{ - public class OrdersPermissions - { - public const string GroupName = "EasyAbp.EShop.Orders"; - - public static string[] GetAll() - { - return ReflectionHelper.GetPublicConstantsRecursively(typeof(OrdersPermissions)); - } - } -} \ No newline at end of file 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 e02d84d9..98b9b9a3 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 @@ -4,7 +4,7 @@ netstandard2.0 - EasyAbp.EShop.Orders + diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Authorization/OrdersPermissionDefinitionProvider.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Authorization/OrdersPermissionDefinitionProvider.cs new file mode 100644 index 00000000..1ff68969 --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Authorization/OrdersPermissionDefinitionProvider.cs @@ -0,0 +1,27 @@ +using EasyAbp.EShop.Orders.Localization; +using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Localization; + +namespace EasyAbp.EShop.Orders.Authorization +{ + public class OrdersPermissionDefinitionProvider : PermissionDefinitionProvider + { + public override void Define(IPermissionDefinitionContext context) + { + var moduleGroup = context.AddGroup(OrdersPermissions.GroupName, L("Permission:Orders")); + + var order = moduleGroup.AddPermission(OrdersPermissions.Orders.Default, L("Permission:Product")); + order.AddChild(OrdersPermissions.Orders.Manage, L("Permission:Manage")); + order.AddChild(OrdersPermissions.Orders.CrossStore, L("Permission:CrossStore")); + order.AddChild(OrdersPermissions.Orders.Create, L("Permission:Create")); + order.AddChild(OrdersPermissions.Orders.ConfirmReceipt, L("Permission:ConfirmReceipt")); + order.AddChild(OrdersPermissions.Orders.RequestCancellation, L("Permission:RequestCancellation")); + order.AddChild(OrdersPermissions.Orders.Cancel, L("Permission:Cancel")); + } + + private static LocalizableString L(string name) + { + return LocalizableString.Create(name); + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Authorization/OrdersPermissions.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Authorization/OrdersPermissions.cs new file mode 100644 index 00000000..ebf83b8a --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Authorization/OrdersPermissions.cs @@ -0,0 +1,25 @@ +using Volo.Abp.Reflection; + +namespace EasyAbp.EShop.Orders.Authorization +{ + public class OrdersPermissions + { + public const string GroupName = "EasyAbp.EShop.Orders"; + + public class Orders + { + public const string Default = GroupName + ".Order"; + public const string Manage = Default + ".Manage"; + public const string CrossStore = Default + ".CrossStore"; + public const string Create = Default + ".Create"; + public const string ConfirmReceipt = Default + ".ConfirmReceipt"; + public const string RequestCancellation = Default + ".RequestCancellation"; + public const string Cancel = Default + ".Cancel"; + } + + public static string[] GetAll() + { + return ReflectionHelper.GetPublicConstantsRecursively(typeof(OrdersPermissions)); + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EShopOrdersApplicationContractsModule.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/EShopOrdersApplicationContractsModule.cs similarity index 100% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EShopOrdersApplicationContractsModule.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/EShopOrdersApplicationContractsModule.cs diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/Dtos/CreateOrderDto.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/Dtos/CreateOrderDto.cs new file mode 100644 index 00000000..1c842875 --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/Dtos/CreateOrderDto.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Linq; + +namespace EasyAbp.EShop.Orders.Orders.Dtos +{ + public class CreateOrderDto : IValidatableObject + { + [DisplayName("OrderStoreId")] + public Guid StoreId { get; set; } + + [DisplayName("OrderCustomerRemark")] + public string CustomerRemark { get; set; } + + [DisplayName("OrderLine")] + public List OrderLines { get; set; } + + [DisplayName("OrderExtraProperties")] + public Dictionary ExtraProperties { get; set; } + + public IEnumerable Validate(ValidationContext validationContext) + { + if (OrderLines.Select(orderLine => orderLine.Quantity).Sum() <= 0) + { + yield return new ValidationResult( + "Total quantity should be greater than 0.", + new[] { "OrderLines" } + ); + } + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/Dtos/CreateOrderLineDto.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/Dtos/CreateOrderLineDto.cs new file mode 100644 index 00000000..5cd072f4 --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/Dtos/CreateOrderLineDto.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; + +namespace EasyAbp.EShop.Orders.Orders.Dtos +{ + public class CreateOrderLineDto + { + [DisplayName("OrderLineProductId")] + public Guid ProductId { get; set; } + + [DisplayName("OrderLineProductSkuId")] + public Guid ProductSkuId { get; set; } + + [DisplayName("OrderLineQuantity")] + public int Quantity { get; set; } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/Dtos/GetOrderListDto.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/Dtos/GetOrderListDto.cs new file mode 100644 index 00000000..359040e6 --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/Dtos/GetOrderListDto.cs @@ -0,0 +1,12 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace EasyAbp.EShop.Orders.Orders.Dtos +{ + public class GetOrderListDto : PagedAndSortedResultRequestDto + { + public Guid? StoreId { get; set; } + + public Guid? CustomerUserId { get; set; } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/Dtos/OrderDto.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/Dtos/OrderDto.cs new file mode 100644 index 00000000..afec4764 --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/Dtos/OrderDto.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using Volo.Abp.Application.Dtos; + +namespace EasyAbp.EShop.Orders.Orders.Dtos +{ + public class OrderDto : ExtensibleFullAuditedEntityDto + { + public Guid StoreId { get; set; } + + public Guid CustomerUserId { get; set; } + + public OrderStatus OrderStatus { get; set; } + + public string Currency { get; set; } + + public decimal ProductTotalPrice { get; set; } + + public decimal TotalDiscount { get; set; } + + public decimal TotalPrice { get; set; } + + public decimal RefundedAmount { get; set; } + + public string CustomerRemark { get; set; } + + public string StaffRemark { get; set; } + + public DateTime? PaidTime { get; set; } + + public DateTime? CompletionTime { get; set; } + + public DateTime? CancelledTime { get; set; } + + public DateTime? ReducedInventoryAfterPlacingTime { get; set; } + + public DateTime? ReducedInventoryAfterPaymentTime { get; set; } + + public List OrderLines { get; set; } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/Dtos/OrderLineDto.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/Dtos/OrderLineDto.cs new file mode 100644 index 00000000..a6c52c92 --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/Dtos/OrderLineDto.cs @@ -0,0 +1,32 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace EasyAbp.EShop.Orders.Orders.Dtos +{ + public class OrderLineDto : FullAuditedEntityDto + { + public Guid ProductId { get; set; } + + public Guid ProductSkuId { get; set; } + + public DateTime ProductModificationTime { get; set; } + + public DateTime ProductDetailModificationTime { get; set; } + + public string ProductName { get; set; } + + public string SkuDescription { get; set; } + + public string MediaResources { get; set; } + + public string Currency { get; set; } + + public decimal UnitPrice { get; set; } + + public decimal TotalPrice { get; set; } + + public decimal TotalDiscount { get; set; } + + public int Quantity { get; set; } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/IOrderAppService.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/IOrderAppService.cs new file mode 100644 index 00000000..38d178e9 --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application.Contracts/EasyAbp/EShop/Orders/Orders/IOrderAppService.cs @@ -0,0 +1,18 @@ +using System; +using EasyAbp.EShop.Orders.Orders.Dtos; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; + +namespace EasyAbp.EShop.Orders.Orders +{ + public interface IOrderAppService : + ICrudAppService< + OrderDto, + Guid, + GetOrderListDto, + CreateOrderDto, + CreateOrderDto> + { + + } +} \ No newline at end of file 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 9ca8f2d7..791c9f40 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 @@ -4,12 +4,13 @@ netstandard2.0 - EasyAbp.EShop.Orders + + diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EShopOrdersApplicationModule.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/EShopOrdersApplicationModule.cs similarity index 84% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EShopOrdersApplicationModule.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/EShopOrdersApplicationModule.cs index 75703202..444cd40d 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EShopOrdersApplicationModule.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/EShopOrdersApplicationModule.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.DependencyInjection; +using EasyAbp.EShop.Products; +using Microsoft.Extensions.DependencyInjection; using Volo.Abp.AutoMapper; using Volo.Abp.Modularity; using Volo.Abp.Application; @@ -8,6 +9,7 @@ namespace EasyAbp.EShop.Orders [DependsOn( typeof(EShopOrdersDomainModule), typeof(EShopOrdersApplicationContractsModule), + typeof(EShopProductsApplicationContractsModule), typeof(AbpDddApplicationModule), typeof(AbpAutoMapperModule) )] 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 new file mode 100644 index 00000000..efbbd6b1 --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/INewOrderGenerator.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using EasyAbp.EShop.Orders.Orders.Dtos; +using EasyAbp.EShop.Products.Products.Dtos; + +namespace EasyAbp.EShop.Orders.Orders +{ + public interface INewOrderGenerator + { + 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/NewOrderGenerator.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/NewOrderGenerator.cs new file mode 100644 index 00000000..05cb580d --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/NewOrderGenerator.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using EasyAbp.EShop.Orders.Orders.Dtos; +using EasyAbp.EShop.Products.Products.Dtos; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Guids; +using Volo.Abp.Json; +using Volo.Abp.MultiTenancy; +using Volo.Abp.Users; + +namespace EasyAbp.EShop.Orders.Orders +{ + public class NewOrderGenerator : INewOrderGenerator, ITransientDependency + { + private readonly IGuidGenerator _guidGenerator; + private readonly ICurrentTenant _currentTenant; + private readonly ICurrentUser _currentUser; + private readonly IJsonSerializer _jsonSerializer; + + public NewOrderGenerator( + IGuidGenerator guidGenerator, + ICurrentTenant currentTenant, + ICurrentUser currentUser, + IJsonSerializer jsonSerializer) + { + _guidGenerator = guidGenerator; + _currentTenant = currentTenant; + _currentUser = currentUser; + _jsonSerializer = jsonSerializer; + } + + public virtual async Task GenerateAsync(CreateOrderDto input, Dictionary productDict) + { + var orderLines = new List(); + + foreach (var orderLine in input.OrderLines) + { + orderLines.Add(await GenerateNewOrderLineAsync(orderLine, productDict)); + } + + var productTotalPrice = orderLines.Select(x => x.TotalPrice).Sum(); + + var order = new Order( + id: _guidGenerator.Create(), + tenantId: _currentTenant.Id, + storeId: input.StoreId, + customerUserId: _currentUser.GetId(), + currency: await GetStoreCurrencyAsync(input.StoreId), + productTotalPrice: productTotalPrice, + totalDiscount: orderLines.Select(x => x.TotalDiscount).Sum(), + totalPrice: productTotalPrice, + refundedAmount: 0, + customerRemark: input.CustomerRemark); + + order.SetOrderLines(orderLines); + + return order; + } + + protected virtual async Task GenerateNewOrderLineAsync(CreateOrderLineDto input, Dictionary productDict) + { + var product = productDict[input.ProductId]; + var productSku = product.ProductSkus.Single(x => x.Id == input.ProductSkuId); + + return new OrderLine( + id: _guidGenerator.Create(), + productId: product.Id, + productSkuId: productSku.Id, + productModificationTime: product.LastModificationTime ?? product.CreationTime, + productDetailModificationTime: productSku.LastModificationTime ?? productSku.CreationTime, + productName: product.DisplayName, + skuDescription: await GenerateSkuDescriptionAsync(product, productSku), + mediaResources: product.MediaResources, + currency: productSku.Currency, + unitPrice: productSku.Price, + totalPrice: productSku.Price * input.Quantity, + totalDiscount: 0, + quantity: input.Quantity + ); + } + + protected virtual Task GenerateSkuDescriptionAsync(ProductDto product, ProductSkuDto productSku) + { + var attributeOptionIds = _jsonSerializer.Deserialize(productSku.SerializedAttributeOptionIds); + + var names = new Collection(); + + foreach (var attributeOptionId in attributeOptionIds) + { + names.Add(product.ProductAttributes.SelectMany( + attribute => attribute.ProductAttributeOptions.Where(option => option.Id == attributeOptionId), + (attribute, option) => new [] {attribute.DisplayName, option.DisplayName}).Single()); + } + + return Task.FromResult(_jsonSerializer.Serialize(names)); + } + + protected virtual Task GetStoreCurrencyAsync(Guid storeId) + { + // Todo: Get real store currency configuration. + return Task.FromResult("CNY"); + } + } +} \ No newline at end of file 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 new file mode 100644 index 00000000..13c8ce9d --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/OrderAppService.cs @@ -0,0 +1,141 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using EasyAbp.EShop.Orders.Authorization; +using EasyAbp.EShop.Orders.Orders.Dtos; +using EasyAbp.EShop.Products.Products; +using EasyAbp.EShop.Products.Products.Dtos; +using Microsoft.AspNetCore.Authorization; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; +using Volo.Abp.Json; +using Volo.Abp.Users; + +namespace EasyAbp.EShop.Orders.Orders +{ + [Authorize] + public class OrderAppService : CrudAppService, + IOrderAppService + { + protected override string CreatePolicyName { get; set; } = OrdersPermissions.Orders.Create; + protected override string GetPolicyName { get; set; } = OrdersPermissions.Orders.Default; + protected override string GetListPolicyName { get; set; } = OrdersPermissions.Orders.Default; + + private readonly INewOrderGenerator _newOrderGenerator; + private readonly IProductAppService _productAppService; + private readonly IOrderDiscountManager _orderDiscountManager; + private readonly IOrderRepository _repository; + + public OrderAppService( + INewOrderGenerator newOrderGenerator, + IProductAppService productAppService, + IOrderDiscountManager orderDiscountManager, + IOrderRepository repository) : base(repository) + { + _newOrderGenerator = newOrderGenerator; + _productAppService = productAppService; + _orderDiscountManager = orderDiscountManager; + _repository = repository; + } + + protected override IQueryable CreateFilteredQuery(GetOrderListDto input) + { + var query = base.CreateFilteredQuery(input); + + if (input.StoreId.HasValue) + { + query = query.Where(x => x.StoreId == input.StoreId.Value); + } + + if (input.CustomerUserId.HasValue) + { + query = query.Where(x => x.CustomerUserId == input.CustomerUserId.Value); + } + + return query; + } + + public override async Task> GetListAsync(GetOrderListDto input) + { + if (input.CustomerUserId != CurrentUser.GetId()) + { + await AuthorizationService.IsGrantedAsync(OrdersPermissions.Orders.Manage); + + if (input.StoreId.HasValue) + { + // Todo: Check if current user is an admin of the store. + } + else + { + await AuthorizationService.IsGrantedAsync(OrdersPermissions.Orders.CrossStore); + } + } + + return await base.GetListAsync(input); + } + + public override async Task GetAsync(Guid id) + { + await CheckGetPolicyAsync(); + + var order = await GetEntityByIdAsync(id); + + if (order.CustomerUserId != CurrentUser.GetId()) + { + await AuthorizationService.IsGrantedAsync(OrdersPermissions.Orders.Manage); + + // Todo: Check if current user is an admin of the store. + } + + return MapToGetOutputDto(order); + } + + public override async Task CreateAsync(CreateOrderDto input) + { + await CheckCreatePolicyAsync(); + + // Todo: Check if the store is open. + + var productDict = await GetProductDictionaryAsync(input.OrderLines.Select(dto => dto.ProductId).ToList(), + input.StoreId); + + // Todo: Check if the product is purchasable. + + var order = await _newOrderGenerator.GenerateAsync(input, productDict); + + await _orderDiscountManager.DiscountAsync(order, input.ExtraProperties); + + await Repository.InsertAsync(order, autoSave: true); + + return MapToGetOutputDto(order); + } + + protected virtual async Task> GetProductDictionaryAsync( + IEnumerable productIds, Guid storeId) + { + var dict = new Dictionary(); + + foreach (var productId in productIds) + { + dict.Add(productId, await _productAppService.GetAsync(productId, storeId)); + } + + return dict; + } + + [RemoteService(false)] + public override Task UpdateAsync(Guid id, CreateOrderDto input) + { + throw new NotSupportedException(); + } + + [RemoteService(false)] + public override Task DeleteAsync(Guid id) + { + throw new NotSupportedException(); + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/OrdersAppService.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/OrdersAppService.cs similarity index 100% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/OrdersAppService.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/OrdersAppService.cs diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/OrdersApplicationAutoMapperProfile.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/OrdersApplicationAutoMapperProfile.cs similarity index 68% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/OrdersApplicationAutoMapperProfile.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/OrdersApplicationAutoMapperProfile.cs index 3d121d82..42e8fa7f 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/OrdersApplicationAutoMapperProfile.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/OrdersApplicationAutoMapperProfile.cs @@ -1,4 +1,6 @@ -using AutoMapper; +using EasyAbp.EShop.Orders.Orders; +using EasyAbp.EShop.Orders.Orders.Dtos; +using AutoMapper; namespace EasyAbp.EShop.Orders { @@ -9,6 +11,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(); } } -} \ No newline at end of file +} 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 6c11b44c..356d5998 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 @@ -4,7 +4,7 @@ netstandard2.0 - EasyAbp.EShop.Orders + @@ -12,8 +12,8 @@ - - + + diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EShopOrdersDomainSharedModule.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/EShopOrdersDomainSharedModule.cs similarity index 84% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EShopOrdersDomainSharedModule.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/EShopOrdersDomainSharedModule.cs index d9c2d08f..9b405506 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EShopOrdersDomainSharedModule.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/EShopOrdersDomainSharedModule.cs @@ -17,7 +17,7 @@ namespace EasyAbp.EShop.Orders { Configure(options => { - options.FileSets.AddEmbedded("EasyAbp.EShop.Orders"); + options.FileSets.AddEmbedded(); }); Configure(options => @@ -25,12 +25,12 @@ namespace EasyAbp.EShop.Orders options.Resources .Add("en") .AddBaseTypes(typeof(AbpValidationResource)) - .AddVirtualJson("/Localization/Orders"); + .AddVirtualJson("EasyAbp/EShop/Orders/Localization/Orders"); }); Configure(options => { - options.MapCodeNamespace("Orders", typeof(OrdersResource)); + options.MapCodeNamespace("EasyAbp.EShop.Orders", typeof(OrdersResource)); }); } } diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/cs.json b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/cs.json new file mode 100644 index 00000000..609ae350 --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/cs.json @@ -0,0 +1,28 @@ +{ + "culture": "cs", + "texts": { + "Menu:Order": "MenuOrder", + "Order": "Order", + "OrderStoreId": "OrderStoreId", + "OrderCustomerUserId": "OrderCustomerUserId", + "OrderOrderStatus": "OrderOrderStatus", + "OrderCurrency": "OrderCurrency", + "OrderProductTotalPrice": "OrderProductTotalPrice", + "OrderTotalDiscount": "OrderTotalDiscount", + "OrderTotalPrice": "OrderTotalPrice", + "OrderRefundedAmount": "OrderRefundedAmount", + "OrderCustomerRemark": "OrderCustomerRemark", + "OrderStaffRemark": "OrderStaffRemark", + "OrderPaidTime": "OrderPaidTime", + "OrderCompletionTime": "OrderCompletionTime", + "OrderCancelledTime": "OrderCancelledTime", + "OrderLine": "OrderLine", + "OrderLineProductId": "OrderLineProductId", + "OrderLineProductSkuId": "OrderLineProductSkuId", + "OrderLineQuantity": "OrderLineQuantity", + "CreateOrder": "CreateOrder", + "EditOrder": "EditOrder", + "OrderDeletionConfirmationMessage": "Are you sure to delete the order {0}?", + "SuccessfullyDeleted": "Successfully deleted" + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/en.json b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/en.json new file mode 100644 index 00000000..4577da06 --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/en.json @@ -0,0 +1,29 @@ +{ + "culture": "en", + "texts": { + "ManageYourProfile": "Manage your profile", + "Menu:Order": "MenuOrder", + "Order": "Order", + "OrderStoreId": "OrderStoreId", + "OrderCustomerUserId": "OrderCustomerUserId", + "OrderOrderStatus": "OrderOrderStatus", + "OrderCurrency": "OrderCurrency", + "OrderProductTotalPrice": "OrderProductTotalPrice", + "OrderTotalDiscount": "OrderTotalDiscount", + "OrderTotalPrice": "OrderTotalPrice", + "OrderRefundedAmount": "OrderRefundedAmount", + "OrderCustomerRemark": "OrderCustomerRemark", + "OrderStaffRemark": "OrderStaffRemark", + "OrderPaidTime": "OrderPaidTime", + "OrderCompletionTime": "OrderCompletionTime", + "OrderCancelledTime": "OrderCancelledTime", + "OrderLine": "OrderLine", + "OrderLineProductId": "OrderLineProductId", + "OrderLineProductSkuId": "OrderLineProductSkuId", + "OrderLineQuantity": "OrderLineQuantity", + "CreateOrder": "CreateOrder", + "EditOrder": "EditOrder", + "OrderDeletionConfirmationMessage": "Are you sure to delete the order {0}?", + "SuccessfullyDeleted": "Successfully deleted" + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/pl.json b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/pl.json new file mode 100644 index 00000000..7728ac9a --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/pl.json @@ -0,0 +1,28 @@ +{ + "culture": "pl", + "texts": { + "Menu:Order": "MenuOrder", + "Order": "Order", + "OrderStoreId": "OrderStoreId", + "OrderCustomerUserId": "OrderCustomerUserId", + "OrderOrderStatus": "OrderOrderStatus", + "OrderCurrency": "OrderCurrency", + "OrderProductTotalPrice": "OrderProductTotalPrice", + "OrderTotalDiscount": "OrderTotalDiscount", + "OrderTotalPrice": "OrderTotalPrice", + "OrderRefundedAmount": "OrderRefundedAmount", + "OrderCustomerRemark": "OrderCustomerRemark", + "OrderStaffRemark": "OrderStaffRemark", + "OrderPaidTime": "OrderPaidTime", + "OrderCompletionTime": "OrderCompletionTime", + "OrderCancelledTime": "OrderCancelledTime", + "OrderLine": "OrderLine", + "OrderLineProductId": "OrderLineProductId", + "OrderLineProductSkuId": "OrderLineProductSkuId", + "OrderLineQuantity": "OrderLineQuantity", + "CreateOrder": "CreateOrder", + "EditOrder": "EditOrder", + "OrderDeletionConfirmationMessage": "Are you sure to delete the order {0}?", + "SuccessfullyDeleted": "Successfully deleted" + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/pt-BR.json b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/pt-BR.json new file mode 100644 index 00000000..f6325e7f --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/pt-BR.json @@ -0,0 +1,28 @@ +{ + "culture": "pt-BR", + "texts": { + "Menu:Order": "MenuOrder", + "Order": "Order", + "OrderStoreId": "OrderStoreId", + "OrderCustomerUserId": "OrderCustomerUserId", + "OrderOrderStatus": "OrderOrderStatus", + "OrderCurrency": "OrderCurrency", + "OrderProductTotalPrice": "OrderProductTotalPrice", + "OrderTotalDiscount": "OrderTotalDiscount", + "OrderTotalPrice": "OrderTotalPrice", + "OrderRefundedAmount": "OrderRefundedAmount", + "OrderCustomerRemark": "OrderCustomerRemark", + "OrderStaffRemark": "OrderStaffRemark", + "OrderPaidTime": "OrderPaidTime", + "OrderCompletionTime": "OrderCompletionTime", + "OrderCancelledTime": "OrderCancelledTime", + "OrderLine": "OrderLine", + "OrderLineProductId": "OrderLineProductId", + "OrderLineProductSkuId": "OrderLineProductSkuId", + "OrderLineQuantity": "OrderLineQuantity", + "CreateOrder": "CreateOrder", + "EditOrder": "EditOrder", + "OrderDeletionConfirmationMessage": "Are you sure to delete the order {0}?", + "SuccessfullyDeleted": "Successfully deleted" + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/sl.json b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/sl.json new file mode 100644 index 00000000..7038fb7f --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/sl.json @@ -0,0 +1,29 @@ +{ + "culture": "sl", + "texts": { + "ManageYourProfile": "Upravljajte svojim profilom", + "Menu:Order": "MenuOrder", + "Order": "Order", + "OrderStoreId": "OrderStoreId", + "OrderCustomerUserId": "OrderCustomerUserId", + "OrderOrderStatus": "OrderOrderStatus", + "OrderCurrency": "OrderCurrency", + "OrderProductTotalPrice": "OrderProductTotalPrice", + "OrderTotalDiscount": "OrderTotalDiscount", + "OrderTotalPrice": "OrderTotalPrice", + "OrderRefundedAmount": "OrderRefundedAmount", + "OrderCustomerRemark": "OrderCustomerRemark", + "OrderStaffRemark": "OrderStaffRemark", + "OrderPaidTime": "OrderPaidTime", + "OrderCompletionTime": "OrderCompletionTime", + "OrderCancelledTime": "OrderCancelledTime", + "OrderLine": "OrderLine", + "OrderLineProductId": "OrderLineProductId", + "OrderLineProductSkuId": "OrderLineProductSkuId", + "OrderLineQuantity": "OrderLineQuantity", + "CreateOrder": "CreateOrder", + "EditOrder": "EditOrder", + "OrderDeletionConfirmationMessage": "Are you sure to delete the order {0}?", + "SuccessfullyDeleted": "Successfully deleted" + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/tr.json b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/tr.json new file mode 100644 index 00000000..1ac717d7 --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/tr.json @@ -0,0 +1,29 @@ +{ + "culture": "tr", + "texts": { + "ManageYourProfile": "Profil y�netimi", + "Menu:Order": "MenuOrder", + "Order": "Order", + "OrderStoreId": "OrderStoreId", + "OrderCustomerUserId": "OrderCustomerUserId", + "OrderOrderStatus": "OrderOrderStatus", + "OrderCurrency": "OrderCurrency", + "OrderProductTotalPrice": "OrderProductTotalPrice", + "OrderTotalDiscount": "OrderTotalDiscount", + "OrderTotalPrice": "OrderTotalPrice", + "OrderRefundedAmount": "OrderRefundedAmount", + "OrderCustomerRemark": "OrderCustomerRemark", + "OrderStaffRemark": "OrderStaffRemark", + "OrderPaidTime": "OrderPaidTime", + "OrderCompletionTime": "OrderCompletionTime", + "OrderCancelledTime": "OrderCancelledTime", + "OrderLine": "OrderLine", + "OrderLineProductId": "OrderLineProductId", + "OrderLineProductSkuId": "OrderLineProductSkuId", + "OrderLineQuantity": "OrderLineQuantity", + "CreateOrder": "CreateOrder", + "EditOrder": "EditOrder", + "OrderDeletionConfirmationMessage": "Are you sure to delete the order {0}?", + "SuccessfullyDeleted": "Successfully deleted" + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/vi.json b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/vi.json new file mode 100644 index 00000000..f0ed7f2e --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/vi.json @@ -0,0 +1,28 @@ +{ + "culture": "vi", + "texts": { + "Menu:Order": "MenuOrder", + "Order": "Order", + "OrderStoreId": "OrderStoreId", + "OrderCustomerUserId": "OrderCustomerUserId", + "OrderOrderStatus": "OrderOrderStatus", + "OrderCurrency": "OrderCurrency", + "OrderProductTotalPrice": "OrderProductTotalPrice", + "OrderTotalDiscount": "OrderTotalDiscount", + "OrderTotalPrice": "OrderTotalPrice", + "OrderRefundedAmount": "OrderRefundedAmount", + "OrderCustomerRemark": "OrderCustomerRemark", + "OrderStaffRemark": "OrderStaffRemark", + "OrderPaidTime": "OrderPaidTime", + "OrderCompletionTime": "OrderCompletionTime", + "OrderCancelledTime": "OrderCancelledTime", + "OrderLine": "OrderLine", + "OrderLineProductId": "OrderLineProductId", + "OrderLineProductSkuId": "OrderLineProductSkuId", + "OrderLineQuantity": "OrderLineQuantity", + "CreateOrder": "CreateOrder", + "EditOrder": "EditOrder", + "OrderDeletionConfirmationMessage": "Are you sure to delete the order {0}?", + "SuccessfullyDeleted": "Successfully deleted" + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/zh-Hans.json b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/zh-Hans.json new file mode 100644 index 00000000..ddc9f9f4 --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/zh-Hans.json @@ -0,0 +1,29 @@ +{ + "culture": "zh-Hans", + "texts": { + "ManageYourProfile": "管理个人资料", + "Menu:Order": "MenuOrder", + "Order": "Order", + "OrderStoreId": "OrderStoreId", + "OrderCustomerUserId": "OrderCustomerUserId", + "OrderOrderStatus": "OrderOrderStatus", + "OrderCurrency": "OrderCurrency", + "OrderProductTotalPrice": "OrderProductTotalPrice", + "OrderTotalDiscount": "OrderTotalDiscount", + "OrderTotalPrice": "OrderTotalPrice", + "OrderRefundedAmount": "OrderRefundedAmount", + "OrderCustomerRemark": "OrderCustomerRemark", + "OrderStaffRemark": "OrderStaffRemark", + "OrderPaidTime": "OrderPaidTime", + "OrderCompletionTime": "OrderCompletionTime", + "OrderCancelledTime": "OrderCancelledTime", + "OrderLine": "OrderLine", + "OrderLineProductId": "OrderLineProductId", + "OrderLineProductSkuId": "OrderLineProductSkuId", + "OrderLineQuantity": "OrderLineQuantity", + "CreateOrder": "CreateOrder", + "EditOrder": "EditOrder", + "OrderDeletionConfirmationMessage": "Are you sure to delete the order {0}?", + "SuccessfullyDeleted": "Successfully deleted" + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/zh-Hant.json b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/zh-Hant.json new file mode 100644 index 00000000..7fee2e86 --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/zh-Hant.json @@ -0,0 +1,29 @@ +{ + "culture": "zh-Hant", + "texts": { + "ManageYourProfile": "管理個人資料", + "Menu:Order": "MenuOrder", + "Order": "Order", + "OrderStoreId": "OrderStoreId", + "OrderCustomerUserId": "OrderCustomerUserId", + "OrderOrderStatus": "OrderOrderStatus", + "OrderCurrency": "OrderCurrency", + "OrderProductTotalPrice": "OrderProductTotalPrice", + "OrderTotalDiscount": "OrderTotalDiscount", + "OrderTotalPrice": "OrderTotalPrice", + "OrderRefundedAmount": "OrderRefundedAmount", + "OrderCustomerRemark": "OrderCustomerRemark", + "OrderStaffRemark": "OrderStaffRemark", + "OrderPaidTime": "OrderPaidTime", + "OrderCompletionTime": "OrderCompletionTime", + "OrderCancelledTime": "OrderCancelledTime", + "OrderLine": "OrderLine", + "OrderLineProductId": "OrderLineProductId", + "OrderLineProductSkuId": "OrderLineProductSkuId", + "OrderLineQuantity": "OrderLineQuantity", + "CreateOrder": "CreateOrder", + "EditOrder": "EditOrder", + "OrderDeletionConfirmationMessage": "Are you sure to delete the order {0}?", + "SuccessfullyDeleted": "Successfully deleted" + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/OrdersResource.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/OrdersResource.cs similarity index 100% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/OrdersResource.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/OrdersResource.cs diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/OrderEto.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/OrderEto.cs new file mode 100644 index 00000000..a0f56d71 --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/OrderEto.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; + +namespace EasyAbp.EShop.Orders.Orders +{ + [Serializable] + public class OrderEto + { + public Guid Id { get; set; } + + public Guid StoreId { get; set; } + + public Guid CustomerUserId { get; set; } + + public OrderStatus OrderStatus { get; set; } + + public string Currency { get; set; } + + public decimal ProductTotalPrice { get; set; } + + public decimal TotalDiscount { get; set; } + + public decimal TotalPrice { get; set; } + + public decimal RefundedAmount { get; set; } + + public string CustomerRemark { get; set; } + + public string StaffRemark { get; set; } + + public DateTime? PaidTime { get; set; } + + public DateTime? CompletionTime { get; set; } + + public DateTime? CancelledTime { get; set; } + + public List OrderLines { get; set; } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/OrderLineEto.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/OrderLineEto.cs new file mode 100644 index 00000000..0a51c563 --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/OrderLineEto.cs @@ -0,0 +1,34 @@ +using System; + +namespace EasyAbp.EShop.Orders.Orders +{ + [Serializable] + public class OrderLineEto + { + public Guid Id { get; set; } + + public Guid ProductId { get; set; } + + public Guid ProductSkuId { get; set; } + + public DateTime ProductModificationTime { get; set; } + + public DateTime ProductDetailModificationTime { get; set; } + + public string ProductName { get; set; } + + public string SkuDescription { get; set; } + + public string MediaResources { get; set; } + + public string Currency { get; set; } + + public decimal UnitPrice { get; set; } + + public decimal TotalPrice { get; set; } + + public decimal TotalDiscount { get; set; } + + public int Quantity { get; set; } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Orders/OrderStatus.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/OrderStatus.cs similarity index 100% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Orders/OrderStatus.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Orders/OrderStatus.cs diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/OrdersErrorCodes.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/OrdersErrorCodes.cs similarity index 100% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/OrdersErrorCodes.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/OrdersErrorCodes.cs diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/cs.json b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/cs.json deleted file mode 100644 index 6a060a54..00000000 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/cs.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "culture": "cs", - "texts": { - - } -} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/en.json b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/en.json deleted file mode 100644 index 171d9a12..00000000 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/en.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "culture": "en", - "texts": { - "ManageYourProfile": "Manage your profile" - } -} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/pl.json b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/pl.json deleted file mode 100644 index 2ea227cb..00000000 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/pl.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "culture": "pl", - "texts": { - - } -} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/pt-BR.json b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/pt-BR.json deleted file mode 100644 index 6d746df0..00000000 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/pt-BR.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "culture": "pt-BR", - "texts": { - - } -} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/sl.json b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/sl.json deleted file mode 100644 index 687d4257..00000000 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/sl.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "culture": "sl", - "texts": { - "ManageYourProfile": "Upravljajte svojim profilom" - } -} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/tr.json b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/tr.json deleted file mode 100644 index 2b481933..00000000 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/tr.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "culture": "tr", - "texts": { - "ManageYourProfile": "Profil ynetimi" - } -} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/vi.json b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/vi.json deleted file mode 100644 index d8eb5f3c..00000000 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/vi.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "culture": "vi", - "texts": { - - } -} diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/zh-Hans.json b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/zh-Hans.json deleted file mode 100644 index 99586f01..00000000 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/zh-Hans.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "culture": "zh-Hans", - "texts": { - "ManageYourProfile": "管理个人资料" - } -} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/zh-Hant.json b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/zh-Hant.json deleted file mode 100644 index ceea0555..00000000 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/Localization/Orders/zh-Hant.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "culture": "zh-Hant", - "texts": { - "ManageYourProfile": "管理個人資料" - } -} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EShopOrdersDomainModule.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EShopOrdersDomainModule.cs deleted file mode 100644 index 3579589b..00000000 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EShopOrdersDomainModule.cs +++ /dev/null @@ -1,14 +0,0 @@ -using EasyAbp.EShop.Stores; -using Volo.Abp.Modularity; - -namespace EasyAbp.EShop.Orders -{ - [DependsOn( - typeof(EShopOrdersDomainSharedModule), - typeof(EShopStoresDomainSharedModule) - )] - public class EShopOrdersDomainModule : AbpModule - { - - } -} 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 ed6b28f2..55bd9721 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 @@ -4,11 +4,13 @@ netstandard2.0 - EasyAbp.EShop.Orders + + + diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/EShopOrdersDomainModule.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/EShopOrdersDomainModule.cs new file mode 100644 index 00000000..30243ce9 --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/EShopOrdersDomainModule.cs @@ -0,0 +1,33 @@ +using EasyAbp.EShop.Orders.Orders; +using EasyAbp.EShop.Stores; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.AutoMapper; +using Volo.Abp.EventBus.Distributed; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Orders +{ + [DependsOn( + typeof(AbpAutoMapperModule), + typeof(EShopOrdersDomainSharedModule), + typeof(EShopStoresDomainSharedModule) + )] + public class EShopOrdersDomainModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddAutoMapperObjectMapper(); + + Configure(options => + { + options.AddProfile(validate: true); + }); + + Configure(options => + { + options.EtoMappings.Add(typeof(EShopOrdersDomainModule)); + options.EtoMappings.Add(typeof(EShopOrdersDomainModule)); + }); + } + } +} diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderDiscountManager.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderDiscountManager.cs new file mode 100644 index 00000000..3279b1f5 --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderDiscountManager.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Domain.Services; + +namespace EasyAbp.EShop.Orders.Orders +{ + public interface IOrderDiscountManager : IDomainService + { + Task DiscountAsync(Order order, Dictionary inputExtraProperties); + } +} \ No newline at end of file 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 new file mode 100644 index 00000000..e3f85c61 --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderDiscountProvider.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace EasyAbp.EShop.Orders.Orders +{ + public interface IOrderDiscountProvider + { + Task DiscountAsync(Order order, Dictionary inputExtraProperties); + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderProductInventoryReductionEventHandler.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderProductInventoryReductionEventHandler.cs new file mode 100644 index 00000000..8e9daf02 --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderProductInventoryReductionEventHandler.cs @@ -0,0 +1,10 @@ +using EasyAbp.EShop.Products.Products; +using Volo.Abp.EventBus.Distributed; + +namespace EasyAbp.EShop.Orders.Orders +{ + public interface IOrderProductInventoryReductionEventHandler : IDistributedEventHandler + { + + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderRepository.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderRepository.cs new file mode 100644 index 00000000..b1fd0884 --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/IOrderRepository.cs @@ -0,0 +1,9 @@ +using System; +using Volo.Abp.Domain.Repositories; + +namespace EasyAbp.EShop.Orders.Orders +{ + public interface IOrderRepository : IRepository + { + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/Order.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/Order.cs new file mode 100644 index 00000000..3cfd2887 --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/Order.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using EasyAbp.EShop.Stores.Stores; +using JetBrains.Annotations; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace EasyAbp.EShop.Orders.Orders +{ + public class Order : FullAuditedAggregateRoot, IMultiTenant, IMultiStore + { + public virtual Guid? TenantId { get; protected set; } + + public virtual Guid StoreId { get; protected set; } + + public virtual Guid CustomerUserId { get; protected set; } + + public virtual OrderStatus OrderStatus { get; protected set; } + + [NotNull] + public virtual string Currency { get; protected set; } + + public virtual decimal ProductTotalPrice { get; protected set; } + + public virtual decimal TotalDiscount { get; protected set; } + + public virtual decimal TotalPrice { get; protected set; } + + public virtual decimal RefundedAmount { get; protected set; } + + [CanBeNull] + public virtual string CustomerRemark { get; protected set; } + + [CanBeNull] + public virtual string StaffRemark { get; protected set; } + + public virtual DateTime? PaidTime { get; protected set; } + + public virtual DateTime? CompletionTime { get; protected set; } + + public virtual DateTime? CancelledTime { get; protected set; } + + public virtual DateTime? ReducedInventoryAfterPlacingTime { get; protected set; } + + public virtual DateTime? ReducedInventoryAfterPaymentTime { get; protected set; } + + public virtual List OrderLines { get; protected set; } + + protected Order() + { + OrderLines = new List(); + } + + public Order( + Guid id, + Guid? tenantId, + Guid storeId, + Guid customerUserId, + string currency, + decimal productTotalPrice, + decimal totalDiscount, + decimal totalPrice, + decimal refundedAmount, + [CanBeNull] string customerRemark + ) : base(id) + { + TenantId = tenantId; + StoreId = storeId; + CustomerUserId = customerUserId; + Currency = currency; + ProductTotalPrice = productTotalPrice; + TotalDiscount = totalDiscount; + TotalPrice = totalPrice; + RefundedAmount = refundedAmount; + CustomerRemark = customerRemark; + + OrderStatus = OrderStatus.Pending; + OrderLines = new List(); + } + + public void SetOrderLines(List orderLines) + { + OrderLines = orderLines; + } + + public void SetReducedInventoryAfterPlacingTime(DateTime? time) + { + ReducedInventoryAfterPlacingTime = time; + } + + public void SetReducedInventoryAfterPaymentTime(DateTime? time) + { + ReducedInventoryAfterPaymentTime = time; + } + } +} diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderDiscountManager.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderDiscountManager.cs new file mode 100644 index 00000000..d1677c3c --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderDiscountManager.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Domain.Services; + +namespace EasyAbp.EShop.Orders.Orders +{ + public class OrderDiscountManager : DomainService, IOrderDiscountManager + { + public async Task DiscountAsync(Order order, Dictionary inputExtraProperties) + { + foreach (var provider in ServiceProvider.GetServices()) + { + await provider.DiscountAsync(order, inputExtraProperties); + } + + return order; + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/Orders/OrderLine.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderLine.cs similarity index 52% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/Orders/OrderLine.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderLine.cs index 4abd2355..0eb0ab60 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/Orders/OrderLine.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderLine.cs @@ -6,8 +6,6 @@ namespace EasyAbp.EShop.Orders.Orders { public class OrderLine : FullAuditedEntity { - public virtual Guid OrderId { get; protected set; } - public virtual Guid ProductId { get; protected set; } public virtual Guid ProductSkuId { get; protected set; } @@ -35,5 +33,36 @@ namespace EasyAbp.EShop.Orders.Orders public virtual decimal TotalDiscount { get; protected set; } public virtual int Quantity { get; protected set; } + + protected OrderLine() {} + + public OrderLine( + Guid id, + Guid productId, + Guid productSkuId, + DateTime productModificationTime, + DateTime productDetailModificationTime, + [NotNull] string productName, + [CanBeNull] string skuDescription, + [CanBeNull] string mediaResources, + [NotNull] string currency, + decimal unitPrice, + decimal totalPrice, + decimal totalDiscount, + int quantity) : base(id) + { + ProductId = productId; + ProductSkuId = productSkuId; + ProductModificationTime = productModificationTime; + ProductDetailModificationTime = productDetailModificationTime; + ProductName = productName; + SkuDescription = skuDescription; + MediaResources = mediaResources; + Currency = currency; + UnitPrice = unitPrice; + TotalPrice = totalPrice; + TotalDiscount = totalDiscount; + Quantity = quantity; + } } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderProductInventoryReductionEventHandler.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderProductInventoryReductionEventHandler.cs new file mode 100644 index 00000000..703dad8e --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderProductInventoryReductionEventHandler.cs @@ -0,0 +1,43 @@ +using System.Threading.Tasks; +using EasyAbp.EShop.Products.Products; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Timing; +using Volo.Abp.Uow; + +namespace EasyAbp.EShop.Orders.Orders +{ + public class OrderProductInventoryReductionEventHandler : IOrderProductInventoryReductionEventHandler, ITransientDependency + { + private readonly IClock _clock; + private readonly IOrderRepository _orderRepository; + + public OrderProductInventoryReductionEventHandler( + IClock clock, + IOrderRepository orderRepository) + { + _clock = clock; + _orderRepository = orderRepository; + } + + [UnitOfWork(true)] + public virtual async Task HandleEventAsync(ProductInventoryReductionAfterOrderPlacedResultEto eventData) + { + var order = await _orderRepository.GetAsync(eventData.OrderId); + + if (order.OrderStatus != OrderStatus.Pending || order.ReducedInventoryAfterPlacingTime.HasValue) + { + return; + } + + if (!eventData.IsSuccess) + { + // Todo: Cancel order. + return; + } + + order.SetReducedInventoryAfterPaymentTime(_clock.Now); + + await _orderRepository.UpdateAsync(order, true); + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/OrdersDbProperties.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/OrdersDbProperties.cs similarity index 100% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/OrdersDbProperties.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/OrdersDbProperties.cs diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/OrdersDomainAutoMapperProfile.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/OrdersDomainAutoMapperProfile.cs new file mode 100644 index 00000000..266f427e --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/OrdersDomainAutoMapperProfile.cs @@ -0,0 +1,17 @@ +using EasyAbp.EShop.Orders.Orders; +using AutoMapper; + +namespace EasyAbp.EShop.Orders +{ + public class OrdersDomainAutoMapperProfile : Profile + { + public OrdersDomainAutoMapperProfile() + { + /* 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(); + } + } +} diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/Settings/OrdersSettingDefinitionProvider.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Settings/OrdersSettingDefinitionProvider.cs similarity index 100% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/Settings/OrdersSettingDefinitionProvider.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Settings/OrdersSettingDefinitionProvider.cs diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/Settings/OrdersSettings.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Settings/OrdersSettings.cs similarity index 100% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/Settings/OrdersSettings.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Settings/OrdersSettings.cs diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/Orders/Order.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/Orders/Order.cs deleted file mode 100644 index 94f5b55c..00000000 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/Orders/Order.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using EasyAbp.EShop.Stores.Stores; -using JetBrains.Annotations; -using Volo.Abp.Domain.Entities.Auditing; -using Volo.Abp.MultiTenancy; - -namespace EasyAbp.EShop.Orders.Orders -{ - public class Order : FullAuditedAggregateRoot, IMultiTenant, IMultiStore - { - public virtual Guid? TenantId { get; protected set; } - - public virtual Guid StoreId { get; protected set; } - - public virtual Guid CustomerUserId { get; protected set; } - - public virtual OrderStatus OrderStatus { get; protected set; } - - [NotNull] - public virtual string Currency { get; protected set; } - - public virtual decimal ProductTotalPrice { get; protected set; } - - public virtual decimal TotalDiscount { get; protected set; } - - public virtual decimal TotalPrice { get; protected set; } - - public virtual decimal RefundedAmount { get; protected set; } - - [CanBeNull] - public virtual string CustomerRemark { get; protected set; } - - [CanBeNull] - public virtual string StaffRemark { get; protected set; } - - public virtual DateTime? PaidTime { get; protected set; } - - public virtual DateTime? CompletionTime { get; protected set; } - - public virtual DateTime? CancelledTime { get; protected set; } - - public virtual List OrderLines { get; protected set; } - } -} \ No newline at end of file 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 ddde4b04..f930a9c6 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 @@ -4,7 +4,7 @@ netstandard2.0 - EasyAbp.EShop.Orders + @@ -12,4 +12,8 @@ + + + + diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EntityFrameworkCore/EShopOrdersEntityFrameworkCoreModule.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp/EShop/Orders/EntityFrameworkCore/EShopOrdersEntityFrameworkCoreModule.cs similarity index 81% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EntityFrameworkCore/EShopOrdersEntityFrameworkCoreModule.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp/EShop/Orders/EntityFrameworkCore/EShopOrdersEntityFrameworkCoreModule.cs index d230f5eb..de4adb91 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EntityFrameworkCore/EShopOrdersEntityFrameworkCoreModule.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp/EShop/Orders/EntityFrameworkCore/EShopOrdersEntityFrameworkCoreModule.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.DependencyInjection; +using EasyAbp.EShop.Orders.Orders; +using Microsoft.Extensions.DependencyInjection; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.Modularity; @@ -17,7 +18,8 @@ namespace EasyAbp.EShop.Orders.EntityFrameworkCore /* Add custom repositories here. Example: * options.AddRepository(); */ + options.AddRepository(); }); } } -} \ No newline at end of file +} diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EntityFrameworkCore/IOrdersDbContext.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp/EShop/Orders/EntityFrameworkCore/IOrdersDbContext.cs similarity index 71% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EntityFrameworkCore/IOrdersDbContext.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp/EShop/Orders/EntityFrameworkCore/IOrdersDbContext.cs index 68ce96fa..dec6f381 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EntityFrameworkCore/IOrdersDbContext.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp/EShop/Orders/EntityFrameworkCore/IOrdersDbContext.cs @@ -1,5 +1,7 @@ -using Volo.Abp.Data; +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; +using EasyAbp.EShop.Orders.Orders; namespace EasyAbp.EShop.Orders.EntityFrameworkCore { @@ -9,5 +11,6 @@ namespace EasyAbp.EShop.Orders.EntityFrameworkCore /* Add DbSet for each Aggregate Root here. Example: * DbSet Questions { get; } */ + DbSet Orders { get; set; } } -} \ No newline at end of file +} diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EntityFrameworkCore/OrdersDbContext.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp/EShop/Orders/EntityFrameworkCore/OrdersDbContext.cs similarity index 83% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EntityFrameworkCore/OrdersDbContext.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp/EShop/Orders/EntityFrameworkCore/OrdersDbContext.cs index 274759ed..db524907 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EntityFrameworkCore/OrdersDbContext.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp/EShop/Orders/EntityFrameworkCore/OrdersDbContext.cs @@ -1,6 +1,7 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; +using EasyAbp.EShop.Orders.Orders; namespace EasyAbp.EShop.Orders.EntityFrameworkCore { @@ -10,6 +11,8 @@ namespace EasyAbp.EShop.Orders.EntityFrameworkCore /* Add DbSet for each Aggregate Root here. Example: * public DbSet Questions { get; set; } */ + public DbSet Orders { get; set; } + public DbSet OrderLines { get; set; } public OrdersDbContext(DbContextOptions options) : base(options) @@ -24,4 +27,4 @@ namespace EasyAbp.EShop.Orders.EntityFrameworkCore builder.ConfigureOrders(); } } -} \ No newline at end of file +} diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EntityFrameworkCore/OrdersDbContextModelCreatingExtensions.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp/EShop/Orders/EntityFrameworkCore/OrdersDbContextModelCreatingExtensions.cs similarity index 68% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EntityFrameworkCore/OrdersDbContextModelCreatingExtensions.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp/EShop/Orders/EntityFrameworkCore/OrdersDbContextModelCreatingExtensions.cs index 6b126c47..6b6d4572 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EntityFrameworkCore/OrdersDbContextModelCreatingExtensions.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp/EShop/Orders/EntityFrameworkCore/OrdersDbContextModelCreatingExtensions.cs @@ -1,6 +1,8 @@ -using System; +using EasyAbp.EShop.Orders.Orders; +using System; using Microsoft.EntityFrameworkCore; using Volo.Abp; +using Volo.Abp.EntityFrameworkCore.Modeling; namespace EasyAbp.EShop.Orders.EntityFrameworkCore { @@ -38,6 +40,20 @@ namespace EasyAbp.EShop.Orders.EntityFrameworkCore b.HasIndex(q => q.CreationTime); }); */ + + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "Orders", options.Schema); + b.ConfigureByConvention(); + /* Configure more properties here */ + }); + + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "OrderLines", options.Schema); + b.ConfigureByConvention(); + /* Configure more properties here */ + }); } } -} \ No newline at end of file +} diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EntityFrameworkCore/OrdersModelBuilderConfigurationOptions.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp/EShop/Orders/EntityFrameworkCore/OrdersModelBuilderConfigurationOptions.cs similarity index 100% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EntityFrameworkCore/OrdersModelBuilderConfigurationOptions.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp/EShop/Orders/EntityFrameworkCore/OrdersModelBuilderConfigurationOptions.cs diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp/EShop/Orders/Orders/OrderRepository.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp/EShop/Orders/Orders/OrderRepository.cs new file mode 100644 index 00000000..a5d54bae --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.EntityFrameworkCore/EasyAbp/EShop/Orders/Orders/OrderRepository.cs @@ -0,0 +1,14 @@ +using System; +using EasyAbp.EShop.Orders.EntityFrameworkCore; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; + +namespace EasyAbp.EShop.Orders.Orders +{ + public class OrderRepository : EfCoreRepository, IOrderRepository + { + public OrderRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + } +} \ No newline at end of file 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 6a446cc5..e430a54a 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 @@ -4,7 +4,7 @@ netcoreapp3.1 - EasyAbp.EShop.Orders + diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi.Client/EShopOrdersHttpApiClientModule.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi.Client/EasyAbp/EShop/Orders/EShopOrdersHttpApiClientModule.cs similarity index 100% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi.Client/EShopOrdersHttpApiClientModule.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi.Client/EasyAbp/EShop/Orders/EShopOrdersHttpApiClientModule.cs 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 24302788..871b3667 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 @@ -4,7 +4,7 @@ netcoreapp3.1 - EasyAbp.EShop.Orders + diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi/EShopOrdersHttpApiModule.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi/EasyAbp/EShop/Orders/EShopOrdersHttpApiModule.cs similarity index 100% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi/EShopOrdersHttpApiModule.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi/EasyAbp/EShop/Orders/EShopOrdersHttpApiModule.cs diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi/OrdersController.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi/EasyAbp/EShop/Orders/OrdersController.cs similarity index 100% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi/OrdersController.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.HttpApi/EasyAbp/EShop/Orders/OrdersController.cs 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 7bcdbcb6..52754017 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 @@ -4,7 +4,7 @@ netcoreapp3.1 - EasyAbp.EShop.Orders + @@ -12,4 +12,8 @@ + + + + diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/MongoDB/EShopOrdersMongoDbModule.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/EasyAbp/EShop/Orders/MongoDB/EShopOrdersMongoDbModule.cs similarity index 100% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/MongoDB/EShopOrdersMongoDbModule.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/EasyAbp/EShop/Orders/MongoDB/EShopOrdersMongoDbModule.cs diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/MongoDB/IOrdersMongoDbContext.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/EasyAbp/EShop/Orders/MongoDB/IOrdersMongoDbContext.cs similarity index 100% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/MongoDB/IOrdersMongoDbContext.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/EasyAbp/EShop/Orders/MongoDB/IOrdersMongoDbContext.cs diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/MongoDB/OrdersMongoDbContext.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/EasyAbp/EShop/Orders/MongoDB/OrdersMongoDbContext.cs similarity index 100% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/MongoDB/OrdersMongoDbContext.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/EasyAbp/EShop/Orders/MongoDB/OrdersMongoDbContext.cs diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/MongoDB/OrdersMongoDbContextExtensions.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/EasyAbp/EShop/Orders/MongoDB/OrdersMongoDbContextExtensions.cs similarity index 100% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/MongoDB/OrdersMongoDbContextExtensions.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/EasyAbp/EShop/Orders/MongoDB/OrdersMongoDbContextExtensions.cs diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/MongoDB/OrdersMongoModelBuilderConfigurationOptions.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/EasyAbp/EShop/Orders/MongoDB/OrdersMongoModelBuilderConfigurationOptions.cs similarity index 100% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/MongoDB/OrdersMongoModelBuilderConfigurationOptions.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.MongoDB/EasyAbp/EShop/Orders/MongoDB/OrdersMongoModelBuilderConfigurationOptions.cs 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 8544cafa..517199cb 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 @@ -17,6 +17,7 @@ + diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/OrdersMenuContributor.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/OrdersMenuContributor.cs index b68e2f45..d26a9544 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/OrdersMenuContributor.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/OrdersMenuContributor.cs @@ -1,4 +1,11 @@ -using System.Threading.Tasks; +using System.Collections.Generic; +using System.Threading.Tasks; +using EasyAbp.EShop.Orders.Authorization; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Localization; +using EasyAbp.EShop.Orders.Localization; +using EasyAbp.EShop.Stores.Stores; +using Microsoft.AspNetCore.Authorization; using Volo.Abp.UI.Navigation; namespace EasyAbp.EShop.Orders.Web @@ -13,11 +20,32 @@ namespace EasyAbp.EShop.Orders.Web } } - private Task ConfigureMainMenu(MenuConfigurationContext context) + private async Task ConfigureMainMenu(MenuConfigurationContext context) { - //Add main menu items. + var l = context.ServiceProvider.GetRequiredService>(); //Add main menu items. - return Task.CompletedTask; + var authorizationService = context.ServiceProvider.GetRequiredService(); + + var orderManagementMenuItem = new ApplicationMenuItem("OrderManagement", l["Menu:OrderManagement"]); + + if (await authorizationService.IsGrantedAsync(OrdersPermissions.Orders.Manage)) + { + var storeAppService = context.ServiceProvider.GetRequiredService(); + + var defaultStore = (await storeAppService.GetDefaultAsync())?.Id; + + orderManagementMenuItem.AddItem( + new ApplicationMenuItem("Order", l["Menu:Order"], "/EShop/Orders/Orders/Order?storeId=" + defaultStore) + ); + } + + if (!orderManagementMenuItem.Items.IsNullOrEmpty()) + { + var eShopMenuItem = context.Menu.Items.GetOrAdd(i => i.Name == "EasyAbpEShop", + () => new ApplicationMenuItem("EasyAbpEShop", l["Menu:EasyAbpEShop"])); + + eShopMenuItem.Items.Add(orderManagementMenuItem); + } } } -} \ No newline at end of file +} 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 cedeeb48..ab082c0a 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,4 +1,5 @@ -using AutoMapper; +using EasyAbp.EShop.Orders.Orders.Dtos; +using AutoMapper; namespace EasyAbp.EShop.Orders.Web { @@ -9,6 +10,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(); } } -} \ No newline at end of file +} diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/Orders/Index.cshtml b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/Index.cshtml similarity index 100% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/Orders/Index.cshtml rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/Index.cshtml diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/Orders/Index.cshtml.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/Index.cshtml.cs similarity index 66% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/Orders/Index.cshtml.cs rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/Index.cshtml.cs index d7a508ac..e81b8065 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/Orders/Index.cshtml.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/Index.cshtml.cs @@ -1,4 +1,4 @@ -namespace EasyAbp.EShop.Orders.Web.Pages.Orders +namespace EasyAbp.EShop.Orders.Web.Pages.EShop.Orders { public class IndexModel : OrdersPageModel { diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/Orders/Order/Index.cshtml b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/Orders/Order/Index.cshtml new file mode 100644 index 00000000..1daa9f7e --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/Orders/Order/Index.cshtml @@ -0,0 +1,54 @@ +@page +@using EasyAbp.EShop.Orders.Web.Pages.EShop.Orders.Orders.Order +@using Volo.Abp.AspNetCore.Mvc.UI.Layout +@inherits EasyAbp.EShop.Orders.Web.Pages.OrdersPage +@model IndexModel +@inject IPageLayout PageLayout +@{ + PageLayout.Content.Title = L["Order"].Value; + PageLayout.Content.BreadCrumb.Add(L["Menu:Order"].Value); + PageLayout.Content.MenuItemName = "Order"; + + var cardTitle = @L["Order"].Value; + + if (Model.StoreName != null) + { + cardTitle += $" - {Model.StoreName}"; + } + + if (Model.CustomerUserName != null) + { + cardTitle += $" - {Model.CustomerUserName}"; + } +} + +@section scripts +{ + +} +@section styles +{ + +} + + + + + + @cardTitle + + + + + + + + @L["Actions"] + @L["OrderCustomerUserId"] + @L["OrderOrderStatus"] + @L["OrderTotalPrice"] + + + + + \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/Orders/Order/Index.cshtml.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/Orders/Order/Index.cshtml.cs new file mode 100644 index 00000000..541b5f5a --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/Orders/Order/Index.cshtml.cs @@ -0,0 +1,40 @@ +using System; +using System.Threading.Tasks; +using EasyAbp.EShop.Stores.Stores; +using Microsoft.AspNetCore.Mvc; + +namespace EasyAbp.EShop.Orders.Web.Pages.EShop.Orders.Orders.Order +{ + public class IndexModel : OrdersPageModel + { + private readonly IStoreAppService _storeAppService; + + [BindProperty(SupportsGet = true)] + public Guid? StoreId { get; set; } + + [BindProperty(SupportsGet = true)] + public Guid? CustomerUserId { get; set; } + + public string StoreName { get; set; } + + public string CustomerUserName { get; set; } + + public IndexModel(IStoreAppService storeAppService) + { + _storeAppService = storeAppService; + } + + public virtual async Task OnGetAsync() + { + if (StoreId.HasValue) + { + StoreName = (await _storeAppService.GetAsync(StoreId.Value)).Name; + } + + if (CustomerUserId.HasValue) + { + // Todo: get username + } + } + } +} diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/Orders/Order/index.css b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/Orders/Order/index.css new file mode 100644 index 00000000..e69de29b diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/Orders/Order/index.js b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/Orders/Order/index.js new file mode 100644 index 00000000..1144a59f --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/Orders/Order/index.js @@ -0,0 +1,48 @@ +$(function () { + + var l = abp.localization.getResource('Orders'); + + var service = easyAbp.eShop.orders.orders.order; + + var dataTable = $('#OrderTable').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('Detail'), + action: function (data) { + editModal.open({ id: data.record.id }); + } + } + ] + } + }, + { data: "customerUserId" }, + { data: "orderStatus" }, + { data: "totalPrice" }, + ] + })); + + createModal.onResult(function () { + dataTable.ajax.reload(); + }); + + editModal.onResult(function () { + dataTable.ajax.reload(); + }); + + $('#NewOrderButton').click(function (e) { + e.preventDefault(); + createModal.open(); + }); +}); \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/Orders/_ViewImports.cshtml b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/_ViewImports.cshtml similarity index 100% rename from modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/Orders/_ViewImports.cshtml rename to modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/_ViewImports.cshtml diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/OrdersPage.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/OrdersPage.cs index afddec0f..c6d2aa7c 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/OrdersPage.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/OrdersPage.cs @@ -6,7 +6,7 @@ using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; namespace EasyAbp.EShop.Orders.Web.Pages { /* Inherit your UI Pages from this class. To do that, add this line to your Pages (.cshtml files under the Page folder): - * @inherits EasyAbp.EShop.Orders.Web.Pages.OrdersPage + * @inherits EasyAbp.EShop.Orders.Web.Pages.EShop.Orders.OrdersPage */ public abstract class OrdersPage : AbpPage { diff --git a/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.Application.Tests/EasyAbp.EShop.Orders.Application.Tests.csproj b/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.Application.Tests/EasyAbp.EShop.Orders.Application.Tests.csproj index 97c40dc2..d0605485 100644 --- a/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.Application.Tests/EasyAbp.EShop.Orders.Application.Tests.csproj +++ b/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.Application.Tests/EasyAbp.EShop.Orders.Application.Tests.csproj @@ -4,7 +4,7 @@ netcoreapp3.1 - EasyAbp.EShop.Orders + diff --git a/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.Application.Tests/Orders/OrderAppServiceTests.cs b/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.Application.Tests/Orders/OrderAppServiceTests.cs new file mode 100644 index 00000000..7f9a0540 --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.Application.Tests/Orders/OrderAppServiceTests.cs @@ -0,0 +1,26 @@ +using Shouldly; +using System.Threading.Tasks; +using Xunit; + +namespace EasyAbp.EShop.Orders.Orders +{ + public class OrderAppServiceTests : OrdersApplicationTestBase + { + private readonly IOrderAppService _orderAppService; + + public OrderAppServiceTests() + { + _orderAppService = GetRequiredService(); + } + + [Fact] + public async Task Test1() + { + // Arrange + + // Act + + // Assert + } + } +} diff --git a/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.Domain.Tests/EasyAbp.EShop.Orders.Domain.Tests.csproj b/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.Domain.Tests/EasyAbp.EShop.Orders.Domain.Tests.csproj index e7723ad6..c538ef1c 100644 --- a/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.Domain.Tests/EasyAbp.EShop.Orders.Domain.Tests.csproj +++ b/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.Domain.Tests/EasyAbp.EShop.Orders.Domain.Tests.csproj @@ -4,7 +4,7 @@ netcoreapp3.1 - EasyAbp.EShop.Orders + diff --git a/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.Domain.Tests/Orders/OrderDomainTests.cs b/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.Domain.Tests/Orders/OrderDomainTests.cs new file mode 100644 index 00000000..3aca6c0e --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.Domain.Tests/Orders/OrderDomainTests.cs @@ -0,0 +1,23 @@ +using System.Threading.Tasks; +using Shouldly; +using Xunit; + +namespace EasyAbp.EShop.Orders.Orders +{ + public class OrderDomainTests : OrdersDomainTestBase + { + public OrderDomainTests() + { + } + + [Fact] + public async Task Test1() + { + // Arrange + + // Assert + + // Assert + } + } +} diff --git a/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.EntityFrameworkCore.Tests/EasyAbp.EShop.Orders.EntityFrameworkCore.Tests.csproj b/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.EntityFrameworkCore.Tests/EasyAbp.EShop.Orders.EntityFrameworkCore.Tests.csproj index 045fa9cf..e0d6ca34 100644 --- a/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.EntityFrameworkCore.Tests/EasyAbp.EShop.Orders.EntityFrameworkCore.Tests.csproj +++ b/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.EntityFrameworkCore.Tests/EasyAbp.EShop.Orders.EntityFrameworkCore.Tests.csproj @@ -4,7 +4,7 @@ netcoreapp3.1 - EasyAbp.EShop.Orders + diff --git a/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.EntityFrameworkCore.Tests/EntityFrameworkCore/Orders/OrderRepositoryTests.cs b/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.EntityFrameworkCore.Tests/EntityFrameworkCore/Orders/OrderRepositoryTests.cs new file mode 100644 index 00000000..5900b35b --- /dev/null +++ b/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.EntityFrameworkCore.Tests/EntityFrameworkCore/Orders/OrderRepositoryTests.cs @@ -0,0 +1,31 @@ +using System; +using System.Threading.Tasks; +using EasyAbp.EShop.Orders.Orders; +using Volo.Abp.Domain.Repositories; +using Xunit; + +namespace EasyAbp.EShop.Orders.EntityFrameworkCore.Orders +{ + public class OrderRepositoryTests : OrdersEntityFrameworkCoreTestBase + { + private readonly IRepository _orderRepository; + + public OrderRepositoryTests() + { + _orderRepository = GetRequiredService>(); + } + + [Fact] + public async Task Test1() + { + await WithUnitOfWorkAsync(async () => + { + // Arrange + + // Act + + //Assert + }); + } + } +} 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 48d78d18..12d587e0 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 @@ -3,7 +3,7 @@ Exe netcoreapp3.1 - EasyAbp.EShop.Orders + diff --git a/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.MongoDB.Tests/EasyAbp.EShop.Orders.MongoDB.Tests.csproj b/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.MongoDB.Tests/EasyAbp.EShop.Orders.MongoDB.Tests.csproj index 93dfd7a8..70fdb425 100644 --- a/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.MongoDB.Tests/EasyAbp.EShop.Orders.MongoDB.Tests.csproj +++ b/modules/EasyAbp.EShop.Orders/test/EasyAbp.EShop.Orders.MongoDB.Tests/EasyAbp.EShop.Orders.MongoDB.Tests.csproj @@ -4,7 +4,7 @@ netcoreapp3.1 - EasyAbp.EShop.Orders + 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 da47c70f..7a2b5775 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 @@ -4,7 +4,7 @@ netcoreapp3.1 - EasyAbp.EShop.Orders + 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 4cedf888..55c10412 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 @@ -217,6 +217,8 @@ namespace EasyAbp.EShop.Products.Products { await CheckStoreIsProductOwnerAsync(id, storeId); } + + // Todo: get real inventory. dto.CategoryIds = (await _productCategoryRepository.GetListByProductIdAsync(dto.Id)) .Select(x => x.CategoryId).ToList(); @@ -250,6 +252,8 @@ namespace EasyAbp.EShop.Products.Products var entities = await AsyncQueryableExecuter.ToListAsync(query); + // Todo: get real inventory. + return new PagedResultDto( totalCount, entities.Select(MapToGetListOutputDto).ToList() diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Products/ProductInventoryReductionAfterOrderPlacedResultEto.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Products/ProductInventoryReductionAfterOrderPlacedResultEto.cs new file mode 100644 index 00000000..998034ee --- /dev/null +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Products/ProductInventoryReductionAfterOrderPlacedResultEto.cs @@ -0,0 +1,12 @@ +using System; + +namespace EasyAbp.EShop.Products.Products +{ + [Serializable] + public class ProductInventoryReductionAfterOrderPlacedResultEto + { + public Guid OrderId { get; set; } + + public bool IsSuccess { get; set; } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Products/ProductInventoryReductionFailedEto.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Products/ProductInventoryReductionFailedEto.cs deleted file mode 100644 index 8325894d..00000000 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Products/ProductInventoryReductionFailedEto.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; - -namespace EasyAbp.EShop.Products.Products -{ - [Serializable] - public class ProductInventoryReductionFailedEto - { - - } -} \ 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 23b9de85..c19beceb 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 @@ -9,6 +9,7 @@ + diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/DefaultProductInventoryProvider.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/DefaultProductInventoryProvider.cs index d8b65835..82b6c5bc 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/DefaultProductInventoryProvider.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/DefaultProductInventoryProvider.cs @@ -18,5 +18,15 @@ namespace EasyAbp.EShop.Products.Products { return Task.FromResult(productSku.Inventory); } + + public Task TryIncreaseInventoryAsync(Product product, ProductSku productSku, Guid storeId, int quantity) + { + return Task.FromResult(productSku.TryIncreaseInventory(quantity)); + } + + public Task TryReduceInventoryAsync(Product product, ProductSku productSku, Guid storeId, int quantity) + { + return Task.FromResult(productSku.TryReduceInventory(quantity)); + } } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IOrderCreatedEventHandler.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IOrderCreatedEventHandler.cs new file mode 100644 index 00000000..f3205abb --- /dev/null +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IOrderCreatedEventHandler.cs @@ -0,0 +1,11 @@ +using EasyAbp.EShop.Orders.Orders; +using Volo.Abp.Domain.Entities.Events.Distributed; +using Volo.Abp.EventBus.Distributed; + +namespace EasyAbp.EShop.Products.Products +{ + public interface IOrderCreatedEventHandler : IDistributedEventHandler> + { + + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductInventoryManager.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductInventoryManager.cs deleted file mode 100644 index d450a82e..00000000 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductInventoryManager.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace EasyAbp.EShop.Products.Products -{ - public interface IProductInventoryManager - { - - } -} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductInventoryProvider.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductInventoryProvider.cs index a9a95487..9a392e09 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductInventoryProvider.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductInventoryProvider.cs @@ -8,5 +8,9 @@ namespace EasyAbp.EShop.Products.Products Task IsInventorySufficientAsync(Product product, ProductSku productSku, Guid storeId, int quantity); Task GetInventoryAsync(Product product, ProductSku productSku, Guid storeId); + + Task TryIncreaseInventoryAsync(Product product, ProductSku productSku, Guid storeId, int quantity); + + Task TryReduceInventoryAsync(Product product, ProductSku productSku, Guid storeId, int quantity); } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductManager.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductManager.cs index 8ba3e28b..6c1debd1 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductManager.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductManager.cs @@ -12,5 +12,13 @@ namespace EasyAbp.EShop.Products.Products Task GetPurchasableStatusAsync(Product product, ProductSku productSku, Guid storeId, Dictionary extraProperties); + + Task IsInventorySufficientAsync(Product product, ProductSku productSku, Guid storeId, int quantity); + + Task GetInventoryAsync(Product product, ProductSku productSku, Guid storeId); + + Task TryIncreaseInventoryAsync(Product product, ProductSku productSku, Guid storeId, int quantity); + + Task TryReduceInventoryAsync(Product product, ProductSku productSku, Guid storeId, int quantity); } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/OrderCreatedEventHandler.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/OrderCreatedEventHandler.cs new file mode 100644 index 00000000..96a17ba1 --- /dev/null +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/OrderCreatedEventHandler.cs @@ -0,0 +1,71 @@ +using System.Linq; +using System.Threading.Tasks; +using EasyAbp.EShop.Orders.Orders; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Entities.Events.Distributed; +using Volo.Abp.EventBus.Distributed; +using Volo.Abp.Uow; + +namespace EasyAbp.EShop.Products.Products +{ + public class OrderCreatedEventHandler : IOrderCreatedEventHandler, ITransientDependency + { + private readonly IUnitOfWorkManager _unitOfWorkManager; + private readonly IDistributedEventBus _distributedEventBus; + private readonly IProductRepository _productRepository; + private readonly IProductManager _productManager; + + public OrderCreatedEventHandler( + IUnitOfWorkManager unitOfWorkManager, + IDistributedEventBus distributedEventBus, + IProductRepository productRepository, + IProductManager productManager) + { + _unitOfWorkManager = unitOfWorkManager; + _distributedEventBus = distributedEventBus; + _productRepository = productRepository; + _productManager = productManager; + } + + public virtual async Task HandleEventAsync(EntityCreatedEto eventData) + { + using var uow = _unitOfWorkManager.Begin(true, true); + + foreach (var orderLine in eventData.Entity.OrderLines) + { + var product = await _productRepository.FindAsync(orderLine.ProductId); + + var productSku = product?.ProductSkus.FirstOrDefault(sku => sku.Id == orderLine.ProductSkuId); + + if (productSku == null) + { + await uow.RollbackAsync(); + await _distributedEventBus.PublishAsync(new ProductInventoryReductionAfterOrderPlacedResultEto + {OrderId = eventData.Entity.Id, IsSuccess = false}); + return; + } + + if (product.InventoryStrategy != InventoryStrategy.ReduceAfterPlacing) + { + await uow.RollbackAsync(); + await _distributedEventBus.PublishAsync(new ProductInventoryReductionAfterOrderPlacedResultEto + {OrderId = eventData.Entity.Id, IsSuccess = false}); + return; + } + + if (!await _productManager.TryReduceInventoryAsync(product, productSku, eventData.Entity.StoreId, + orderLine.Quantity)) + { + await uow.RollbackAsync(); + await _distributedEventBus.PublishAsync(new ProductInventoryReductionAfterOrderPlacedResultEto + {OrderId = eventData.Entity.Id, IsSuccess = false}); + return; + } + } + + await uow.CompleteAsync(); + await _distributedEventBus.PublishAsync(new ProductInventoryReductionAfterOrderPlacedResultEto + {OrderId = eventData.Entity.Id, IsSuccess = true}); + } + } +} \ No newline at end of file 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 9e7ea444..460dc9aa 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 @@ -8,6 +8,14 @@ namespace EasyAbp.EShop.Products.Products { public class ProductManager : DomainService, IProductManager { + private readonly IProductInventoryProvider _productInventoryProvider; + + public ProductManager( + IProductInventoryProvider productInventoryProvider) + { + _productInventoryProvider = productInventoryProvider; + } + public async Task CheckPurchasableAsync(Product product, ProductSku productSku, Guid storeId, Dictionary extraProperties) { @@ -36,5 +44,25 @@ namespace EasyAbp.EShop.Products.Products return new CheckProductPurchasableResult(true); } + + public async Task IsInventorySufficientAsync(Product product, ProductSku productSku, Guid storeId, int quantity) + { + return await _productInventoryProvider.IsInventorySufficientAsync(product, productSku, storeId, quantity); + } + + public async Task GetInventoryAsync(Product product, ProductSku productSku, Guid storeId) + { + return await _productInventoryProvider.GetInventoryAsync(product, productSku, storeId); + } + + public async Task TryIncreaseInventoryAsync(Product product, ProductSku productSku, Guid storeId, int quantity) + { + return await _productInventoryProvider.TryIncreaseInventoryAsync(product, productSku, storeId, quantity); + } + + public async Task TryReduceInventoryAsync(Product product, ProductSku productSku, Guid storeId, int quantity) + { + return await _productInventoryProvider.TryReduceInventoryAsync(product, productSku, storeId, quantity); + } } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductSku.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductSku.cs index 17f025e7..a600e30d 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductSku.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductSku.cs @@ -46,5 +46,29 @@ namespace EasyAbp.EShop.Products.Products OrderMinQuantity = orderMinQuantity; ProductDetailId = productDetailId; } + + public bool TryIncreaseInventory(int quantity) + { + if (quantity <= 0) + { + return false; + } + + Inventory = checked(Inventory + quantity); + + return true; + } + + public bool TryReduceInventory(int quantity) + { + if (quantity > Inventory || quantity <= 0) + { + return false; + } + + Inventory -= quantity; + + return true; + } } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductSkuInventoryChangeFailedException.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductSkuInventoryChangeFailedException.cs new file mode 100644 index 00000000..1bc251c4 --- /dev/null +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductSkuInventoryChangeFailedException.cs @@ -0,0 +1,15 @@ +using System; +using Volo.Abp; + +namespace EasyAbp.EShop.Products.Products +{ + public class ProductSkuInventoryChangeFailedException : BusinessException + { + public ProductSkuInventoryChangeFailedException(Guid productId, Guid productSkuId, int originalInventory, + int changedInventory) : base( + message: + $"Inventory of product {productId} (SKU: {productSkuId}) cannot be changed by {changedInventory} from {originalInventory}") + { + } + } +} \ No newline at end of file diff --git a/samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/20200505145542_AddedOrder.Designer.cs b/samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/20200505145542_AddedOrder.Designer.cs new file mode 100644 index 00000000..1a7f37c9 --- /dev/null +++ b/samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/20200505145542_AddedOrder.Designer.cs @@ -0,0 +1,2661 @@ +// +using System; +using EasyMall.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace EasyMall.Migrations +{ + [DbContext(typeof(EasyMallMigrationsDbContext))] + [Migration("20200505145542_AddedOrder")] + partial class AddedOrder + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.2") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("EasyAbp.EShop.Orders.Orders.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CancelledTime") + .HasColumnType("datetime2"); + + b.Property("CompletionTime") + .HasColumnType("datetime2"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("nvarchar(max)"); + + b.Property("CustomerRemark") + .HasColumnType("nvarchar(max)"); + + b.Property("CustomerUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("OrderStatus") + .HasColumnType("int"); + + b.Property("PaidTime") + .HasColumnType("datetime2"); + + b.Property("ProductTotalPrice") + .HasColumnType("decimal(18,2)"); + + b.Property("ReducedInventoryAfterPaymentTime") + .HasColumnType("datetime2"); + + b.Property("ReducedInventoryAfterPlacingTime") + .HasColumnType("datetime2"); + + b.Property("RefundedAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("StaffRemark") + .HasColumnType("nvarchar(max)"); + + b.Property("StoreId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("TotalDiscount") + .HasColumnType("decimal(18,2)"); + + b.Property("TotalPrice") + .HasColumnType("decimal(18,2)"); + + b.HasKey("Id"); + + b.ToTable("OrdersOrders"); + }); + + modelBuilder.Entity("EasyAbp.EShop.Orders.Orders.OrderLine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("nvarchar(max)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("MediaResources") + .HasColumnType("nvarchar(max)"); + + b.Property("OrderId") + .HasColumnType("uniqueidentifier"); + + b.Property("ProductDetailModificationTime") + .HasColumnType("datetime2"); + + b.Property("ProductId") + .HasColumnType("uniqueidentifier"); + + b.Property("ProductModificationTime") + .HasColumnType("datetime2"); + + b.Property("ProductName") + .HasColumnType("nvarchar(max)"); + + b.Property("ProductSkuId") + .HasColumnType("uniqueidentifier"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("SkuDescription") + .HasColumnType("nvarchar(max)"); + + b.Property("TotalDiscount") + .HasColumnType("decimal(18,2)"); + + b.Property("TotalPrice") + .HasColumnType("decimal(18,2)"); + + b.Property("UnitPrice") + .HasColumnType("decimal(18,2)"); + + b.HasKey("Id"); + + b.HasIndex("OrderId"); + + b.ToTable("OrdersOrderLines"); + }); + + modelBuilder.Entity("EasyAbp.EShop.Products.Categories.Category", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("IsHidden") + .HasColumnType("bit"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("MediaResources") + .HasColumnType("nvarchar(max)"); + + b.Property("ParentCategoryId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.ToTable("ProductsCategories"); + }); + + modelBuilder.Entity("EasyAbp.EShop.Products.ProductCategories.ProductCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CategoryId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DisplayOrder") + .HasColumnType("int"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("ProductId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.ToTable("ProductsProductCategories"); + }); + + modelBuilder.Entity("EasyAbp.EShop.Products.ProductDetailHistories.ProductDetailHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTime") + .HasColumnType("datetime2"); + + b.Property("ProductDetailId") + .HasColumnType("uniqueidentifier"); + + b.Property("SerializedDto") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ModificationTime"); + + b.HasIndex("ProductDetailId"); + + b.ToTable("ProductsProductDetailHistories"); + }); + + modelBuilder.Entity("EasyAbp.EShop.Products.ProductDetails.ProductDetail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.ToTable("ProductsProductDetails"); + }); + + modelBuilder.Entity("EasyAbp.EShop.Products.ProductHistories.ProductHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTime") + .HasColumnType("datetime2"); + + b.Property("ProductId") + .HasColumnType("uniqueidentifier"); + + b.Property("SerializedDto") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ModificationTime"); + + b.HasIndex("ProductId"); + + b.ToTable("ProductsProductHistories"); + }); + + modelBuilder.Entity("EasyAbp.EShop.Products.ProductStores.ProductStore", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("IsOwner") + .HasColumnType("bit"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("ProductId") + .HasColumnType("uniqueidentifier"); + + b.Property("StoreId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.ToTable("ProductsProductStores"); + }); + + modelBuilder.Entity("EasyAbp.EShop.Products.ProductTypes.ProductType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("MultiTenancySide") + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("ProductsProductTypes"); + }); + + modelBuilder.Entity("EasyAbp.EShop.Products.Products.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("DisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("DisplayOrder") + .HasColumnType("int"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("InventoryStrategy") + .HasColumnType("int"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("IsHidden") + .HasColumnType("bit"); + + b.Property("IsPublished") + .HasColumnType("bit"); + + b.Property("IsStatic") + .HasColumnType("bit"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("MediaResources") + .HasColumnType("nvarchar(max)"); + + b.Property("ProductDetailId") + .HasColumnType("uniqueidentifier"); + + b.Property("ProductTypeId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.ToTable("ProductsProducts"); + }); + + modelBuilder.Entity("EasyAbp.EShop.Products.Products.ProductAttribute", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("DisplayOrder") + .HasColumnType("int"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("ProductId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ProductId"); + + b.ToTable("ProductsProductAttributes"); + }); + + modelBuilder.Entity("EasyAbp.EShop.Products.Products.ProductAttributeOption", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("DisplayOrder") + .HasColumnType("int"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("ProductAttributeId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ProductAttributeId"); + + b.ToTable("ProductsProductAttributeOptions"); + }); + + modelBuilder.Entity("EasyAbp.EShop.Products.Products.ProductSku", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("nvarchar(max)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("Inventory") + .HasColumnType("int"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("OrderMinQuantity") + .HasColumnType("int"); + + b.Property("OriginalPrice") + .HasColumnType("decimal(18,6)"); + + b.Property("Price") + .HasColumnType("decimal(18,6)"); + + b.Property("ProductDetailId") + .HasColumnType("uniqueidentifier"); + + b.Property("ProductId") + .HasColumnType("uniqueidentifier"); + + b.Property("SerializedAttributeOptionIds") + .HasColumnType("nvarchar(max)"); + + b.Property("Sold") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProductId"); + + b.ToTable("ProductsProductSkus"); + }); + + modelBuilder.Entity("EasyAbp.EShop.Stores.Stores.Store", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.ToTable("StoresStores"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ApplicationName") + .HasColumnName("ApplicationName") + .HasColumnType("nvarchar(96)") + .HasMaxLength(96); + + b.Property("BrowserInfo") + .HasColumnName("BrowserInfo") + .HasColumnType("nvarchar(512)") + .HasMaxLength(512); + + b.Property("ClientId") + .HasColumnName("ClientId") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ClientIpAddress") + .HasColumnName("ClientIpAddress") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ClientName") + .HasColumnName("ClientName") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("Comments") + .HasColumnName("Comments") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CorrelationId") + .HasColumnName("CorrelationId") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("Exceptions") + .HasColumnName("Exceptions") + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); + + b.Property("ExecutionDuration") + .HasColumnName("ExecutionDuration") + .HasColumnType("int"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("HttpMethod") + .HasColumnName("HttpMethod") + .HasColumnType("nvarchar(16)") + .HasMaxLength(16); + + b.Property("HttpStatusCode") + .HasColumnName("HttpStatusCode") + .HasColumnType("int"); + + b.Property("ImpersonatorTenantId") + .HasColumnName("ImpersonatorTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("ImpersonatorUserId") + .HasColumnName("ImpersonatorUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantName") + .HasColumnType("nvarchar(max)"); + + b.Property("Url") + .HasColumnName("Url") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("UserId") + .HasColumnName("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserName") + .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ExecutionTime"); + + b.HasIndex("TenantId", "UserId", "ExecutionTime"); + + b.ToTable("AbpAuditLogs"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnName("AuditLogId") + .HasColumnType("uniqueidentifier"); + + b.Property("ExecutionDuration") + .HasColumnName("ExecutionDuration") + .HasColumnType("int"); + + b.Property("ExecutionTime") + .HasColumnName("ExecutionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("MethodName") + .HasColumnName("MethodName") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("Parameters") + .HasColumnName("Parameters") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.Property("ServiceName") + .HasColumnName("ServiceName") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); + + b.ToTable("AbpAuditLogActions"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnName("AuditLogId") + .HasColumnType("uniqueidentifier"); + + b.Property("ChangeTime") + .HasColumnName("ChangeTime") + .HasColumnType("datetime2"); + + b.Property("ChangeType") + .HasColumnName("ChangeType") + .HasColumnType("tinyint"); + + b.Property("EntityId") + .IsRequired() + .HasColumnName("EntityId") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("EntityTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("EntityTypeFullName") + .IsRequired() + .HasColumnName("EntityTypeFullName") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); + + b.ToTable("AbpEntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EntityChangeId") + .HasColumnType("uniqueidentifier"); + + b.Property("NewValue") + .HasColumnName("NewValue") + .HasColumnType("nvarchar(512)") + .HasMaxLength(512); + + b.Property("OriginalValue") + .HasColumnName("OriginalValue") + .HasColumnType("nvarchar(512)") + .HasMaxLength(512); + + b.Property("PropertyName") + .IsRequired() + .HasColumnName("PropertyName") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("PropertyTypeFullName") + .IsRequired() + .HasColumnName("PropertyTypeFullName") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("EntityChangeId"); + + b.ToTable("AbpEntityPropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsAbandoned") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("JobArgs") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(1048576); + + b.Property("JobName") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("LastTryTime") + .HasColumnType("datetime2"); + + b.Property("NextTryTime") + .HasColumnType("datetime2"); + + b.Property("Priority") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint") + .HasDefaultValue((byte)15); + + b.Property("TryCount") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((short)0); + + b.HasKey("Id"); + + b.HasIndex("IsAbandoned", "NextTryTime"); + + b.ToTable("AbpBackgroundJobs"); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("ProviderKey") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ProviderName") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpFeatureValues"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("Description") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsStatic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("Regex") + .HasColumnType("nvarchar(512)") + .HasMaxLength(512); + + b.Property("RegexDescription") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("Required") + .HasColumnType("bit"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDefault") + .HasColumnName("IsDefault") + .HasColumnType("bit"); + + b.Property("IsPublic") + .HasColumnName("IsPublic") + .HasColumnType("bit"); + + b.Property("IsStatic") + .HasColumnName("IsStatic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("NormalizedName") + .IsRequired() + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") + .HasMaxLength(1024); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AbpRoleClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AccessFailedCount") + .ValueGeneratedOnAdd() + .HasColumnName("AccessFailedCount") + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("Email") + .IsRequired() + .HasColumnName("Email") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnName("EmailConfirmed") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("LockoutEnabled") + .ValueGeneratedOnAdd() + .HasColumnName("LockoutEnabled") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("Name") + .HasColumnName("Name") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("NormalizedEmail") + .IsRequired() + .HasColumnName("NormalizedEmail") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("NormalizedUserName") + .IsRequired() + .HasColumnName("NormalizedUserName") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("PasswordHash") + .HasColumnName("PasswordHash") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("PhoneNumber") + .HasColumnName("PhoneNumber") + .HasColumnType("nvarchar(16)") + .HasMaxLength(16); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnName("PhoneNumberConfirmed") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("SecurityStamp") + .IsRequired() + .HasColumnName("SecurityStamp") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("Surname") + .HasColumnName("Surname") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("TwoFactorEnabled") + .ValueGeneratedOnAdd() + .HasColumnName("TwoFactorEnabled") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("UserName") + .IsRequired() + .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("NormalizedEmail"); + + b.HasIndex("NormalizedUserName"); + + b.HasIndex("UserName"); + + b.ToTable("AbpUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") + .HasMaxLength(1024); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("ProviderKey") + .IsRequired() + .HasColumnType("nvarchar(196)") + .HasMaxLength(196); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("UserId", "LoginProvider"); + + b.HasIndex("LoginProvider", "ProviderKey"); + + b.ToTable("AbpUserLogins"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId", "UserId"); + + b.ToTable("AbpUserRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("Name") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AbpUserTokens"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); + + b.Property("DisplayName") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Properties") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("IdentityServerApiResources"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("ApiResourceId", "Type"); + + b.ToTable("IdentityServerApiClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Description") + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); + + b.Property("DisplayName") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Emphasize") + .HasColumnType("bit"); + + b.Property("Required") + .HasColumnType("bit"); + + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); + + b.HasKey("ApiResourceId", "Name"); + + b.ToTable("IdentityServerApiScopes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Type") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("ApiResourceId", "Name", "Type"); + + b.ToTable("IdentityServerApiScopeClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); + + b.Property("Description") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.Property("Expiration") + .HasColumnType("datetime2"); + + b.HasKey("ApiResourceId", "Type", "Value"); + + b.ToTable("IdentityServerApiSecrets"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AbsoluteRefreshTokenLifetime") + .HasColumnType("int"); + + b.Property("AccessTokenLifetime") + .HasColumnType("int"); + + b.Property("AccessTokenType") + .HasColumnType("int"); + + b.Property("AllowAccessTokensViaBrowser") + .HasColumnType("bit"); + + b.Property("AllowOfflineAccess") + .HasColumnType("bit"); + + b.Property("AllowPlainTextPkce") + .HasColumnType("bit"); + + b.Property("AllowRememberConsent") + .HasColumnType("bit"); + + b.Property("AlwaysIncludeUserClaimsInIdToken") + .HasColumnType("bit"); + + b.Property("AlwaysSendClientClaims") + .HasColumnType("bit"); + + b.Property("AuthorizationCodeLifetime") + .HasColumnType("int"); + + b.Property("BackChannelLogoutSessionRequired") + .HasColumnType("bit"); + + b.Property("BackChannelLogoutUri") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.Property("ClientClaimsPrefix") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ClientName") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ClientUri") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("ConsentLifetime") + .HasColumnType("int"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); + + b.Property("DeviceCodeLifetime") + .HasColumnType("int"); + + b.Property("EnableLocalLogin") + .HasColumnType("bit"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("FrontChannelLogoutSessionRequired") + .HasColumnType("bit"); + + b.Property("FrontChannelLogoutUri") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.Property("IdentityTokenLifetime") + .HasColumnType("int"); + + b.Property("IncludeJwtId") + .HasColumnType("bit"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("LogoUri") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.Property("PairWiseSubjectSalt") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ProtocolType") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("RefreshTokenExpiration") + .HasColumnType("int"); + + b.Property("RefreshTokenUsage") + .HasColumnType("int"); + + b.Property("RequireClientSecret") + .HasColumnType("bit"); + + b.Property("RequireConsent") + .HasColumnType("bit"); + + b.Property("RequirePkce") + .HasColumnType("bit"); + + b.Property("SlidingRefreshTokenLifetime") + .HasColumnType("int"); + + b.Property("UpdateAccessTokenClaimsOnRefresh") + .HasColumnType("bit"); + + b.Property("UserCodeType") + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); + + b.Property("UserSsoLifetime") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.ToTable("IdentityServerClients"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.HasKey("ClientId", "Type", "Value"); + + b.ToTable("IdentityServerClientClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Origin") + .HasColumnType("nvarchar(150)") + .HasMaxLength(150); + + b.HasKey("ClientId", "Origin"); + + b.ToTable("IdentityServerClientCorsOrigins"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("GrantType") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.HasKey("ClientId", "GrantType"); + + b.ToTable("IdentityServerClientGrantTypes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Provider") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("ClientId", "Provider"); + + b.ToTable("IdentityServerClientIdPRestrictions"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("PostLogoutRedirectUri") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.HasKey("ClientId", "PostLogoutRedirectUri"); + + b.ToTable("IdentityServerClientPostLogoutRedirectUris"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Key") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.HasKey("ClientId", "Key"); + + b.ToTable("IdentityServerClientProperties"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("RedirectUri") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.HasKey("ClientId", "RedirectUri"); + + b.ToTable("IdentityServerClientRedirectUris"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Scope") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("ClientId", "Scope"); + + b.ToTable("IdentityServerClientScopes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); + + b.Property("Description") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.Property("Expiration") + .HasColumnType("datetime2"); + + b.HasKey("ClientId", "Type", "Value"); + + b.ToTable("IdentityServerClientSecrets"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Data") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(50000); + + b.Property("DeviceCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Expiration") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("SubjectId") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("UserCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.HasIndex("UserCode") + .IsUnique(); + + b.ToTable("IdentityServerDeviceFlowCodes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => + { + b.Property("Key") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("Data") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(50000); + + b.Property("Expiration") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectId") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Type") + .IsRequired() + .HasColumnType("nvarchar(50)") + .HasMaxLength(50); + + b.HasKey("Key"); + + b.HasIndex("Expiration"); + + b.HasIndex("SubjectId", "ClientId", "Type"); + + b.ToTable("IdentityServerPersistedGrants"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => + { + b.Property("IdentityResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("IdentityResourceId", "Type"); + + b.ToTable("IdentityServerIdentityClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); + + b.Property("DisplayName") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Emphasize") + .HasColumnType("bit"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Properties") + .HasColumnType("nvarchar(max)"); + + b.Property("Required") + .HasColumnType("bit"); + + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.ToTable("IdentityServerIdentityResources"); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("ProviderKey") + .IsRequired() + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ProviderName") + .IsRequired() + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpPermissionGrants"); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("ProviderKey") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ProviderName") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(2048)") + .HasMaxLength(2048); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpSettings"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AbpTenants"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(1024)") + .HasMaxLength(1024); + + b.HasKey("TenantId", "Name"); + + b.ToTable("AbpTenantConnectionStrings"); + }); + + modelBuilder.Entity("EasyAbp.EShop.Orders.Orders.OrderLine", b => + { + b.HasOne("EasyAbp.EShop.Orders.Orders.Order", null) + .WithMany("OrderLines") + .HasForeignKey("OrderId"); + }); + + modelBuilder.Entity("EasyAbp.EShop.Products.Products.ProductAttribute", b => + { + b.HasOne("EasyAbp.EShop.Products.Products.Product", null) + .WithMany("ProductAttributes") + .HasForeignKey("ProductId"); + }); + + modelBuilder.Entity("EasyAbp.EShop.Products.Products.ProductAttributeOption", b => + { + b.HasOne("EasyAbp.EShop.Products.Products.ProductAttribute", null) + .WithMany("ProductAttributeOptions") + .HasForeignKey("ProductAttributeId"); + }); + + modelBuilder.Entity("EasyAbp.EShop.Products.Products.ProductSku", b => + { + b.HasOne("EasyAbp.EShop.Products.Products.Product", null) + .WithMany("ProductSkus") + .HasForeignKey("ProductId"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("Actions") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("EntityChanges") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) + .WithMany("PropertyChanges") + .HasForeignKey("EntityChangeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany("Claims") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Claims") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Logins") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Roles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Tokens") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("UserClaims") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("Scopes") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope", null) + .WithMany("UserClaims") + .HasForeignKey("ApiResourceId", "Name") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("Secrets") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("Claims") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("AllowedCorsOrigins") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("AllowedGrantTypes") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("IdentityProviderRestrictions") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("PostLogoutRedirectUris") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("Properties") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("RedirectUris") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("AllowedScopes") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("ClientSecrets") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) + .WithMany("UserClaims") + .HasForeignKey("IdentityResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.HasOne("Volo.Abp.TenantManagement.Tenant", null) + .WithMany("ConnectionStrings") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/20200505145542_AddedOrder.cs b/samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/20200505145542_AddedOrder.cs new file mode 100644 index 00000000..247bdd28 --- /dev/null +++ b/samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/20200505145542_AddedOrder.cs @@ -0,0 +1,98 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace EasyMall.Migrations +{ + public partial class AddedOrder : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "OrdersOrders", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + IsDeleted = table.Column(nullable: false, defaultValue: false), + DeleterId = table.Column(nullable: true), + DeletionTime = table.Column(nullable: true), + TenantId = table.Column(nullable: true), + StoreId = table.Column(nullable: false), + CustomerUserId = table.Column(nullable: false), + OrderStatus = table.Column(nullable: false), + Currency = table.Column(nullable: true), + ProductTotalPrice = table.Column(nullable: false), + TotalDiscount = table.Column(nullable: false), + TotalPrice = table.Column(nullable: false), + RefundedAmount = table.Column(nullable: false), + CustomerRemark = table.Column(nullable: true), + StaffRemark = table.Column(nullable: true), + PaidTime = table.Column(nullable: true), + CompletionTime = table.Column(nullable: true), + CancelledTime = table.Column(nullable: true), + ReducedInventoryAfterPlacingTime = table.Column(nullable: true), + ReducedInventoryAfterPaymentTime = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_OrdersOrders", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "OrdersOrderLines", + columns: table => new + { + Id = table.Column(nullable: false), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + IsDeleted = table.Column(nullable: false, defaultValue: false), + DeleterId = table.Column(nullable: true), + DeletionTime = table.Column(nullable: true), + ProductId = table.Column(nullable: false), + ProductSkuId = table.Column(nullable: false), + ProductModificationTime = table.Column(nullable: false), + ProductDetailModificationTime = table.Column(nullable: false), + ProductName = table.Column(nullable: true), + SkuDescription = table.Column(nullable: true), + MediaResources = table.Column(nullable: true), + Currency = table.Column(nullable: true), + UnitPrice = table.Column(nullable: false), + TotalPrice = table.Column(nullable: false), + TotalDiscount = table.Column(nullable: false), + Quantity = table.Column(nullable: false), + OrderId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_OrdersOrderLines", x => x.Id); + table.ForeignKey( + name: "FK_OrdersOrderLines_OrdersOrders_OrderId", + column: x => x.OrderId, + principalTable: "OrdersOrders", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_OrdersOrderLines_OrderId", + table: "OrdersOrderLines", + column: "OrderId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "OrdersOrderLines"); + + migrationBuilder.DropTable( + name: "OrdersOrders"); + } + } +} diff --git a/samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/EasyMallMigrationsDbContextModelSnapshot.cs b/samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/EasyMallMigrationsDbContextModelSnapshot.cs index aae2bbce..5ef83a84 100644 --- a/samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/EasyMallMigrationsDbContextModelSnapshot.cs +++ b/samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/EasyMallMigrationsDbContextModelSnapshot.cs @@ -19,6 +19,187 @@ namespace EasyMall.Migrations .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + modelBuilder.Entity("EasyAbp.EShop.Orders.Orders.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CancelledTime") + .HasColumnType("datetime2"); + + b.Property("CompletionTime") + .HasColumnType("datetime2"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("nvarchar(max)"); + + b.Property("CustomerRemark") + .HasColumnType("nvarchar(max)"); + + b.Property("CustomerUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("OrderStatus") + .HasColumnType("int"); + + b.Property("PaidTime") + .HasColumnType("datetime2"); + + b.Property("ProductTotalPrice") + .HasColumnType("decimal(18,2)"); + + b.Property("ReducedInventoryAfterPaymentTime") + .HasColumnType("datetime2"); + + b.Property("ReducedInventoryAfterPlacingTime") + .HasColumnType("datetime2"); + + b.Property("RefundedAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("StaffRemark") + .HasColumnType("nvarchar(max)"); + + b.Property("StoreId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("TotalDiscount") + .HasColumnType("decimal(18,2)"); + + b.Property("TotalPrice") + .HasColumnType("decimal(18,2)"); + + b.HasKey("Id"); + + b.ToTable("OrdersOrders"); + }); + + modelBuilder.Entity("EasyAbp.EShop.Orders.Orders.OrderLine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("nvarchar(max)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("MediaResources") + .HasColumnType("nvarchar(max)"); + + b.Property("OrderId") + .HasColumnType("uniqueidentifier"); + + b.Property("ProductDetailModificationTime") + .HasColumnType("datetime2"); + + b.Property("ProductId") + .HasColumnType("uniqueidentifier"); + + b.Property("ProductModificationTime") + .HasColumnType("datetime2"); + + b.Property("ProductName") + .HasColumnType("nvarchar(max)"); + + b.Property("ProductSkuId") + .HasColumnType("uniqueidentifier"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("SkuDescription") + .HasColumnType("nvarchar(max)"); + + b.Property("TotalDiscount") + .HasColumnType("decimal(18,2)"); + + b.Property("TotalPrice") + .HasColumnType("decimal(18,2)"); + + b.Property("UnitPrice") + .HasColumnType("decimal(18,2)"); + + b.HasKey("Id"); + + b.HasIndex("OrderId"); + + b.ToTable("OrdersOrderLines"); + }); + modelBuilder.Entity("EasyAbp.EShop.Products.Categories.Category", b => { b.Property("Id") @@ -2232,6 +2413,13 @@ namespace EasyMall.Migrations b.ToTable("AbpTenantConnectionStrings"); }); + modelBuilder.Entity("EasyAbp.EShop.Orders.Orders.OrderLine", b => + { + b.HasOne("EasyAbp.EShop.Orders.Orders.Order", null) + .WithMany("OrderLines") + .HasForeignKey("OrderId"); + }); + modelBuilder.Entity("EasyAbp.EShop.Products.Products.ProductAttribute", b => { b.HasOne("EasyAbp.EShop.Products.Products.Product", null) diff --git a/samples/EasyMall/aspnet-core/src/EasyMall.Web/EasyMallWebModule.cs b/samples/EasyMall/aspnet-core/src/EasyMall.Web/EasyMallWebModule.cs index 9d50da33..9527be54 100644 --- a/samples/EasyMall/aspnet-core/src/EasyMall.Web/EasyMallWebModule.cs +++ b/samples/EasyMall/aspnet-core/src/EasyMall.Web/EasyMallWebModule.cs @@ -237,6 +237,26 @@ namespace EasyMall.Web options.SwaggerDoc("v1", new OpenApiInfo { Title = "EasyMall API", Version = "v1" }); options.DocInclusionPredicate((docName, description) => true); options.CustomSchemaIds(type => type.FullName); + options.AddSecurityRequirement(new OpenApiSecurityRequirement + { + { + new OpenApiSecurityScheme + { + Reference = new OpenApiReference() + { + Id = "Bearer", + Type = ReferenceType.SecurityScheme + } + }, Array.Empty() + } + }); + + options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme + { + Name = "Authorization", + In = ParameterLocation.Header, + Type = SecuritySchemeType.ApiKey + }); } ); }