From de04ab8cf17141e9c9878db69dab9353ae14b2a0 Mon Sep 17 00:00:00 2001 From: malik masis Date: Mon, 7 Mar 2022 15:03:12 +0300 Subject: [PATCH 01/32] Added list orders and its unit test Added list orders for Admin UI. --- .../Orders/GetOrdersInput.cs | 7 +++ .../Orders/IOrderAppService.cs | 1 + .../Orders/OrderAppService.cs | 9 ++- .../Orders/IOrderRepository.cs | 5 ++ .../Orders/EfCoreOrderRepository.cs | 12 ++++ .../OrderClientProxy.Generated.cs | 63 ++++++++++--------- .../ordering-generate-proxy.json | 37 +++++++++++ .../Orders/OrderApplication_Tests.cs | 32 +++++++--- 8 files changed, 127 insertions(+), 39 deletions(-) create mode 100644 services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/GetOrdersInput.cs diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/GetOrdersInput.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/GetOrdersInput.cs new file mode 100644 index 00000000..8be79fd0 --- /dev/null +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/GetOrdersInput.cs @@ -0,0 +1,7 @@ +namespace EShopOnAbp.OrderingService.Orders +{ + public class GetOrdersInput + { + public string Filter { get; set; } + } +} \ No newline at end of file diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/IOrderAppService.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/IOrderAppService.cs index 61282b4d..38cb1c94 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/IOrderAppService.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/IOrderAppService.cs @@ -10,5 +10,6 @@ public interface IOrderAppService : IApplicationService Task CreateAsync(OrderCreateDto input); Task GetAsync(Guid id); Task> GetMyOrdersAsync(GetMyOrdersInput input); + Task> GetOrdersAsync(GetOrdersInput input); Task GetByOrderNoAsync(int orderNo); } \ No newline at end of file diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs index 19c0701a..a152e801 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs @@ -34,9 +34,14 @@ public class OrderAppService : ApplicationService, IOrderAppService public async Task> GetMyOrdersAsync(GetMyOrdersInput input) { ISpecification specification = SpecificationFactory.Create(input.Filter); - var orders = await _orderRepository.GetOrdersByUserId(CurrentUser.GetId(), specification, true); - + return CreateOrderDtoMapping(orders); + } + + public async Task> GetOrdersAsync(GetOrdersInput input) + { + ISpecification specification = SpecificationFactory.Create(input.Filter); + var orders = await _orderRepository.GetOrders(specification, true); return CreateOrderDtoMapping(orders); } diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/IOrderRepository.cs b/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/IOrderRepository.cs index a9494c97..c031ea4f 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/IOrderRepository.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/IOrderRepository.cs @@ -15,6 +15,11 @@ public interface IOrderRepository : IRepository bool includeDetails = true, CancellationToken cancellationToken = default); + Task> GetOrders( + ISpecification spec, + bool includeDetails = true, + CancellationToken cancellationToken = default); + Task GetByOrderNoAsync(int orderNo, bool includeDetails = true, CancellationToken cancellationToken = default); diff --git a/services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/Orders/EfCoreOrderRepository.cs b/services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/Orders/EfCoreOrderRepository.cs index 45ef6948..c1fbe930 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/Orders/EfCoreOrderRepository.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/Orders/EfCoreOrderRepository.cs @@ -42,6 +42,18 @@ public class EfCoreOrderRepository : EfCoreRepository> GetOrders( + ISpecification spec, + bool includeDetails = false, + CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .IncludeDetails(includeDetails) + .Where(spec.ToExpression()) + .OrderByDescending(o => o.OrderDate) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + public async Task GetByOrderNoAsync( int orderNo, bool includeDetails = true, diff --git a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/OrderClientProxy.Generated.cs b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/OrderClientProxy.Generated.cs index 34926156..0a1c3b5b 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/OrderClientProxy.Generated.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/OrderClientProxy.Generated.cs @@ -10,42 +10,49 @@ using EShopOnAbp.OrderingService.Orders; using System.Collections.Generic; // ReSharper disable once CheckNamespace -namespace EShopOnAbp.OrderingService.Orders.ClientProxies +namespace EShopOnAbp.OrderingService.Orders.ClientProxies; + +[Dependency(ReplaceServices = true)] +[ExposeServices(typeof(IOrderAppService), typeof(OrderClientProxy))] +public partial class OrderClientProxy : ClientProxyBase, IOrderAppService { - [Dependency(ReplaceServices = true)] - [ExposeServices(typeof(IOrderAppService), typeof(OrderClientProxy))] - public partial class OrderClientProxy : ClientProxyBase, IOrderAppService + public virtual async Task GetAsync(Guid id) { - public virtual async Task GetAsync(Guid id) + return await RequestAsync(nameof(GetAsync), new ClientProxyRequestTypeValue { - return await RequestAsync(nameof(GetAsync), new ClientProxyRequestTypeValue - { - { typeof(Guid), id } - }); - } + { typeof(Guid), id } + }); + } - public virtual async Task> GetMyOrdersAsync(GetMyOrdersInput input) + public virtual async Task> GetMyOrdersAsync(GetMyOrdersInput input) + { + return await RequestAsync>(nameof(GetMyOrdersAsync), new ClientProxyRequestTypeValue { - return await RequestAsync>(nameof(GetMyOrdersAsync), new ClientProxyRequestTypeValue - { - { typeof(GetMyOrdersInput), input } - }); - } + { typeof(GetMyOrdersInput), input } + }); + } - public virtual async Task GetByOrderNoAsync(int orderNo) + public virtual async Task> GetOrdersAsync(GetOrdersInput input) + { + return await RequestAsync>(nameof(GetOrdersAsync), new ClientProxyRequestTypeValue { - return await RequestAsync(nameof(GetByOrderNoAsync), new ClientProxyRequestTypeValue - { - { typeof(int), orderNo } - }); - } + { typeof(GetOrdersInput), input } + }); + } - public virtual async Task CreateAsync(OrderCreateDto input) + public virtual async Task GetByOrderNoAsync(int orderNo) + { + return await RequestAsync(nameof(GetByOrderNoAsync), new ClientProxyRequestTypeValue + { + { typeof(int), orderNo } + }); + } + + public virtual async Task CreateAsync(OrderCreateDto input) + { + return await RequestAsync(nameof(CreateAsync), new ClientProxyRequestTypeValue { - return await RequestAsync(nameof(CreateAsync), new ClientProxyRequestTypeValue - { - { typeof(OrderCreateDto), input } - }); - } + { typeof(OrderCreateDto), input } + }); } } diff --git a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/ordering-generate-proxy.json b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/ordering-generate-proxy.json index ecfb20cf..edadeb72 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/ordering-generate-proxy.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/ordering-generate-proxy.json @@ -97,6 +97,43 @@ "allowAnonymous": null, "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" }, + "GetOrdersAsyncByInput": { + "uniqueName": "GetOrdersAsyncByInput", + "name": "GetOrdersAsync", + "httpMethod": "GET", + "url": "api/ordering/order/orders", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "EShopOnAbp.OrderingService.Orders.GetOrdersInput, EShopOnAbp.OrderingService.Application.Contracts", + "type": "EShopOnAbp.OrderingService.Orders.GetOrdersInput", + "typeSimple": "EShopOnAbp.OrderingService.Orders.GetOrdersInput", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "input", + "name": "Filter", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + } + ], + "returnValue": { + "type": "System.Collections.Generic.List", + "typeSimple": "[EShopOnAbp.OrderingService.Orders.OrderDto]" + }, + "allowAnonymous": null, + "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" + }, "GetByOrderNoAsyncByOrderNo": { "uniqueName": "GetByOrderNoAsyncByOrderNo", "name": "GetByOrderNoAsync", diff --git a/services/ordering/test/EShopOnAbp.OrderingService.Application.Tests/Orders/OrderApplication_Tests.cs b/services/ordering/test/EShopOnAbp.OrderingService.Application.Tests/Orders/OrderApplication_Tests.cs index 247737af..589b1d99 100644 --- a/services/ordering/test/EShopOnAbp.OrderingService.Application.Tests/Orders/OrderApplication_Tests.cs +++ b/services/ordering/test/EShopOnAbp.OrderingService.Application.Tests/Orders/OrderApplication_Tests.cs @@ -1,15 +1,15 @@ -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using NSubstitute; using Shouldly; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; using Volo.Abp.Users; using Xunit; namespace EShopOnAbp.OrderingService.Orders; -public class OrderApplication_Tests:OrderingServiceApplicationTestBase +public class OrderApplication_Tests : OrderingServiceApplicationTestBase { private readonly IOrderAppService _orderAppService; private readonly TestData _testData; @@ -38,8 +38,12 @@ public class OrderApplication_Tests:OrderingServiceApplicationTestBase { new OrderItemCreateDto() { - Discount = 0, Units = 2, PictureUrl = "", ProductCode = "Test-001", ProductId = Guid.NewGuid(), - ProductName = "Test product", UnitPrice = 150 + Discount = 0, + Units = 2, PictureUrl = string.Empty, + ProductCode = "Test-001", + ProductId = Guid.NewGuid(), + ProductName = "Test product", + UnitPrice = 150 } }; @@ -48,14 +52,24 @@ public class OrderApplication_Tests:OrderingServiceApplicationTestBase PaymentMethod = "paypal", Address = new OrderAddressDto() { - City = "Test City", Country = "Test Country", Description = "No Description", Street = "Test Street", + City = "Test City", + Country = "Test Country", + Description = "No Description", + Street = "Test Street", ZipCode = "Test ZipCode" }, Products = orderItems }); - + // Get Order by OrderNo; var myOrder = await _orderAppService.GetByOrderNoAsync(placedOrder.OrderNo); myOrder.ShouldNotBeNull(); + + // Get all orders + var orders = await _orderAppService.GetOrdersAsync(new GetOrdersInput() + { + Filter = string.Empty, + }); + orders.ShouldNotBeNull(); } } \ No newline at end of file From 418f060507c868e7650e962a70b3f636f6b706b3 Mon Sep 17 00:00:00 2001 From: malik masis Date: Tue, 8 Mar 2022 15:10:26 +0300 Subject: [PATCH 02/32] Added SetOrder for different situation Still need the improvement --- .../Orders/IOrderAppService.cs | 1 + .../Orders/OrderDto.cs | 2 +- .../Orders/UpdateOrderDto.cs | 7 +++ .../Orders/OrderAppService.cs | 17 ++++-- .../Orders/Order.cs | 21 +++++-- .../Orders/OrderStatus.cs | 7 ++- .../OrderClientProxy.Generated.cs | 9 +++ .../ordering-generate-proxy.json | 57 +++++++++++++++++++ .../Orders/OrderApplication_Tests.cs | 12 +++- 9 files changed, 119 insertions(+), 14 deletions(-) create mode 100644 services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/UpdateOrderDto.cs diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/IOrderAppService.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/IOrderAppService.cs index 38cb1c94..7812d9a7 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/IOrderAppService.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/IOrderAppService.cs @@ -12,4 +12,5 @@ public interface IOrderAppService : IApplicationService Task> GetMyOrdersAsync(GetMyOrdersInput input); Task> GetOrdersAsync(GetOrdersInput input); Task GetByOrderNoAsync(int orderNo); + Task UpdateAsync(Guid id, UpdateOrderDto input); } \ No newline at end of file diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/OrderDto.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/OrderDto.cs index 29ca1943..a946b377 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/OrderDto.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/OrderDto.cs @@ -7,7 +7,7 @@ namespace EShopOnAbp.OrderingService.Orders; public class OrderDto : EntityDto { public DateTime OrderDate { get; set; } - public int OrderNo {get;set;} + public int OrderNo { get; set; } public int OrderStatusId { get; set; } public string OrderStatus { get; set; } public string PaymentMethod { get; set; } diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/UpdateOrderDto.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/UpdateOrderDto.cs new file mode 100644 index 00000000..c907dea9 --- /dev/null +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/UpdateOrderDto.cs @@ -0,0 +1,7 @@ +namespace EShopOnAbp.OrderingService.Orders +{ + public class UpdateOrderDto + { + public int OrderStatusId { get; set; } + } +} \ No newline at end of file diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs index a152e801..40911bf2 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs @@ -1,9 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using EShopOnAbp.OrderingService.Localization; +using EShopOnAbp.OrderingService.Localization; using EShopOnAbp.OrderingService.Orders.Specifications; using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; using Volo.Abp.Application.Services; using Volo.Abp.Specifications; using Volo.Abp.Users; @@ -52,6 +52,15 @@ public class OrderAppService : ApplicationService, IOrderAppService return CreateOrderDtoMapping(order); } + public async Task UpdateAsync(Guid id, UpdateOrderDto input) + { + var order = await _orderRepository.GetAsync(id); + order.SetOrder(input.OrderStatusId); + await _orderRepository.UpdateAsync(order); + return CreateOrderDtoMapping(order); + + } + public async Task CreateAsync(OrderCreateDto input) { var orderItems = GetProductListTuple(input.Products); diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/Order.cs b/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/Order.cs index 989208a0..085d6b56 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/Order.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/Order.cs @@ -1,8 +1,8 @@ -using System; +using EShopOnAbp.PaymentService.PaymentRequests; +using JetBrains.Annotations; +using System; using System.Collections.Generic; using System.Linq; -using EShopOnAbp.PaymentService.PaymentRequests; -using JetBrains.Annotations; using Volo.Abp; using Volo.Abp.Domain.Entities; @@ -25,7 +25,7 @@ public class Order : AggregateRoot { } - internal Order(Guid id, Buyer buyer, Address address, [NotNull]string paymentMethod, Guid? paymentRequestId = null) : base(id) + internal Order(Guid id, Buyer buyer, Address address, [NotNull] string paymentMethod, Guid? paymentRequestId = null) : base(id) { _orderStatusId = OrderStatus.Placed.Id; OrderDate = DateTime.UtcNow; @@ -33,7 +33,7 @@ public class Order : AggregateRoot Buyer = buyer; Address = address; PaymentRequestId = paymentRequestId; - PaymentMethod = Check.NotNullOrEmpty(paymentMethod,nameof(paymentMethod),maxLength:OrderConstants.OrderPaymentMethodNameMaxLength); + PaymentMethod = Check.NotNullOrEmpty(paymentMethod, nameof(paymentMethod), maxLength: OrderConstants.OrderPaymentMethodNameMaxLength); PaymentStatus = PaymentRequestState.Waiting.ToString(); // From PaymentService.Domain.Shared OrderItems = new List(); } @@ -87,4 +87,15 @@ public class Order : AggregateRoot { return OrderItems.Sum(o => o.Units * o.UnitPrice); } + + public Order SetOrder(int orderStatus) + { + if (orderStatus == OrderStatus.Cancelled.Id) + { + return this; + } + //TODO no enough to update the object. + _orderStatusId = orderStatus; + return this; + } } \ No newline at end of file diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/OrderStatus.cs b/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/OrderStatus.cs index dcd06c06..93c4efdb 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/OrderStatus.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/OrderStatus.cs @@ -5,6 +5,7 @@ using Volo.Abp; namespace EShopOnAbp.OrderingService.Orders; +//TODO will use enum instead of Enumeration public class OrderStatus : Enumeration { public static OrderStatus Placed = new OrderStatus(1, nameof(Placed).ToLowerInvariant()); @@ -22,12 +23,12 @@ public class OrderStatus : Enumeration public static OrderStatus FromName(string name) { var state = List() - .SingleOrDefault(s => String.Equals(s.Name, name, StringComparison.CurrentCultureIgnoreCase)); + .SingleOrDefault(s => string.Equals(s.Name, name, StringComparison.CurrentCultureIgnoreCase)); if (state == null) { throw new BusinessException(OrderingServiceErrorCodes.OrderingStatusNotFound) - .WithData("OrderStatus", String.Join(",", List().Select(s => s.Name))); + .WithData("OrderStatus", string.Join(",", List().Select(s => s.Name))); } return state; @@ -40,7 +41,7 @@ public class OrderStatus : Enumeration if (state == null) { throw new BusinessException(OrderingServiceErrorCodes.OrderingStatusNotFound) - .WithData("OrderStatus", String.Join(",", List().Select(s => s.Name))); + .WithData("OrderStatus", string.Join(",", List().Select(s => s.Name))); } return state; diff --git a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/OrderClientProxy.Generated.cs b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/OrderClientProxy.Generated.cs index 0a1c3b5b..e6ff5ec0 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/OrderClientProxy.Generated.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/OrderClientProxy.Generated.cs @@ -48,6 +48,15 @@ public partial class OrderClientProxy : ClientProxyBase, IOrde }); } + public virtual async Task UpdateAsync(Guid id, UpdateOrderDto input) + { + return await RequestAsync(nameof(UpdateAsync), new ClientProxyRequestTypeValue + { + { typeof(Guid), id }, + { typeof(UpdateOrderDto), input } + }); + } + public virtual async Task CreateAsync(OrderCreateDto input) { return await RequestAsync(nameof(CreateAsync), new ClientProxyRequestTypeValue diff --git a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/ordering-generate-proxy.json b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/ordering-generate-proxy.json index edadeb72..9e8c75e3 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/ordering-generate-proxy.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/ordering-generate-proxy.json @@ -171,6 +171,63 @@ "allowAnonymous": null, "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" }, + "UpdateAsyncByIdAndInput": { + "uniqueName": "UpdateAsyncByIdAndInput", + "name": "UpdateAsync", + "httpMethod": "PUT", + "url": "api/ordering/order/{id}", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "input", + "typeAsString": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto, EShopOnAbp.OrderingService.Application.Contracts", + "type": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto", + "typeSimple": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "id", + "name": "id", + "jsonName": null, + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": [], + "bindingSourceId": "Path", + "descriptorName": "" + }, + { + "nameOnMethod": "input", + "name": "input", + "jsonName": null, + "type": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto", + "typeSimple": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "Body", + "descriptorName": "" + } + ], + "returnValue": { + "type": "EShopOnAbp.OrderingService.Orders.OrderDto", + "typeSimple": "EShopOnAbp.OrderingService.Orders.OrderDto" + }, + "allowAnonymous": null, + "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" + }, "CreateAsyncByInput": { "uniqueName": "CreateAsyncByInput", "name": "CreateAsync", diff --git a/services/ordering/test/EShopOnAbp.OrderingService.Application.Tests/Orders/OrderApplication_Tests.cs b/services/ordering/test/EShopOnAbp.OrderingService.Application.Tests/Orders/OrderApplication_Tests.cs index 589b1d99..531fae8f 100644 --- a/services/ordering/test/EShopOnAbp.OrderingService.Application.Tests/Orders/OrderApplication_Tests.cs +++ b/services/ordering/test/EShopOnAbp.OrderingService.Application.Tests/Orders/OrderApplication_Tests.cs @@ -39,7 +39,8 @@ public class OrderApplication_Tests : OrderingServiceApplicationTestBase new OrderItemCreateDto() { Discount = 0, - Units = 2, PictureUrl = string.Empty, + Units = 2, + PictureUrl = string.Empty, ProductCode = "Test-001", ProductId = Guid.NewGuid(), ProductName = "Test product", @@ -65,6 +66,15 @@ public class OrderApplication_Tests : OrderingServiceApplicationTestBase var myOrder = await _orderAppService.GetByOrderNoAsync(placedOrder.OrderNo); myOrder.ShouldNotBeNull(); + + var cancelledMyOrder = await _orderAppService.UpdateAsync(placedOrder.Id, new UpdateOrderDto() + { + OrderStatusId = OrderStatus.Cancelled.Id, + }); + //TODO - temp value - it should be Cancelled + cancelledMyOrder.OrderStatus.ShouldBe(OrderStatus.Placed.ToString()); + + // Get all orders var orders = await _orderAppService.GetOrdersAsync(new GetOrdersInput() { From f66839e5685b53d6fcfceee8fabf3b7d168b9c79 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Thu, 10 Mar 2022 17:33:30 +0300 Subject: [PATCH 03/32] feat: generate angular project for ordering --- apps/angular/angular.json | 31 + apps/angular/projects/ordering/README.md | 24 + .../projects/ordering/config/enums/index.ts | 2 + .../ordering/config/enums/policy-names.ts | 7 + .../ordering/config/enums/route-names.ts | 4 + .../config/order-config-routing.module.ts | 10 + .../ordering/config/order-config.module.ts | 13 + .../ordering/config/providers/index.ts | 1 + .../config/providers/route.provider.ts | 23 + .../projects/ordering/config/public-api.ts | 3 + apps/angular/projects/ordering/karma.conf.js | 44 + .../angular/projects/ordering/ng-package.json | 7 + apps/angular/projects/ordering/package.json | 11 + .../ordering/src/lib/ordering.service.spec.ts | 16 + .../ordering/src/lib/ordering.service.ts | 9 + .../projects/ordering/src/lib/proxy/README.md | 17 + .../src/lib/proxy/generate-proxy.json | 2206 +++++++++++++++++ .../projects/ordering/src/lib/proxy/index.ts | 2 + .../ordering/src/lib/proxy/orders/index.ts | 2 + .../ordering/src/lib/proxy/orders/models.ts | 62 + .../src/lib/proxy/orders/order.service.ts | 59 + .../ordering/src/ordering-routing.module.ts | 13 + .../projects/ordering/src/ordering.module.ts | 13 + .../projects/ordering/src/pages/index.ts | 1 + .../ordering/src/pages/orders/index.ts | 3 + .../src/pages/orders/orders-routing.module.ts | 11 + .../src/pages/orders/orders.component.css | 0 .../src/pages/orders/orders.component.html | 1 + .../src/pages/orders/orders.component.spec.ts | 25 + .../src/pages/orders/orders.component.ts | 15 + .../src/pages/orders/orders.module.ts | 17 + .../projects/ordering/src/public-api.ts | 7 + apps/angular/projects/ordering/src/test.ts | 28 + .../projects/ordering/tsconfig.lib.json | 20 + .../projects/ordering/tsconfig.lib.prod.json | 10 + .../projects/ordering/tsconfig.spec.json | 17 + apps/angular/src/app/app-routing.module.ts | 4 + apps/angular/src/environments/environment.ts | 4 + apps/angular/tsconfig.json | 4 + 39 files changed, 2746 insertions(+) create mode 100644 apps/angular/projects/ordering/README.md create mode 100644 apps/angular/projects/ordering/config/enums/index.ts create mode 100644 apps/angular/projects/ordering/config/enums/policy-names.ts create mode 100644 apps/angular/projects/ordering/config/enums/route-names.ts create mode 100644 apps/angular/projects/ordering/config/order-config-routing.module.ts create mode 100644 apps/angular/projects/ordering/config/order-config.module.ts create mode 100644 apps/angular/projects/ordering/config/providers/index.ts create mode 100644 apps/angular/projects/ordering/config/providers/route.provider.ts create mode 100644 apps/angular/projects/ordering/config/public-api.ts create mode 100644 apps/angular/projects/ordering/karma.conf.js create mode 100644 apps/angular/projects/ordering/ng-package.json create mode 100644 apps/angular/projects/ordering/package.json create mode 100644 apps/angular/projects/ordering/src/lib/ordering.service.spec.ts create mode 100644 apps/angular/projects/ordering/src/lib/ordering.service.ts create mode 100644 apps/angular/projects/ordering/src/lib/proxy/README.md create mode 100644 apps/angular/projects/ordering/src/lib/proxy/generate-proxy.json create mode 100644 apps/angular/projects/ordering/src/lib/proxy/index.ts create mode 100644 apps/angular/projects/ordering/src/lib/proxy/orders/index.ts create mode 100644 apps/angular/projects/ordering/src/lib/proxy/orders/models.ts create mode 100644 apps/angular/projects/ordering/src/lib/proxy/orders/order.service.ts create mode 100644 apps/angular/projects/ordering/src/ordering-routing.module.ts create mode 100644 apps/angular/projects/ordering/src/ordering.module.ts create mode 100644 apps/angular/projects/ordering/src/pages/index.ts create mode 100644 apps/angular/projects/ordering/src/pages/orders/index.ts create mode 100644 apps/angular/projects/ordering/src/pages/orders/orders-routing.module.ts create mode 100644 apps/angular/projects/ordering/src/pages/orders/orders.component.css create mode 100644 apps/angular/projects/ordering/src/pages/orders/orders.component.html create mode 100644 apps/angular/projects/ordering/src/pages/orders/orders.component.spec.ts create mode 100644 apps/angular/projects/ordering/src/pages/orders/orders.component.ts create mode 100644 apps/angular/projects/ordering/src/pages/orders/orders.module.ts create mode 100644 apps/angular/projects/ordering/src/public-api.ts create mode 100644 apps/angular/projects/ordering/src/test.ts create mode 100644 apps/angular/projects/ordering/tsconfig.lib.json create mode 100644 apps/angular/projects/ordering/tsconfig.lib.prod.json create mode 100644 apps/angular/projects/ordering/tsconfig.spec.json diff --git a/apps/angular/angular.json b/apps/angular/angular.json index 9c0d2921..51220794 100644 --- a/apps/angular/angular.json +++ b/apps/angular/angular.json @@ -187,6 +187,37 @@ } } } + }, + "ordering": { + "projectType": "library", + "root": "projects/ordering", + "sourceRoot": "projects/ordering/src", + "prefix": "lib", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:ng-packagr", + "options": { + "project": "projects/ordering/ng-package.json" + }, + "configurations": { + "production": { + "tsConfig": "projects/ordering/tsconfig.lib.prod.json" + }, + "development": { + "tsConfig": "projects/ordering/tsconfig.lib.json" + } + }, + "defaultConfiguration": "production" + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "main": "projects/ordering/src/test.ts", + "tsConfig": "projects/ordering/tsconfig.spec.json", + "karmaConfig": "projects/ordering/karma.conf.js" + } + } + } } }, "defaultProject": "EShopOnAbp", diff --git a/apps/angular/projects/ordering/README.md b/apps/angular/projects/ordering/README.md new file mode 100644 index 00000000..c9c1adf8 --- /dev/null +++ b/apps/angular/projects/ordering/README.md @@ -0,0 +1,24 @@ +# Ordering + +This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.2.0. + +## Code scaffolding + +Run `ng generate component component-name --project ordering` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ordering`. +> Note: Don't forget to add `--project ordering` or else it will be added to the default project in your `angular.json` file. + +## Build + +Run `ng build ordering` to build the project. The build artifacts will be stored in the `dist/` directory. + +## Publishing + +After building your library with `ng build ordering`, go to the dist folder `cd dist/ordering` and run `npm publish`. + +## Running unit tests + +Run `ng test ordering` to execute the unit tests via [Karma](https://karma-runner.github.io). + +## Further help + +To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. diff --git a/apps/angular/projects/ordering/config/enums/index.ts b/apps/angular/projects/ordering/config/enums/index.ts new file mode 100644 index 00000000..4a7a6a0e --- /dev/null +++ b/apps/angular/projects/ordering/config/enums/index.ts @@ -0,0 +1,2 @@ +export * from './policy-names'; +export * from './route-names'; diff --git a/apps/angular/projects/ordering/config/enums/policy-names.ts b/apps/angular/projects/ordering/config/enums/policy-names.ts new file mode 100644 index 00000000..6ddc7800 --- /dev/null +++ b/apps/angular/projects/ordering/config/enums/policy-names.ts @@ -0,0 +1,7 @@ +export const enum eOrderingPolicyNames { + Ordering = 'CatalogService.Products', + + ProductManagementCreate = 'CatalogService.Products.Create', + ProductManagementUpdate = 'CatalogService.Products.Update', + ProductManagementDelete = 'CatalogService.Products.Delete', +} diff --git a/apps/angular/projects/ordering/config/enums/route-names.ts b/apps/angular/projects/ordering/config/enums/route-names.ts new file mode 100644 index 00000000..764ca296 --- /dev/null +++ b/apps/angular/projects/ordering/config/enums/route-names.ts @@ -0,0 +1,4 @@ +export const enum eOrderingRouteNames { + Ordering = 'CatalogService::Menu:CatalogManagement', + Orders = 'CatalogService::Menu:Products', +} diff --git a/apps/angular/projects/ordering/config/order-config-routing.module.ts b/apps/angular/projects/ordering/config/order-config-routing.module.ts new file mode 100644 index 00000000..b82cfada --- /dev/null +++ b/apps/angular/projects/ordering/config/order-config-routing.module.ts @@ -0,0 +1,10 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; + +const routes: Routes = []; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class OrderConfigRoutingModule { } diff --git a/apps/angular/projects/ordering/config/order-config.module.ts b/apps/angular/projects/ordering/config/order-config.module.ts new file mode 100644 index 00000000..039f0675 --- /dev/null +++ b/apps/angular/projects/ordering/config/order-config.module.ts @@ -0,0 +1,13 @@ +import { ModuleWithProviders, NgModule } from '@angular/core'; +import { ORDERING_ROUTE_PROVIDERS } from './providers/route.provider'; + + +@NgModule() +export class OrderConfigModule { + static forRoot(): ModuleWithProviders { + return { + ngModule: OrderConfigModule, + providers: [ORDERING_ROUTE_PROVIDERS], + }; + } +} diff --git a/apps/angular/projects/ordering/config/providers/index.ts b/apps/angular/projects/ordering/config/providers/index.ts new file mode 100644 index 00000000..fe08efba --- /dev/null +++ b/apps/angular/projects/ordering/config/providers/index.ts @@ -0,0 +1 @@ +export * from './route.provider'; diff --git a/apps/angular/projects/ordering/config/providers/route.provider.ts b/apps/angular/projects/ordering/config/providers/route.provider.ts new file mode 100644 index 00000000..42f5e37d --- /dev/null +++ b/apps/angular/projects/ordering/config/providers/route.provider.ts @@ -0,0 +1,23 @@ +import { eLayoutType, RoutesService } from '@abp/ng.core'; +import { APP_INITIALIZER } from '@angular/core'; +import { eOrderingPolicyNames } from '../enums/policy-names'; +import { eOrderingRouteNames} from '../enums/route-names'; + +export const ORDERING_ROUTE_PROVIDERS = [ + { provide: APP_INITIALIZER, useFactory: configureRoutes, deps: [RoutesService], multi: true }, +]; + +export function configureRoutes(routesService: RoutesService) { + return () => { + routesService.add([ + { + path: '/ordering', + name: eOrderingRouteNames.Ordering, + layout: eLayoutType.application, + parentName: null, + iconClass: 'bi bi-collection-fill', + requiredPolicy: eOrderingPolicyNames.Ordering, + }, + ]); + }; +} diff --git a/apps/angular/projects/ordering/config/public-api.ts b/apps/angular/projects/ordering/config/public-api.ts new file mode 100644 index 00000000..c0d0e091 --- /dev/null +++ b/apps/angular/projects/ordering/config/public-api.ts @@ -0,0 +1,3 @@ +export * from './enums'; +export * from './providers'; +export * from './order-config.module' \ No newline at end of file diff --git a/apps/angular/projects/ordering/karma.conf.js b/apps/angular/projects/ordering/karma.conf.js new file mode 100644 index 00000000..89eb35c4 --- /dev/null +++ b/apps/angular/projects/ordering/karma.conf.js @@ -0,0 +1,44 @@ +// Karma configuration file, see link for more information +// https://karma-runner.github.io/1.0/config/configuration-file.html + +module.exports = function (config) { + config.set({ + basePath: '', + frameworks: ['jasmine', '@angular-devkit/build-angular'], + plugins: [ + require('karma-jasmine'), + require('karma-chrome-launcher'), + require('karma-jasmine-html-reporter'), + require('karma-coverage'), + require('@angular-devkit/build-angular/plugins/karma') + ], + client: { + jasmine: { + // you can add configuration options for Jasmine here + // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html + // for example, you can disable the random execution with `random: false` + // or set a specific seed with `seed: 4321` + }, + clearContext: false // leave Jasmine Spec Runner output visible in browser + }, + jasmineHtmlReporter: { + suppressAll: true // removes the duplicated traces + }, + coverageReporter: { + dir: require('path').join(__dirname, '../../coverage/ordering'), + subdir: '.', + reporters: [ + { type: 'html' }, + { type: 'text-summary' } + ] + }, + reporters: ['progress', 'kjhtml'], + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: ['Chrome'], + singleRun: false, + restartOnFileChange: true + }); +}; diff --git a/apps/angular/projects/ordering/ng-package.json b/apps/angular/projects/ordering/ng-package.json new file mode 100644 index 00000000..71266c4e --- /dev/null +++ b/apps/angular/projects/ordering/ng-package.json @@ -0,0 +1,7 @@ +{ + "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", + "dest": "../../dist/ordering", + "lib": { + "entryFile": "src/public-api.ts" + } +} \ No newline at end of file diff --git a/apps/angular/projects/ordering/package.json b/apps/angular/projects/ordering/package.json new file mode 100644 index 00000000..d3fc1318 --- /dev/null +++ b/apps/angular/projects/ordering/package.json @@ -0,0 +1,11 @@ +{ + "name": "@eshoponabp/ordering", + "version": "0.0.1", + "peerDependencies": { + "@angular/common": "^12.2.0", + "@angular/core": "^12.2.0" + }, + "dependencies": { + "tslib": "^2.3.0" + } +} \ No newline at end of file diff --git a/apps/angular/projects/ordering/src/lib/ordering.service.spec.ts b/apps/angular/projects/ordering/src/lib/ordering.service.spec.ts new file mode 100644 index 00000000..187fa810 --- /dev/null +++ b/apps/angular/projects/ordering/src/lib/ordering.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { OrderingService } from './ordering.service'; + +describe('OrderingService', () => { + let service: OrderingService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(OrderingService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/apps/angular/projects/ordering/src/lib/ordering.service.ts b/apps/angular/projects/ordering/src/lib/ordering.service.ts new file mode 100644 index 00000000..fd106cf5 --- /dev/null +++ b/apps/angular/projects/ordering/src/lib/ordering.service.ts @@ -0,0 +1,9 @@ +import { Injectable } from '@angular/core'; + +@Injectable({ + providedIn: 'root' +}) +export class OrderingService { + + constructor() { } +} diff --git a/apps/angular/projects/ordering/src/lib/proxy/README.md b/apps/angular/projects/ordering/src/lib/proxy/README.md new file mode 100644 index 00000000..767dfd0f --- /dev/null +++ b/apps/angular/projects/ordering/src/lib/proxy/README.md @@ -0,0 +1,17 @@ +# Proxy Generation Output + +This directory includes the output of the latest proxy generation. +The files and folders in it will be overwritten when proxy generation is run again. +Therefore, please do not place your own content in this folder. + +In addition, `generate-proxy.json` works like a lock file. +It includes information used by the proxy generator, so please do not delete or modify it. + +Finally, the name of the files and folders should not be changed for two reasons: +- Proxy generator will keep creating them at those paths and you will have multiple copies of the same content. +- ABP Suite generates files which include imports from this folder. + +> **Important Notice:** If you are building a module and are planning to publish to npm, +> some of the generated proxies are likely to be exported from public-api.ts file. In such a case, +> please make sure you export files directly and not from barrel exports. In other words, +> do not include index.ts exports in your public-api.ts exports. diff --git a/apps/angular/projects/ordering/src/lib/proxy/generate-proxy.json b/apps/angular/projects/ordering/src/lib/proxy/generate-proxy.json new file mode 100644 index 00000000..1f441a49 --- /dev/null +++ b/apps/angular/projects/ordering/src/lib/proxy/generate-proxy.json @@ -0,0 +1,2206 @@ +{ + "generated": [ + "ordering" + ], + "modules": { + "abp": { + "rootPath": "abp", + "remoteServiceName": "abp", + "controllers": { + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController": { + "controllerName": "AbpApplicationConfiguration", + "controllerGroupName": "AbpApplicationConfiguration", + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController", + "interfaces": [ + { + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IAbpApplicationConfigurationAppService" + } + ], + "actions": { + "GetAsync": { + "uniqueName": "GetAsync", + "name": "GetAsync", + "httpMethod": "GET", + "url": "api/abp/application-configuration", + "supportedVersions": [], + "parametersOnMethod": [], + "parameters": [], + "returnValue": { + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IAbpApplicationConfigurationAppService" + } + } + }, + "Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController": { + "controllerName": "AbpApiDefinition", + "controllerGroupName": "AbpApiDefinition", + "type": "Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController", + "interfaces": [], + "actions": { + "GetByModel": { + "uniqueName": "GetByModel", + "name": "Get", + "httpMethod": "GET", + "url": "api/abp/api-definition", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "model", + "typeAsString": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModelRequestDto, Volo.Abp.Http", + "type": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModelRequestDto", + "typeSimple": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModelRequestDto", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "model", + "name": "IncludeTypes", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "model" + } + ], + "returnValue": { + "type": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel", + "typeSimple": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController" + } + } + } + } + }, + "ordering": { + "rootPath": "ordering", + "remoteServiceName": "Ordering", + "controllers": { + "EShopOnAbp.OrderingService.Orders.OrderAppService": { + "controllerName": "Order", + "controllerGroupName": "Order", + "type": "EShopOnAbp.OrderingService.Orders.OrderAppService", + "interfaces": [ + { + "type": "Volo.Abp.Validation.IValidationEnabled" + }, + { + "type": "Volo.Abp.Auditing.IAuditingEnabled" + }, + { + "type": "Volo.Abp.GlobalFeatures.IGlobalFeatureCheckingEnabled" + }, + { + "type": "EShopOnAbp.OrderingService.Orders.IOrderAppService" + } + ], + "actions": { + "GetAsyncById": { + "uniqueName": "GetAsyncById", + "name": "GetAsync", + "httpMethod": "GET", + "url": "api/ordering/order/{id}", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "id", + "name": "id", + "jsonName": null, + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": [], + "bindingSourceId": "Path", + "descriptorName": "" + } + ], + "returnValue": { + "type": "EShopOnAbp.OrderingService.Orders.OrderDto", + "typeSimple": "EShopOnAbp.OrderingService.Orders.OrderDto" + }, + "allowAnonymous": null, + "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" + }, + "GetMyOrdersAsyncByInput": { + "uniqueName": "GetMyOrdersAsyncByInput", + "name": "GetMyOrdersAsync", + "httpMethod": "GET", + "url": "api/ordering/order/my-orders", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "EShopOnAbp.OrderingService.Orders.GetMyOrdersInput, EShopOnAbp.OrderingService.Application.Contracts", + "type": "EShopOnAbp.OrderingService.Orders.GetMyOrdersInput", + "typeSimple": "EShopOnAbp.OrderingService.Orders.GetMyOrdersInput", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "input", + "name": "Filter", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + } + ], + "returnValue": { + "type": "System.Collections.Generic.List", + "typeSimple": "[EShopOnAbp.OrderingService.Orders.OrderDto]" + }, + "allowAnonymous": null, + "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" + }, + "GetOrdersAsyncByInput": { + "uniqueName": "GetOrdersAsyncByInput", + "name": "GetOrdersAsync", + "httpMethod": "GET", + "url": "api/ordering/order/orders", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "EShopOnAbp.OrderingService.Orders.GetOrdersInput, EShopOnAbp.OrderingService.Application.Contracts", + "type": "EShopOnAbp.OrderingService.Orders.GetOrdersInput", + "typeSimple": "EShopOnAbp.OrderingService.Orders.GetOrdersInput", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "input", + "name": "Filter", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + } + ], + "returnValue": { + "type": "System.Collections.Generic.List", + "typeSimple": "[EShopOnAbp.OrderingService.Orders.OrderDto]" + }, + "allowAnonymous": null, + "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" + }, + "GetByOrderNoAsyncByOrderNo": { + "uniqueName": "GetByOrderNoAsyncByOrderNo", + "name": "GetByOrderNoAsync", + "httpMethod": "GET", + "url": "api/ordering/order/by-order-no", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "orderNo", + "typeAsString": "System.Int32, System.Private.CoreLib", + "type": "System.Int32", + "typeSimple": "number", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "orderNo", + "name": "orderNo", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "" + } + ], + "returnValue": { + "type": "EShopOnAbp.OrderingService.Orders.OrderDto", + "typeSimple": "EShopOnAbp.OrderingService.Orders.OrderDto" + }, + "allowAnonymous": null, + "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" + }, + "UpdateAsyncByIdAndInput": { + "uniqueName": "UpdateAsyncByIdAndInput", + "name": "UpdateAsync", + "httpMethod": "PUT", + "url": "api/ordering/order/{id}", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "input", + "typeAsString": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto, EShopOnAbp.OrderingService.Application.Contracts", + "type": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto", + "typeSimple": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "id", + "name": "id", + "jsonName": null, + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": [], + "bindingSourceId": "Path", + "descriptorName": "" + }, + { + "nameOnMethod": "input", + "name": "input", + "jsonName": null, + "type": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto", + "typeSimple": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "Body", + "descriptorName": "" + } + ], + "returnValue": { + "type": "EShopOnAbp.OrderingService.Orders.OrderDto", + "typeSimple": "EShopOnAbp.OrderingService.Orders.OrderDto" + }, + "allowAnonymous": null, + "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" + }, + "CreateAsyncByInput": { + "uniqueName": "CreateAsyncByInput", + "name": "CreateAsync", + "httpMethod": "POST", + "url": "api/ordering/order", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "EShopOnAbp.OrderingService.Orders.OrderCreateDto, EShopOnAbp.OrderingService.Application.Contracts", + "type": "EShopOnAbp.OrderingService.Orders.OrderCreateDto", + "typeSimple": "EShopOnAbp.OrderingService.Orders.OrderCreateDto", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "input", + "name": "input", + "jsonName": null, + "type": "EShopOnAbp.OrderingService.Orders.OrderCreateDto", + "typeSimple": "EShopOnAbp.OrderingService.Orders.OrderCreateDto", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "Body", + "descriptorName": "" + } + ], + "returnValue": { + "type": "EShopOnAbp.OrderingService.Orders.OrderDto", + "typeSimple": "EShopOnAbp.OrderingService.Orders.OrderDto" + }, + "allowAnonymous": null, + "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" + } + } + } + } + } + }, + "types": { + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Localization", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationConfigurationDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationConfigurationDto", + "isRequired": false + }, + { + "name": "Auth", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationAuthConfigurationDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationAuthConfigurationDto", + "isRequired": false + }, + { + "name": "Setting", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationSettingConfigurationDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationSettingConfigurationDto", + "isRequired": false + }, + { + "name": "CurrentUser", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.CurrentUserDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.CurrentUserDto", + "isRequired": false + }, + { + "name": "Features", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationFeatureConfigurationDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationFeatureConfigurationDto", + "isRequired": false + }, + { + "name": "MultiTenancy", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.MultiTenancyInfoDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.MultiTenancyInfoDto", + "isRequired": false + }, + { + "name": "CurrentTenant", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.CurrentTenantDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.MultiTenancy.CurrentTenantDto", + "isRequired": false + }, + { + "name": "Timing", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.TimingDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.TimingDto", + "isRequired": false + }, + { + "name": "Clock", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClockDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClockDto", + "isRequired": false + }, + { + "name": "ObjectExtensions", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ObjectExtensionsDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ObjectExtensionsDto", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationConfigurationDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Values", + "jsonName": null, + "type": "{System.String:System.Collections.Generic.Dictionary}", + "typeSimple": "{string:System.Collections.Generic.Dictionary}", + "isRequired": false + }, + { + "name": "Languages", + "jsonName": null, + "type": "[Volo.Abp.Localization.LanguageInfo]", + "typeSimple": "[Volo.Abp.Localization.LanguageInfo]", + "isRequired": false + }, + { + "name": "CurrentCulture", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.CurrentCultureDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.CurrentCultureDto", + "isRequired": false + }, + { + "name": "DefaultResourceName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "LanguagesMap", + "jsonName": null, + "type": "{System.String:[Volo.Abp.NameValue]}", + "typeSimple": "{string:[Volo.Abp.NameValue]}", + "isRequired": false + }, + { + "name": "LanguageFilesMap", + "jsonName": null, + "type": "{System.String:[Volo.Abp.NameValue]}", + "typeSimple": "{string:[Volo.Abp.NameValue]}", + "isRequired": false + } + ] + }, + "Volo.Abp.Localization.LanguageInfo": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "CultureName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "UiCultureName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "DisplayName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "FlagIcon", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.CurrentCultureDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "DisplayName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "EnglishName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "ThreeLetterIsoLanguageName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "TwoLetterIsoLanguageName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "IsRightToLeft", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false + }, + { + "name": "CultureName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "Name", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "NativeName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "DateTimeFormat", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.DateTimeFormatDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.DateTimeFormatDto", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.DateTimeFormatDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "CalendarAlgorithmType", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "DateTimeFormatLong", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "ShortDatePattern", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "FullDateTimePattern", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "DateSeparator", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "ShortTimePattern", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "LongTimePattern", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + } + ] + }, + "Volo.Abp.NameValue": { + "baseType": "Volo.Abp.NameValue", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [] + }, + "Volo.Abp.NameValue": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": [ + "T" + ], + "properties": [ + { + "name": "Name", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "Value", + "jsonName": null, + "type": "T", + "typeSimple": "T", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationAuthConfigurationDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Policies", + "jsonName": null, + "type": "{System.String:System.Boolean}", + "typeSimple": "{string:boolean}", + "isRequired": false + }, + { + "name": "GrantedPolicies", + "jsonName": null, + "type": "{System.String:System.Boolean}", + "typeSimple": "{string:boolean}", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationSettingConfigurationDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Values", + "jsonName": null, + "type": "{System.String:System.String}", + "typeSimple": "{string:string}", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.CurrentUserDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "IsAuthenticated", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false + }, + { + "name": "Id", + "jsonName": null, + "type": "System.Guid?", + "typeSimple": "string?", + "isRequired": false + }, + { + "name": "TenantId", + "jsonName": null, + "type": "System.Guid?", + "typeSimple": "string?", + "isRequired": false + }, + { + "name": "ImpersonatorUserId", + "jsonName": null, + "type": "System.Guid?", + "typeSimple": "string?", + "isRequired": false + }, + { + "name": "ImpersonatorTenantId", + "jsonName": null, + "type": "System.Guid?", + "typeSimple": "string?", + "isRequired": false + }, + { + "name": "ImpersonatorUserName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "ImpersonatorTenantName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "UserName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "Name", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "SurName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "Email", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "EmailVerified", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false + }, + { + "name": "PhoneNumber", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "PhoneNumberVerified", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false + }, + { + "name": "Roles", + "jsonName": null, + "type": "[System.String]", + "typeSimple": "[string]", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationFeatureConfigurationDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Values", + "jsonName": null, + "type": "{System.String:System.String}", + "typeSimple": "{string:string}", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.MultiTenancy.MultiTenancyInfoDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "IsEnabled", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.MultiTenancy.CurrentTenantDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Id", + "jsonName": null, + "type": "System.Guid?", + "typeSimple": "string?", + "isRequired": false + }, + { + "name": "Name", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "IsAvailable", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.TimingDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "TimeZone", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.TimeZone", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.TimeZone", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.TimeZone": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Iana", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IanaTimeZone", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IanaTimeZone", + "isRequired": false + }, + { + "name": "Windows", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.WindowsTimeZone", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.WindowsTimeZone", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IanaTimeZone": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "TimeZoneName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.WindowsTimeZone": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "TimeZoneId", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClockDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Kind", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ObjectExtensionsDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Modules", + "jsonName": null, + "type": "{System.String:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ModuleExtensionDto}", + "typeSimple": "{string:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ModuleExtensionDto}", + "isRequired": false + }, + { + "name": "Enums", + "jsonName": null, + "type": "{System.String:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionEnumDto}", + "typeSimple": "{string:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionEnumDto}", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ModuleExtensionDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Entities", + "jsonName": null, + "type": "{System.String:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.EntityExtensionDto}", + "typeSimple": "{string:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.EntityExtensionDto}", + "isRequired": false + }, + { + "name": "Configuration", + "jsonName": null, + "type": "{System.String:System.Object}", + "typeSimple": "{string:object}", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.EntityExtensionDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Properties", + "jsonName": null, + "type": "{System.String:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyDto}", + "typeSimple": "{string:Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyDto}", + "isRequired": false + }, + { + "name": "Configuration", + "jsonName": null, + "type": "{System.String:System.Object}", + "typeSimple": "{string:object}", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Type", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "TypeSimple", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "DisplayName", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.LocalizableStringDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.LocalizableStringDto", + "isRequired": false + }, + { + "name": "Api", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiDto", + "isRequired": false + }, + { + "name": "Ui", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiDto", + "isRequired": false + }, + { + "name": "Attributes", + "jsonName": null, + "type": "[Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyAttributeDto]", + "typeSimple": "[Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyAttributeDto]", + "isRequired": false + }, + { + "name": "Configuration", + "jsonName": null, + "type": "{System.String:System.Object}", + "typeSimple": "{string:object}", + "isRequired": false + }, + { + "name": "DefaultValue", + "jsonName": null, + "type": "System.Object", + "typeSimple": "object", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.LocalizableStringDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Name", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "Resource", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "OnGet", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiGetDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiGetDto", + "isRequired": false + }, + { + "name": "OnCreate", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiCreateDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiCreateDto", + "isRequired": false + }, + { + "name": "OnUpdate", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiUpdateDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiUpdateDto", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiGetDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "IsAvailable", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiCreateDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "IsAvailable", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyApiUpdateDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "IsAvailable", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "OnTable", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiTableDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiTableDto", + "isRequired": false + }, + { + "name": "OnCreateForm", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiFormDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiFormDto", + "isRequired": false + }, + { + "name": "OnEditForm", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiFormDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiFormDto", + "isRequired": false + }, + { + "name": "Lookup", + "jsonName": null, + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiLookupDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiLookupDto", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiTableDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "IsVisible", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiFormDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "IsVisible", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyUiLookupDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Url", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "ResultListPropertyName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "DisplayPropertyName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "ValuePropertyName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "FilterParamName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionPropertyAttributeDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "TypeSimple", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "Config", + "jsonName": null, + "type": "{System.String:System.Object}", + "typeSimple": "{string:object}", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionEnumDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Fields", + "jsonName": null, + "type": "[Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionEnumFieldDto]", + "typeSimple": "[Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionEnumFieldDto]", + "isRequired": false + }, + { + "name": "LocalizationResource", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + } + ] + }, + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending.ExtensionEnumFieldDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Name", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "Value", + "jsonName": null, + "type": "System.Object", + "typeSimple": "object", + "isRequired": false + } + ] + }, + "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModelRequestDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "IncludeTypes", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false + } + ] + }, + "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Modules", + "jsonName": null, + "type": "{System.String:Volo.Abp.Http.Modeling.ModuleApiDescriptionModel}", + "typeSimple": "{string:Volo.Abp.Http.Modeling.ModuleApiDescriptionModel}", + "isRequired": false + }, + { + "name": "Types", + "jsonName": null, + "type": "{System.String:Volo.Abp.Http.Modeling.TypeApiDescriptionModel}", + "typeSimple": "{string:Volo.Abp.Http.Modeling.TypeApiDescriptionModel}", + "isRequired": false + } + ] + }, + "Volo.Abp.Http.Modeling.ModuleApiDescriptionModel": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "RootPath", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "RemoteServiceName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "Controllers", + "jsonName": null, + "type": "{System.String:Volo.Abp.Http.Modeling.ControllerApiDescriptionModel}", + "typeSimple": "{string:Volo.Abp.Http.Modeling.ControllerApiDescriptionModel}", + "isRequired": false + } + ] + }, + "Volo.Abp.Http.Modeling.ControllerApiDescriptionModel": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "ControllerName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "ControllerGroupName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "Type", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "Interfaces", + "jsonName": null, + "type": "[Volo.Abp.Http.Modeling.ControllerInterfaceApiDescriptionModel]", + "typeSimple": "[Volo.Abp.Http.Modeling.ControllerInterfaceApiDescriptionModel]", + "isRequired": false + }, + { + "name": "Actions", + "jsonName": null, + "type": "{System.String:Volo.Abp.Http.Modeling.ActionApiDescriptionModel}", + "typeSimple": "{string:Volo.Abp.Http.Modeling.ActionApiDescriptionModel}", + "isRequired": false + } + ] + }, + "Volo.Abp.Http.Modeling.ControllerInterfaceApiDescriptionModel": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Type", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + } + ] + }, + "Volo.Abp.Http.Modeling.ActionApiDescriptionModel": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "UniqueName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "Name", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "HttpMethod", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "Url", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "SupportedVersions", + "jsonName": null, + "type": "[System.String]", + "typeSimple": "[string]", + "isRequired": false + }, + { + "name": "ParametersOnMethod", + "jsonName": null, + "type": "[Volo.Abp.Http.Modeling.MethodParameterApiDescriptionModel]", + "typeSimple": "[Volo.Abp.Http.Modeling.MethodParameterApiDescriptionModel]", + "isRequired": false + }, + { + "name": "Parameters", + "jsonName": null, + "type": "[Volo.Abp.Http.Modeling.ParameterApiDescriptionModel]", + "typeSimple": "[Volo.Abp.Http.Modeling.ParameterApiDescriptionModel]", + "isRequired": false + }, + { + "name": "ReturnValue", + "jsonName": null, + "type": "Volo.Abp.Http.Modeling.ReturnValueApiDescriptionModel", + "typeSimple": "Volo.Abp.Http.Modeling.ReturnValueApiDescriptionModel", + "isRequired": false + }, + { + "name": "AllowAnonymous", + "jsonName": null, + "type": "System.Boolean?", + "typeSimple": "boolean?", + "isRequired": false + }, + { + "name": "ImplementFrom", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + } + ] + }, + "Volo.Abp.Http.Modeling.MethodParameterApiDescriptionModel": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Name", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "TypeAsString", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "Type", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "TypeSimple", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "IsOptional", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false + }, + { + "name": "DefaultValue", + "jsonName": null, + "type": "System.Object", + "typeSimple": "object", + "isRequired": false + } + ] + }, + "Volo.Abp.Http.Modeling.ParameterApiDescriptionModel": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "NameOnMethod", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "Name", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "JsonName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "Type", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "TypeSimple", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "IsOptional", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false + }, + { + "name": "DefaultValue", + "jsonName": null, + "type": "System.Object", + "typeSimple": "object", + "isRequired": false + }, + { + "name": "ConstraintTypes", + "jsonName": null, + "type": "[System.String]", + "typeSimple": "[string]", + "isRequired": false + }, + { + "name": "BindingSourceId", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "DescriptorName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + } + ] + }, + "Volo.Abp.Http.Modeling.ReturnValueApiDescriptionModel": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Type", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "TypeSimple", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + } + ] + }, + "Volo.Abp.Http.Modeling.TypeApiDescriptionModel": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "BaseType", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "IsEnum", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false + }, + { + "name": "EnumNames", + "jsonName": null, + "type": "[System.String]", + "typeSimple": "[string]", + "isRequired": false + }, + { + "name": "EnumValues", + "jsonName": null, + "type": "[System.Object]", + "typeSimple": "[object]", + "isRequired": false + }, + { + "name": "GenericArguments", + "jsonName": null, + "type": "[System.String]", + "typeSimple": "[string]", + "isRequired": false + }, + { + "name": "Properties", + "jsonName": null, + "type": "[Volo.Abp.Http.Modeling.PropertyApiDescriptionModel]", + "typeSimple": "[Volo.Abp.Http.Modeling.PropertyApiDescriptionModel]", + "isRequired": false + } + ] + }, + "Volo.Abp.Http.Modeling.PropertyApiDescriptionModel": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Name", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "JsonName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "Type", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "TypeSimple", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "IsRequired", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isRequired": false + } + ] + }, + "EShopOnAbp.OrderingService.Orders.OrderDto": { + "baseType": "Volo.Abp.Application.Dtos.EntityDto", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "OrderDate", + "jsonName": null, + "type": "System.DateTime", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "OrderNo", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isRequired": false + }, + { + "name": "OrderStatusId", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isRequired": false + }, + { + "name": "OrderStatus", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "PaymentMethod", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "Buyer", + "jsonName": null, + "type": "EShopOnAbp.OrderingService.Orders.BuyerDto", + "typeSimple": "EShopOnAbp.OrderingService.Orders.BuyerDto", + "isRequired": false + }, + { + "name": "Address", + "jsonName": null, + "type": "EShopOnAbp.OrderingService.Orders.OrderAddressDto", + "typeSimple": "EShopOnAbp.OrderingService.Orders.OrderAddressDto", + "isRequired": false + }, + { + "name": "Items", + "jsonName": null, + "type": "[EShopOnAbp.OrderingService.Orders.OrderItemDto]", + "typeSimple": "[EShopOnAbp.OrderingService.Orders.OrderItemDto]", + "isRequired": false + } + ] + }, + "Volo.Abp.Application.Dtos.EntityDto": { + "baseType": "Volo.Abp.Application.Dtos.EntityDto", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": [ + "TKey" + ], + "properties": [ + { + "name": "Id", + "jsonName": null, + "type": "TKey", + "typeSimple": "TKey", + "isRequired": false + } + ] + }, + "Volo.Abp.Application.Dtos.EntityDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [] + }, + "EShopOnAbp.OrderingService.Orders.BuyerDto": { + "baseType": "Volo.Abp.Application.Dtos.EntityDto", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Name", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "Email", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + } + ] + }, + "EShopOnAbp.OrderingService.Orders.OrderAddressDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Description", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "Street", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": true + }, + { + "name": "City", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": true + }, + { + "name": "Country", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": true + }, + { + "name": "ZipCode", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": true + } + ] + }, + "EShopOnAbp.OrderingService.Orders.OrderItemDto": { + "baseType": "Volo.Abp.Application.Dtos.EntityDto", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "ProductId", + "jsonName": null, + "type": "System.Guid", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "ProductName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "PictureUrl", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "UnitPrice", + "jsonName": null, + "type": "System.Decimal", + "typeSimple": "number", + "isRequired": false + }, + { + "name": "Discount", + "jsonName": null, + "type": "System.Decimal", + "typeSimple": "number", + "isRequired": false + }, + { + "name": "Units", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isRequired": false + } + ] + }, + "EShopOnAbp.OrderingService.Orders.GetMyOrdersInput": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Filter", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + } + ] + }, + "EShopOnAbp.OrderingService.Orders.GetOrdersInput": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Filter", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + } + ] + }, + "EShopOnAbp.OrderingService.Orders.UpdateOrderDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "OrderStatusId", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isRequired": false + } + ] + }, + "EShopOnAbp.OrderingService.Orders.OrderCreateDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "PaymentMethod", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "Address", + "jsonName": null, + "type": "EShopOnAbp.OrderingService.Orders.OrderAddressDto", + "typeSimple": "EShopOnAbp.OrderingService.Orders.OrderAddressDto", + "isRequired": false + }, + { + "name": "Products", + "jsonName": null, + "type": "[EShopOnAbp.OrderingService.Orders.OrderItemCreateDto]", + "typeSimple": "[EShopOnAbp.OrderingService.Orders.OrderItemCreateDto]", + "isRequired": false + } + ] + }, + "EShopOnAbp.OrderingService.Orders.OrderItemCreateDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "ProductId", + "jsonName": null, + "type": "System.Guid", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "ProductCode", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "ProductName", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "PictureUrl", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "UnitPrice", + "jsonName": null, + "type": "System.Decimal", + "typeSimple": "number", + "isRequired": false + }, + { + "name": "Discount", + "jsonName": null, + "type": "System.Decimal", + "typeSimple": "number", + "isRequired": false + }, + { + "name": "Units", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isRequired": false + } + ] + } + } +} \ No newline at end of file diff --git a/apps/angular/projects/ordering/src/lib/proxy/index.ts b/apps/angular/projects/ordering/src/lib/proxy/index.ts new file mode 100644 index 00000000..4939e1de --- /dev/null +++ b/apps/angular/projects/ordering/src/lib/proxy/index.ts @@ -0,0 +1,2 @@ +import * as Orders from './orders'; +export { Orders }; diff --git a/apps/angular/projects/ordering/src/lib/proxy/orders/index.ts b/apps/angular/projects/ordering/src/lib/proxy/orders/index.ts new file mode 100644 index 00000000..d6641f7d --- /dev/null +++ b/apps/angular/projects/ordering/src/lib/proxy/orders/index.ts @@ -0,0 +1,2 @@ +export * from './models'; +export * from './order.service'; diff --git a/apps/angular/projects/ordering/src/lib/proxy/orders/models.ts b/apps/angular/projects/ordering/src/lib/proxy/orders/models.ts new file mode 100644 index 00000000..071bbefe --- /dev/null +++ b/apps/angular/projects/ordering/src/lib/proxy/orders/models.ts @@ -0,0 +1,62 @@ +import type { EntityDto } from '@abp/ng.core'; + +export interface BuyerDto extends EntityDto { + name?: string; + email?: string; +} + +export interface GetMyOrdersInput { + filter?: string; +} + +export interface GetOrdersInput { + filter?: string; +} + +export interface OrderAddressDto { + description?: string; + street: string; + city: string; + country: string; + zipCode: string; +} + +export interface OrderCreateDto { + paymentMethod?: string; + address: OrderAddressDto; + products: OrderItemCreateDto[]; +} + +export interface OrderDto extends EntityDto { + orderDate?: string; + orderNo: number; + orderStatusId: number; + orderStatus?: string; + paymentMethod?: string; + buyer: BuyerDto; + address: OrderAddressDto; + items: OrderItemDto[]; +} + +export interface OrderItemCreateDto { + productId?: string; + productCode?: string; + productName?: string; + pictureUrl?: string; + unitPrice: number; + discount: number; + units: number; +} + +export interface OrderItemDto extends EntityDto { + productId?: string; + productName?: string; + pictureUrl?: string; + unitPrice: number; + discount: number; + units: number; +} + +export interface UpdateOrderDto { + orderStatusId: number; +} diff --git a/apps/angular/projects/ordering/src/lib/proxy/orders/order.service.ts b/apps/angular/projects/ordering/src/lib/proxy/orders/order.service.ts new file mode 100644 index 00000000..5ea19fdf --- /dev/null +++ b/apps/angular/projects/ordering/src/lib/proxy/orders/order.service.ts @@ -0,0 +1,59 @@ +import type { GetMyOrdersInput, GetOrdersInput, OrderCreateDto, OrderDto, UpdateOrderDto } from './models'; +import { RestService } from '@abp/ng.core'; +import { Injectable } from '@angular/core'; + +@Injectable({ + providedIn: 'root', +}) +export class OrderService { + apiName = 'Ordering'; + + create = (input: OrderCreateDto) => + this.restService.request({ + method: 'POST', + url: '/api/ordering/order', + body: input, + }, + { apiName: this.apiName }); + + get = (id: string) => + this.restService.request({ + method: 'GET', + url: `/api/ordering/order/${id}`, + }, + { apiName: this.apiName }); + + getByOrderNo = (orderNo: number) => + this.restService.request({ + method: 'GET', + url: '/api/ordering/order/by-order-no', + params: { orderNo }, + }, + { apiName: this.apiName }); + + getMyOrders = (input: GetMyOrdersInput) => + this.restService.request({ + method: 'GET', + url: '/api/ordering/order/my-orders', + params: { filter: input.filter }, + }, + { apiName: this.apiName }); + + getOrders = (input: GetOrdersInput) => + this.restService.request({ + method: 'GET', + url: '/api/ordering/order/orders', + params: { filter: input.filter }, + }, + { apiName: this.apiName }); + + update = (id: string, input: UpdateOrderDto) => + this.restService.request({ + method: 'PUT', + url: `/api/ordering/order/${id}`, + body: input, + }, + { apiName: this.apiName }); + + constructor(private restService: RestService) {} +} diff --git a/apps/angular/projects/ordering/src/ordering-routing.module.ts b/apps/angular/projects/ordering/src/ordering-routing.module.ts new file mode 100644 index 00000000..3ed73a9a --- /dev/null +++ b/apps/angular/projects/ordering/src/ordering-routing.module.ts @@ -0,0 +1,13 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; + +const routes: Routes = [ + { path: '', redirectTo: 'orders', pathMatch: 'full' }, + { path: 'orders', loadChildren: () => import('./pages/orders/orders.module').then(m => m.OrdersModule) }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class OrderingRoutingModule {} diff --git a/apps/angular/projects/ordering/src/ordering.module.ts b/apps/angular/projects/ordering/src/ordering.module.ts new file mode 100644 index 00000000..7c7702f5 --- /dev/null +++ b/apps/angular/projects/ordering/src/ordering.module.ts @@ -0,0 +1,13 @@ +import { NgModule } from '@angular/core'; +import { OrderingRoutingModule } from './ordering-routing.module'; + + +@NgModule({ + declarations: [], + imports: [ + OrderingRoutingModule + ], + exports: [] +}) +export class OrderingModule { +} diff --git a/apps/angular/projects/ordering/src/pages/index.ts b/apps/angular/projects/ordering/src/pages/index.ts new file mode 100644 index 00000000..66f41a6a --- /dev/null +++ b/apps/angular/projects/ordering/src/pages/index.ts @@ -0,0 +1 @@ +export * from './orders'; diff --git a/apps/angular/projects/ordering/src/pages/orders/index.ts b/apps/angular/projects/ordering/src/pages/orders/index.ts new file mode 100644 index 00000000..56501c17 --- /dev/null +++ b/apps/angular/projects/ordering/src/pages/orders/index.ts @@ -0,0 +1,3 @@ +export * from './orders-routing.module'; +export * from './orders.component'; +export * from './orders.module'; diff --git a/apps/angular/projects/ordering/src/pages/orders/orders-routing.module.ts b/apps/angular/projects/ordering/src/pages/orders/orders-routing.module.ts new file mode 100644 index 00000000..58e8f8a7 --- /dev/null +++ b/apps/angular/projects/ordering/src/pages/orders/orders-routing.module.ts @@ -0,0 +1,11 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import { OrdersComponent } from './orders.component'; + +const routes: Routes = [{ path: '', component: OrdersComponent }]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class OrdersRoutingModule { } diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.css b/apps/angular/projects/ordering/src/pages/orders/orders.component.css new file mode 100644 index 00000000..e69de29b diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.html b/apps/angular/projects/ordering/src/pages/orders/orders.component.html new file mode 100644 index 00000000..66000b4f --- /dev/null +++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.html @@ -0,0 +1 @@ +

orders works!

diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.spec.ts b/apps/angular/projects/ordering/src/pages/orders/orders.component.spec.ts new file mode 100644 index 00000000..63136e07 --- /dev/null +++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { OrdersComponent } from './orders.component'; + +describe('OrdersComponent', () => { + let component: OrdersComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ OrdersComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(OrdersComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.ts b/apps/angular/projects/ordering/src/pages/orders/orders.component.ts new file mode 100644 index 00000000..a07554f1 --- /dev/null +++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'lib-orders', + templateUrl: './orders.component.html', + styleUrls: ['./orders.component.css'] +}) +export class OrdersComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.module.ts b/apps/angular/projects/ordering/src/pages/orders/orders.module.ts new file mode 100644 index 00000000..0b6e8a06 --- /dev/null +++ b/apps/angular/projects/ordering/src/pages/orders/orders.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { OrdersRoutingModule } from './orders-routing.module'; +import { OrdersComponent } from './orders.component'; + + +@NgModule({ + declarations: [ + OrdersComponent + ], + imports: [ + CommonModule, + OrdersRoutingModule + ] +}) +export class OrdersModule { } diff --git a/apps/angular/projects/ordering/src/public-api.ts b/apps/angular/projects/ordering/src/public-api.ts new file mode 100644 index 00000000..c36799d1 --- /dev/null +++ b/apps/angular/projects/ordering/src/public-api.ts @@ -0,0 +1,7 @@ +/* + * Public API Surface of ordering + */ + +export * from './pages/index'; +export * from './ordering.module'; +export * from './lib/proxy/index'; diff --git a/apps/angular/projects/ordering/src/test.ts b/apps/angular/projects/ordering/src/test.ts new file mode 100644 index 00000000..b84c0c21 --- /dev/null +++ b/apps/angular/projects/ordering/src/test.ts @@ -0,0 +1,28 @@ +// This file is required by karma.conf.js and loads recursively all the .spec and framework files + +import 'zone.js'; +import 'zone.js/testing'; +import { getTestBed } from '@angular/core/testing'; +import { + BrowserDynamicTestingModule, + platformBrowserDynamicTesting +} from '@angular/platform-browser-dynamic/testing'; + +declare const require: { + context(path: string, deep?: boolean, filter?: RegExp): { + keys(): string[]; + (id: string): T; + }; +}; + +// First, initialize the Angular testing environment. +getTestBed().initTestEnvironment( + BrowserDynamicTestingModule, + platformBrowserDynamicTesting(), + { teardown: { destroyAfterEach: true }}, +); + +// Then we find all the tests. +const context = require.context('./', true, /\.spec\.ts$/); +// And load the modules. +context.keys().map(context); diff --git a/apps/angular/projects/ordering/tsconfig.lib.json b/apps/angular/projects/ordering/tsconfig.lib.json new file mode 100644 index 00000000..1407202d --- /dev/null +++ b/apps/angular/projects/ordering/tsconfig.lib.json @@ -0,0 +1,20 @@ +/* To learn more about this file see: https://angular.io/config/tsconfig. */ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "../../out-tsc/lib", + "target": "es2015", + "declaration": true, + "declarationMap": true, + "inlineSources": true, + "types": [], + "lib": [ + "dom", + "es2018" + ] + }, + "exclude": [ + "src/test.ts", + "**/*.spec.ts" + ] +} diff --git a/apps/angular/projects/ordering/tsconfig.lib.prod.json b/apps/angular/projects/ordering/tsconfig.lib.prod.json new file mode 100644 index 00000000..06de549e --- /dev/null +++ b/apps/angular/projects/ordering/tsconfig.lib.prod.json @@ -0,0 +1,10 @@ +/* To learn more about this file see: https://angular.io/config/tsconfig. */ +{ + "extends": "./tsconfig.lib.json", + "compilerOptions": { + "declarationMap": false + }, + "angularCompilerOptions": { + "compilationMode": "partial" + } +} diff --git a/apps/angular/projects/ordering/tsconfig.spec.json b/apps/angular/projects/ordering/tsconfig.spec.json new file mode 100644 index 00000000..715dd0a5 --- /dev/null +++ b/apps/angular/projects/ordering/tsconfig.spec.json @@ -0,0 +1,17 @@ +/* To learn more about this file see: https://angular.io/config/tsconfig. */ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "../../out-tsc/spec", + "types": [ + "jasmine" + ] + }, + "files": [ + "src/test.ts" + ], + "include": [ + "**/*.spec.ts", + "**/*.d.ts" + ] +} diff --git a/apps/angular/src/app/app-routing.module.ts b/apps/angular/src/app/app-routing.module.ts index 22f64039..53e402d8 100644 --- a/apps/angular/src/app/app-routing.module.ts +++ b/apps/angular/src/app/app-routing.module.ts @@ -29,6 +29,10 @@ const routes: Routes = [ path: 'catalog', loadChildren: () => import('@eshoponabp/catalog').then(m => m.CatalogModule), }, + { + path: 'ordering', + loadChildren: () => import('@eshoponabp/ordering').then(m => m.OrderingModule), + }, ]; @NgModule({ diff --git a/apps/angular/src/environments/environment.ts b/apps/angular/src/environments/environment.ts index 78d67435..b9654b01 100644 --- a/apps/angular/src/environments/environment.ts +++ b/apps/angular/src/environments/environment.ts @@ -25,5 +25,9 @@ export const environment = { url: 'https://localhost:44354', rootNamespace: 'EShopOnAbp.CatalogService', }, + Ordering:{ + url: "https://localhost:44356", + rootNamespace: 'EShopOnAbp.OrderingService', + } }, } as Environment; diff --git a/apps/angular/tsconfig.json b/apps/angular/tsconfig.json index 8b1f5709..13998410 100644 --- a/apps/angular/tsconfig.json +++ b/apps/angular/tsconfig.json @@ -22,6 +22,10 @@ "node_modules/@eshoponabp/catalog", "projects/catalog/src/public-api.ts", ], + "@eshoponabp/ordering": [ + "node_modules/@eshoponabp/ordering", + "projects/ordering/src/public-api.ts", + ], } }, "angularCompilerOptions": { From c6ad45023d82d34ac6cfe9dff43f1454b129cca8 Mon Sep 17 00:00:00 2001 From: malik masis Date: Thu, 10 Mar 2022 18:41:36 +0300 Subject: [PATCH 04/32] Added cancel processes It will been continued enhancement. --- .../Orders/UpdateOrderDto.cs | 6 ++++- .../Orders/OrderAppService.cs | 13 +++++++--- .../Orders/OrderCancelledEto.cs | 16 ++++++++++++ .../Orders/Order.cs | 13 ++++++++-- .../Orders/OrderManager.cs | 24 +++++++++++++++++ .../Orders/OrderApplication_Tests.cs | 4 +-- .../EShopOnAbp.PaymentService.Domain.csproj | 4 +++ .../OrderCancelledEventHandler.cs | 26 +++++++++++++++++++ 8 files changed, 98 insertions(+), 8 deletions(-) create mode 100644 services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Orders/OrderCancelledEto.cs create mode 100644 services/payment/src/EShopOnAbp.PaymentService.Domain/EventHandlers/OrderCancelledEventHandler.cs diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/UpdateOrderDto.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/UpdateOrderDto.cs index c907dea9..adf69220 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/UpdateOrderDto.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/UpdateOrderDto.cs @@ -1,7 +1,11 @@ -namespace EShopOnAbp.OrderingService.Orders +using System; + +namespace EShopOnAbp.OrderingService.Orders { public class UpdateOrderDto { public int OrderStatusId { get; set; } + public Guid PaymentRequestId { get; set; } + public string PaymentRequestStatus { get; set; } } } \ No newline at end of file diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs index 40911bf2..29bae4f0 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs @@ -55,10 +55,17 @@ public class OrderAppService : ApplicationService, IOrderAppService public async Task UpdateAsync(Guid id, UpdateOrderDto input) { var order = await _orderRepository.GetAsync(id); - order.SetOrder(input.OrderStatusId); - await _orderRepository.UpdateAsync(order); - return CreateOrderDtoMapping(order); + if (input.OrderStatusId == OrderStatus.Shipped.Id) + { + order.SetOrderAsShipped(input.OrderStatusId); + await _orderRepository.UpdateAsync(order); + } + else if (input.OrderStatusId == OrderStatus.Cancelled.Id) + { + await _orderManager.CancelOrderAsync(id, input.PaymentRequestId, input.PaymentRequestStatus); + } + return CreateOrderDtoMapping(order); } public async Task CreateAsync(OrderCreateDto input) diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Orders/OrderCancelledEto.cs b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Orders/OrderCancelledEto.cs new file mode 100644 index 00000000..62e221fd --- /dev/null +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Orders/OrderCancelledEto.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using Volo.Abp.Domain.Entities.Events.Distributed; +using Volo.Abp.EventBus; + +namespace EShopOnAbp.OrderingService.Orders; + +[EventName("EShopOnAbp.Order.Cancelled")] +public class OrderCancelledEto : EtoBase +{ + public Guid OrderId { get; set; } + public int OrderNo { get; set; } + public DateTime OrderDate { get; set; } + public BuyerEto Buyer { get; set; } + public List Items { get; set; } = new(); +} \ No newline at end of file diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/Order.cs b/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/Order.cs index 085d6b56..802ec1a9 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/Order.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/Order.cs @@ -59,6 +59,15 @@ public class Order : AggregateRoot return this; } + public Order SetOrderCancelled(Guid paymentRequestId, string paymentRequestStatus) + { + PaymentRequestId = paymentRequestId; + PaymentStatus = paymentRequestStatus; + OrderStatus = OrderStatus.Cancelled; + + return this; + } + public Order AddOrderItem(Guid id, Guid productId, string productName, string productCode, decimal unitPrice, decimal discount, string pictureUrl, int units = 1) { @@ -88,14 +97,14 @@ public class Order : AggregateRoot return OrderItems.Sum(o => o.Units * o.UnitPrice); } - public Order SetOrder(int orderStatus) + public Order SetOrderAsShipped(int orderStatus) { if (orderStatus == OrderStatus.Cancelled.Id) { return this; } //TODO no enough to update the object. - _orderStatusId = orderStatus; + _orderStatusId = OrderStatus.Shipped.Id; return this; } } \ No newline at end of file diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/OrderManager.cs b/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/OrderManager.cs index 60e2c41d..37da005a 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/OrderManager.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/OrderManager.cs @@ -91,6 +91,30 @@ public class OrderManager : DomainService return await _orderRepository.UpdateAsync(order, autoSave: true); } + public async Task CancelOrderAsync(Guid orderId, Guid paymentRequestId, string paymentRequestStatus) + { + var order = await _orderRepository.GetAsync(orderId); + if (order == null) + { + throw new BusinessException(OrderingServiceErrorCodes.OrderWithIdNotFound) + .WithData("OrderId", orderId); + } + + order.SetOrderCancelled(paymentRequestId, paymentRequestStatus); + + // Publish order cancelled event + await _distributedEventBus.PublishAsync(new OrderCancelledEto + { + OrderId = order.Id, + OrderDate = order.OrderDate, + OrderNo = order.OrderNo, + Buyer = GetBuyerEto(order.Buyer), + Items = GetProductItemEtoList(order.OrderItems) + }); + + return await _orderRepository.UpdateAsync(order, autoSave: true); + } + private BuyerEto GetBuyerEto(Buyer buyer) { return new BuyerEto diff --git a/services/ordering/test/EShopOnAbp.OrderingService.Application.Tests/Orders/OrderApplication_Tests.cs b/services/ordering/test/EShopOnAbp.OrderingService.Application.Tests/Orders/OrderApplication_Tests.cs index 531fae8f..b6543bfe 100644 --- a/services/ordering/test/EShopOnAbp.OrderingService.Application.Tests/Orders/OrderApplication_Tests.cs +++ b/services/ordering/test/EShopOnAbp.OrderingService.Application.Tests/Orders/OrderApplication_Tests.cs @@ -69,9 +69,9 @@ public class OrderApplication_Tests : OrderingServiceApplicationTestBase var cancelledMyOrder = await _orderAppService.UpdateAsync(placedOrder.Id, new UpdateOrderDto() { - OrderStatusId = OrderStatus.Cancelled.Id, + OrderStatusId = OrderStatus.Shipped.Id, }); - //TODO - temp value - it should be Cancelled + //TODO - temp value - it should be Shipped cancelledMyOrder.OrderStatus.ShouldBe(OrderStatus.Placed.ToString()); diff --git a/services/payment/src/EShopOnAbp.PaymentService.Domain/EShopOnAbp.PaymentService.Domain.csproj b/services/payment/src/EShopOnAbp.PaymentService.Domain/EShopOnAbp.PaymentService.Domain.csproj index 36f90232..a1af97d7 100644 --- a/services/payment/src/EShopOnAbp.PaymentService.Domain/EShopOnAbp.PaymentService.Domain.csproj +++ b/services/payment/src/EShopOnAbp.PaymentService.Domain/EShopOnAbp.PaymentService.Domain.csproj @@ -12,4 +12,8 @@ + + + + diff --git a/services/payment/src/EShopOnAbp.PaymentService.Domain/EventHandlers/OrderCancelledEventHandler.cs b/services/payment/src/EShopOnAbp.PaymentService.Domain/EventHandlers/OrderCancelledEventHandler.cs new file mode 100644 index 00000000..9f1d781f --- /dev/null +++ b/services/payment/src/EShopOnAbp.PaymentService.Domain/EventHandlers/OrderCancelledEventHandler.cs @@ -0,0 +1,26 @@ +using EShopOnAbp.OrderingService.Orders; +using EShopOnAbp.PaymentService.PaymentRequests; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.EventBus.Distributed; +using Volo.Abp.Uow; + +namespace EShopOnAbp.PaymentService.EventHandlers +{ + public class OrderCancelledEventHandler : IDistributedEventHandler, ITransientDependency + { + private readonly IPaymentRequestRepository _paymentRepository; + + public OrderCancelledEventHandler(IPaymentRequestRepository paymenRepository) + { + _paymentRepository = paymenRepository; + } + + [UnitOfWork] + public async Task HandleEventAsync(OrderCancelledEto eventData) + { + var payment = await _paymentRepository.GetAsync(eventData.Buyer.BuyerId.GetValueOrDefault()); + await _paymentRepository.DeleteAsync(payment); + } + } +} From 1bccf5ea2fc715312c5cdd12f66d0ffdcb0ed4d3 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Fri, 11 Mar 2022 09:30:47 +0300 Subject: [PATCH 05/32] feat: add orders that in ordering module routing and show the page --- apps/angular/projects/ordering/config/ng-package.json | 7 +++++++ .../projects/ordering/config/{ => src}/enums/index.ts | 0 .../ordering/config/{ => src}/enums/policy-names.ts | 0 .../ordering/config/{ => src}/enums/route-names.ts | 2 +- .../config/{ => src}/order-config-routing.module.ts | 0 .../ordering-config.module.ts} | 6 +++--- .../projects/ordering/config/{ => src}/providers/index.ts | 0 .../ordering/config/{ => src}/providers/route.provider.ts | 1 - .../projects/ordering/config/{ => src}/public-api.ts | 2 +- apps/angular/src/app/app.module.ts | 4 +++- apps/angular/tsconfig.json | 4 ++++ 11 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 apps/angular/projects/ordering/config/ng-package.json rename apps/angular/projects/ordering/config/{ => src}/enums/index.ts (100%) rename apps/angular/projects/ordering/config/{ => src}/enums/policy-names.ts (100%) rename apps/angular/projects/ordering/config/{ => src}/enums/route-names.ts (60%) rename apps/angular/projects/ordering/config/{ => src}/order-config-routing.module.ts (100%) rename apps/angular/projects/ordering/config/{order-config.module.ts => src/ordering-config.module.ts} (61%) rename apps/angular/projects/ordering/config/{ => src}/providers/index.ts (100%) rename apps/angular/projects/ordering/config/{ => src}/providers/route.provider.ts (92%) rename apps/angular/projects/ordering/config/{ => src}/public-api.ts (56%) diff --git a/apps/angular/projects/ordering/config/ng-package.json b/apps/angular/projects/ordering/config/ng-package.json new file mode 100644 index 00000000..a3725f87 --- /dev/null +++ b/apps/angular/projects/ordering/config/ng-package.json @@ -0,0 +1,7 @@ +{ + "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json", + "dest": "../../dist/ordering/config", + "lib": { + "entryFile": "src/public-api.ts" + } +} diff --git a/apps/angular/projects/ordering/config/enums/index.ts b/apps/angular/projects/ordering/config/src/enums/index.ts similarity index 100% rename from apps/angular/projects/ordering/config/enums/index.ts rename to apps/angular/projects/ordering/config/src/enums/index.ts diff --git a/apps/angular/projects/ordering/config/enums/policy-names.ts b/apps/angular/projects/ordering/config/src/enums/policy-names.ts similarity index 100% rename from apps/angular/projects/ordering/config/enums/policy-names.ts rename to apps/angular/projects/ordering/config/src/enums/policy-names.ts diff --git a/apps/angular/projects/ordering/config/enums/route-names.ts b/apps/angular/projects/ordering/config/src/enums/route-names.ts similarity index 60% rename from apps/angular/projects/ordering/config/enums/route-names.ts rename to apps/angular/projects/ordering/config/src/enums/route-names.ts index 764ca296..4a594fc3 100644 --- a/apps/angular/projects/ordering/config/enums/route-names.ts +++ b/apps/angular/projects/ordering/config/src/enums/route-names.ts @@ -1,4 +1,4 @@ export const enum eOrderingRouteNames { - Ordering = 'CatalogService::Menu:CatalogManagement', + Ordering = 'OrderingService::Menu:Orders', Orders = 'CatalogService::Menu:Products', } diff --git a/apps/angular/projects/ordering/config/order-config-routing.module.ts b/apps/angular/projects/ordering/config/src/order-config-routing.module.ts similarity index 100% rename from apps/angular/projects/ordering/config/order-config-routing.module.ts rename to apps/angular/projects/ordering/config/src/order-config-routing.module.ts diff --git a/apps/angular/projects/ordering/config/order-config.module.ts b/apps/angular/projects/ordering/config/src/ordering-config.module.ts similarity index 61% rename from apps/angular/projects/ordering/config/order-config.module.ts rename to apps/angular/projects/ordering/config/src/ordering-config.module.ts index 039f0675..cfe437fe 100644 --- a/apps/angular/projects/ordering/config/order-config.module.ts +++ b/apps/angular/projects/ordering/config/src/ordering-config.module.ts @@ -3,10 +3,10 @@ import { ORDERING_ROUTE_PROVIDERS } from './providers/route.provider'; @NgModule() -export class OrderConfigModule { - static forRoot(): ModuleWithProviders { +export class OrderingConfigModule { + static forRoot(): ModuleWithProviders { return { - ngModule: OrderConfigModule, + ngModule: OrderingConfigModule, providers: [ORDERING_ROUTE_PROVIDERS], }; } diff --git a/apps/angular/projects/ordering/config/providers/index.ts b/apps/angular/projects/ordering/config/src/providers/index.ts similarity index 100% rename from apps/angular/projects/ordering/config/providers/index.ts rename to apps/angular/projects/ordering/config/src/providers/index.ts diff --git a/apps/angular/projects/ordering/config/providers/route.provider.ts b/apps/angular/projects/ordering/config/src/providers/route.provider.ts similarity index 92% rename from apps/angular/projects/ordering/config/providers/route.provider.ts rename to apps/angular/projects/ordering/config/src/providers/route.provider.ts index 42f5e37d..9a9848b5 100644 --- a/apps/angular/projects/ordering/config/providers/route.provider.ts +++ b/apps/angular/projects/ordering/config/src/providers/route.provider.ts @@ -16,7 +16,6 @@ export function configureRoutes(routesService: RoutesService) { layout: eLayoutType.application, parentName: null, iconClass: 'bi bi-collection-fill', - requiredPolicy: eOrderingPolicyNames.Ordering, }, ]); }; diff --git a/apps/angular/projects/ordering/config/public-api.ts b/apps/angular/projects/ordering/config/src/public-api.ts similarity index 56% rename from apps/angular/projects/ordering/config/public-api.ts rename to apps/angular/projects/ordering/config/src/public-api.ts index c0d0e091..964dd051 100644 --- a/apps/angular/projects/ordering/config/public-api.ts +++ b/apps/angular/projects/ordering/config/src/public-api.ts @@ -1,3 +1,3 @@ export * from './enums'; export * from './providers'; -export * from './order-config.module' \ No newline at end of file +export * from './ordering-config.module'; diff --git a/apps/angular/src/app/app.module.ts b/apps/angular/src/app/app.module.ts index ab26db42..9efb99a0 100644 --- a/apps/angular/src/app/app.module.ts +++ b/apps/angular/src/app/app.module.ts @@ -16,6 +16,7 @@ import { environment } from '../environments/environment'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { APP_ROUTE_PROVIDER } from './route.provider'; +import { OrderingConfigModule } from '@eshoponabp/ordering/config'; @NgModule({ imports: [ @@ -34,7 +35,8 @@ import { APP_ROUTE_PROVIDER } from './route.provider'; ThemeLeptonXModule.forRoot(), SideMenuLayoutModule.forRoot(), AccountLayoutModule.forRoot(), - CatalogConfigModule.forRoot() + CatalogConfigModule.forRoot(), + OrderingConfigModule.forRoot() ], declarations: [AppComponent], providers: [APP_ROUTE_PROVIDER], diff --git a/apps/angular/tsconfig.json b/apps/angular/tsconfig.json index 13998410..17d477b3 100644 --- a/apps/angular/tsconfig.json +++ b/apps/angular/tsconfig.json @@ -22,6 +22,10 @@ "node_modules/@eshoponabp/catalog", "projects/catalog/src/public-api.ts", ], + "@eshoponabp/ordering/config": [ + "node_modules/@eshoponabp/ordering/config", + "projects/ordering/config/src/public-api.ts", + ], "@eshoponabp/ordering": [ "node_modules/@eshoponabp/ordering", "projects/ordering/src/public-api.ts", From 955bf46c6f2a84c46d65d3825c27e74ba612edee Mon Sep 17 00:00:00 2001 From: malik masis Date: Mon, 14 Mar 2022 11:25:52 +0300 Subject: [PATCH 06/32] Configured permission and language Added permission for orders on the Admin side --- .../OrderingServicePermissionDefinitionProvider.cs | 3 ++- .../Permissions/OrderingServicePermissions.cs | 7 ++++++- .../Orders/OrderAppService.cs | 3 +++ .../Localization/OrderingService/en.json | 6 ++++-- .../Localization/OrderingService/tr.json | 6 ++++-- .../Localization/OrderingService/zh-Hans.json | 4 +++- 6 files changed, 22 insertions(+), 7 deletions(-) diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Permissions/OrderingServicePermissionDefinitionProvider.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Permissions/OrderingServicePermissionDefinitionProvider.cs index b1aeeee3..9c0cc3ba 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Permissions/OrderingServicePermissionDefinitionProvider.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Permissions/OrderingServicePermissionDefinitionProvider.cs @@ -8,7 +8,8 @@ namespace EShopOnAbp.OrderingService.Permissions { public override void Define(IPermissionDefinitionContext context) { - var myGroup = context.AddGroup(OrderingServicePermissions.GroupName, L("Permission:OrderingService")); + var orderManagmentGroup = context.AddGroup(OrderingServicePermissions.GroupName, L("Permission:OrderingService")); + orderManagmentGroup.AddPermission(OrderingServicePermissions.Orders.Default, L("Permission:Orders")); } private static LocalizableString L(string name) diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Permissions/OrderingServicePermissions.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Permissions/OrderingServicePermissions.cs index 779f1a41..da35c204 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Permissions/OrderingServicePermissions.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Permissions/OrderingServicePermissions.cs @@ -2,10 +2,15 @@ namespace EShopOnAbp.OrderingService.Permissions { - public class OrderingServicePermissions + public static class OrderingServicePermissions { public const string GroupName = "OrderingService"; + public static class Orders + { + public const string Default = GroupName + ".Orders"; + } + public static string[] GetAll() { return ReflectionHelper.GetPublicConstantsRecursively(typeof(OrderingServicePermissions)); diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs index 29bae4f0..0cd8e2e1 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs @@ -1,5 +1,7 @@ using EShopOnAbp.OrderingService.Localization; using EShopOnAbp.OrderingService.Orders.Specifications; +using EShopOnAbp.OrderingService.Permissions; +using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; @@ -38,6 +40,7 @@ public class OrderAppService : ApplicationService, IOrderAppService return CreateOrderDtoMapping(orders); } + [Authorize(OrderingServicePermissions.Orders.Default)] public async Task> GetOrdersAsync(GetOrdersInput input) { ISpecification specification = SpecificationFactory.Create(input.Filter); diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json index 14797854..0bd8ffc3 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json @@ -1,12 +1,14 @@ { "culture": "en", "texts": { - "MyAccount": "My account", + "MyAccount": "My account", "SamplePageMessage": "A sample page for the OrderingService module", "Ordering:00001": "Possible values for Order status: {OrderStatus}", "Ordering:00002": "Invalid number of units", "Ordering:00003": "Invalid discount", "Ordering:00004": "The total of order item is lower than applied discount", - "Ordering:01001": "Order with {0} id could not be found!" + "Ordering:01001": "Order with {0} id could not be found!", + "Permission:Orders": "Orders", + "Permission:OrderingService": "Ordering Service" } } \ No newline at end of file diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/tr.json b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/tr.json index 23ae9a65..11018c22 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/tr.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/tr.json @@ -1,12 +1,14 @@ { "culture": "tr", "texts": { - "MyAccount": "Hesabım", + "MyAccount": "Hesabım", "SamplePageMessage": "OrderingService modulünden örnek bir sayfa", "Ordering:00001": "Muhtemel Sipariş durum değerleri: {OrderStatus}", "Ordering:00002": "Ürün adedi negatif olamaz", "Ordering:00003": "Geçersiz indirim", "Ordering:00004": "Ürünlerin toplam bedeli, uygulanan indirimden daha az olamaz", - "Ordering:01001": "{0} ID numaralı ürün bulunamadı!" + "Ordering:01001": "{0} ID numaralı ürün bulunamadı!", + "Permission:Orders": "Siparişler", + "Permission:OrderingService": "Sipariş Servisi" } } \ No newline at end of file diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/zh-Hans.json b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/zh-Hans.json index bd0af3eb..1ea05073 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/zh-Hans.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/zh-Hans.json @@ -8,6 +8,8 @@ "Ordering:00002": "无效的单位数量", "Ordering:00003": "无效的折扣", "Ordering:00004": "订单项的总额低于申请的折扣", - "Ordering:01001": "无法找到 id 为 {0} 的订单!" + "Ordering:01001": "无法找到 id 为 {0} 的订单!", + "Permission:Orders": "命令", + "Permission:OrderingService": "订购服务" } } \ No newline at end of file From a8ccc7eff2f2c6de3288d4005aed834c5e750dc9 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Mon, 14 Mar 2022 11:44:37 +0300 Subject: [PATCH 07/32] feat: add order detail modal template to ordering page --- .../ordering/src/lib/ordering.service.spec.ts | 16 -------- .../ordering/src/lib/ordering.service.ts | 9 ----- .../order-detail/order-detail.component.html | 17 ++++++++ .../order-detail/order-detail.component.ts | 22 ++++++++++ .../src/pages/orders/orders.component.html | 40 ++++++++++++++++++- .../src/pages/orders/orders.component.ts | 11 +++-- .../src/pages/orders/orders.module.ts | 10 ++++- 7 files changed, 94 insertions(+), 31 deletions(-) delete mode 100644 apps/angular/projects/ordering/src/lib/ordering.service.spec.ts delete mode 100644 apps/angular/projects/ordering/src/lib/ordering.service.ts create mode 100644 apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html create mode 100644 apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.ts diff --git a/apps/angular/projects/ordering/src/lib/ordering.service.spec.ts b/apps/angular/projects/ordering/src/lib/ordering.service.spec.ts deleted file mode 100644 index 187fa810..00000000 --- a/apps/angular/projects/ordering/src/lib/ordering.service.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { TestBed } from '@angular/core/testing'; - -import { OrderingService } from './ordering.service'; - -describe('OrderingService', () => { - let service: OrderingService; - - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(OrderingService); - }); - - it('should be created', () => { - expect(service).toBeTruthy(); - }); -}); diff --git a/apps/angular/projects/ordering/src/lib/ordering.service.ts b/apps/angular/projects/ordering/src/lib/ordering.service.ts deleted file mode 100644 index fd106cf5..00000000 --- a/apps/angular/projects/ordering/src/lib/ordering.service.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Injectable } from '@angular/core'; - -@Injectable({ - providedIn: 'root' -}) -export class OrderingService { - - constructor() { } -} diff --git a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html new file mode 100644 index 00000000..f1398c61 --- /dev/null +++ b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html @@ -0,0 +1,17 @@ + + + + +

Modal Title

+
+ + +

Modal content

+
+ + + + +
diff --git a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.ts b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.ts new file mode 100644 index 00000000..cbd0d0b9 --- /dev/null +++ b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.ts @@ -0,0 +1,22 @@ +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { OrderDto } from '../../../lib/proxy/orders'; + +@Component({ + selector: 'lib-order-detail', + templateUrl: './order-detail.component.html' +}) +export class OrderDetailComponent implements OnInit { + + @Input() + visible: boolean; + @Input() + order: OrderDto | undefined; + + @Output() readonly visibleChange = new EventEmitter(); + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.html b/apps/angular/projects/ordering/src/pages/orders/orders.component.html index 66000b4f..1e66c318 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.component.html +++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.html @@ -1 +1,39 @@ -

orders works!

+ + +
+
+
+
+
{{ 'AbpCatalog::Products' | abpLocalization }}
+
+
+ +
+
+
+
+ + + + + + + {{ value | date }} + + + + + + + {{ 'AbpCatalog::Detail' | abpLocalization }} + + + + + + + + + +
+
diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.ts b/apps/angular/projects/ordering/src/pages/orders/orders.component.ts index a07554f1..cf83d309 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.component.ts +++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.ts @@ -1,4 +1,5 @@ import { Component, OnInit } from '@angular/core'; +import { OrderDto, OrderService } from '../../lib/proxy/orders'; @Component({ selector: 'lib-orders', @@ -6,10 +7,14 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./orders.component.css'] }) export class OrdersComponent implements OnInit { + constructor(private orderService: OrderService) { } + list$ = this.orderService.getOrders({}); + selectedOrder: OrderDto | undefined; + isModalVisible = false; + ngOnInit(): void {} - constructor() { } - ngOnInit(): void { + openModal(id: string) { + this.isModalVisible = true; } - } diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.module.ts b/apps/angular/projects/ordering/src/pages/orders/orders.module.ts index 0b6e8a06..78ea50b9 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.module.ts +++ b/apps/angular/projects/ordering/src/pages/orders/orders.module.ts @@ -3,15 +3,21 @@ import { CommonModule } from '@angular/common'; import { OrdersRoutingModule } from './orders-routing.module'; import { OrdersComponent } from './orders.component'; +import { ThemeSharedModule } from '@abp/ng.theme.shared'; +import { CoreModule } from '@abp/ng.core'; +import { OrderDetailComponent } from './order-detail/order-detail.component'; @NgModule({ declarations: [ - OrdersComponent + OrdersComponent, + OrderDetailComponent ], imports: [ CommonModule, - OrdersRoutingModule + OrdersRoutingModule, + ThemeSharedModule, + CoreModule, ] }) export class OrdersModule { } From 6a8f2767155ceb427d2d3b13882034053ca76e87 Mon Sep 17 00:00:00 2001 From: malik masis Date: Mon, 14 Mar 2022 14:01:10 +0300 Subject: [PATCH 08/32] Added some configurations for Order permission Added configuration of Order MS into administration MS and Identity MS --- ...rationServiceApplicationContractsModule.cs | 4 ++- ...rationService.Application.Contracts.csproj | 2 ++ .../DbMigrations/IdentityServerDataSeeder.cs | 33 +++++++++++-------- .../Localization/OrderingService/en.json | 4 ++- .../Localization/OrderingService/tr.json | 4 ++- .../Localization/OrderingService/zh-Hans.json | 4 ++- .../appsettings.json | 2 +- 7 files changed, 34 insertions(+), 19 deletions(-) diff --git a/services/administration/src/EShopOnAbp.AdministrationService.Application.Contracts/AdministrationServiceApplicationContractsModule.cs b/services/administration/src/EShopOnAbp.AdministrationService.Application.Contracts/AdministrationServiceApplicationContractsModule.cs index 51972266..bba3badb 100644 --- a/services/administration/src/EShopOnAbp.AdministrationService.Application.Contracts/AdministrationServiceApplicationContractsModule.cs +++ b/services/administration/src/EShopOnAbp.AdministrationService.Application.Contracts/AdministrationServiceApplicationContractsModule.cs @@ -2,6 +2,7 @@ using Volo.Abp.PermissionManagement; using Volo.Abp.SettingManagement; using EShopOnAbp.CatalogService; +using EShopOnAbp.OrderingService; namespace EShopOnAbp.AdministrationService { @@ -9,7 +10,8 @@ namespace EShopOnAbp.AdministrationService typeof(CatalogServiceApplicationContractsModule), typeof(AdministrationServiceDomainSharedModule), typeof(AbpPermissionManagementApplicationContractsModule), - typeof(AbpSettingManagementApplicationContractsModule) + typeof(AbpSettingManagementApplicationContractsModule), + typeof(OrderingServiceApplicationContractsModule) )] public class AdministrationServiceApplicationContractsModule : AbpModule { diff --git a/services/administration/src/EShopOnAbp.AdministrationService.Application.Contracts/EShopOnAbp.AdministrationService.Application.Contracts.csproj b/services/administration/src/EShopOnAbp.AdministrationService.Application.Contracts/EShopOnAbp.AdministrationService.Application.Contracts.csproj index 0c66122a..68c19a35 100644 --- a/services/administration/src/EShopOnAbp.AdministrationService.Application.Contracts/EShopOnAbp.AdministrationService.Application.Contracts.csproj +++ b/services/administration/src/EShopOnAbp.AdministrationService.Application.Contracts/EShopOnAbp.AdministrationService.Application.Contracts.csproj @@ -8,6 +8,8 @@ + + diff --git a/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/DbMigrations/IdentityServerDataSeeder.cs b/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/DbMigrations/IdentityServerDataSeeder.cs index a6d736cc..8d3a833d 100644 --- a/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/DbMigrations/IdentityServerDataSeeder.cs +++ b/services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/DbMigrations/IdentityServerDataSeeder.cs @@ -108,9 +108,13 @@ public class IdentityServerDataSeeder : IDataSeedContributor, ITransientDependen await CreateWebGatewaySwaggerClientAsync("WebGateway", new[] { - "AccountService", "IdentityService", "AdministrationService", - "CatalogService", "BasketService", - "PaymentService", "OrderingService" + "AccountService", + "IdentityService", + "AdministrationService", + "CatalogService", + "BasketService", + "PaymentService", + "OrderingService" }); } @@ -125,7 +129,7 @@ public class IdentityServerDataSeeder : IDataSeedContributor, ITransientDependen "phone", "address" }; - scopes ??= new[] {name}; + scopes ??= new[] { name }; // Swagger Client var swaggerClientId = $"{name}_Swagger"; @@ -144,7 +148,7 @@ public class IdentityServerDataSeeder : IDataSeedContributor, ITransientDependen await CreateClientAsync( name: swaggerClientId, scopes: commonScopes.Union(scopes), - grantTypes: new[] {"authorization_code"}, + grantTypes: new[] { "authorization_code" }, secret: "1q2w3e*".Sha256(), requireClientSecret: false, redirectUris: new List @@ -245,12 +249,12 @@ public class IdentityServerDataSeeder : IDataSeedContributor, ITransientDependen "PaymentService", "OrderingService" }), - grantTypes: new[] {"hybrid"}, + grantTypes: new[] { "hybrid" }, secret: "1q2w3e*".Sha256(), - redirectUris: new List{ $"{publicWebClientRootUrl}signin-oidc" }, + redirectUris: new List { $"{publicWebClientRootUrl}signin-oidc" }, postLogoutRedirectUri: $"{publicWebClientRootUrl}signout-callback-oidc", frontChannelLogoutUri: $"{publicWebClientRootUrl}Account/FrontChannelLogout", - corsOrigins: new[] {publicWebClientRootUrl.RemovePostFix("/")} + corsOrigins: new[] { publicWebClientRootUrl.RemovePostFix("/") } ); //Angular Client @@ -263,15 +267,16 @@ public class IdentityServerDataSeeder : IDataSeedContributor, ITransientDependen "AccountService", "IdentityService", "AdministrationService", - "CatalogService" + "CatalogService", + "OrderingService" }), - grantTypes: new[] {"authorization_code", "LinkLogin", "password"}, + grantTypes: new[] { "authorization_code", "LinkLogin", "password" }, secret: "1q2w3e*".Sha256(), requirePkce: true, requireClientSecret: false, - redirectUris: new List{ $"{angularClientRootUrl}" }, + redirectUris: new List { $"{angularClientRootUrl}" }, postLogoutRedirectUri: $"{angularClientRootUrl}", - corsOrigins: new[] {angularClientRootUrl} + corsOrigins: new[] { angularClientRootUrl } ); //Administration Service Client @@ -281,9 +286,9 @@ public class IdentityServerDataSeeder : IDataSeedContributor, ITransientDependen { "IdentityService" }), - grantTypes: new[] {"client_credentials"}, + grantTypes: new[] { "client_credentials" }, secret: "1q2w3e*".Sha256(), - permissions: new[] {IdentityPermissions.Users.Default} + permissions: new[] { IdentityPermissions.Users.Default } ); } diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json index 0bd8ffc3..e4b05899 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json @@ -9,6 +9,8 @@ "Ordering:00004": "The total of order item is lower than applied discount", "Ordering:01001": "Order with {0} id could not be found!", "Permission:Orders": "Orders", - "Permission:OrderingService": "Ordering Service" + "Permission:OrderingService": "Ordering Service", + "Menu:Orders": "Orders", + "Menu:OrderManagement": "Ordering Service" } } \ No newline at end of file diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/tr.json b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/tr.json index 11018c22..de8f0965 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/tr.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/tr.json @@ -9,6 +9,8 @@ "Ordering:00004": "Ürünlerin toplam bedeli, uygulanan indirimden daha az olamaz", "Ordering:01001": "{0} ID numaralı ürün bulunamadı!", "Permission:Orders": "Siparişler", - "Permission:OrderingService": "Sipariş Servisi" + "Permission:OrderingService": "Sipariş Servisi", + "Menu:Orders": "Siparişler", + "Menu:OrderManagement": "Sipariş Yönetimi" } } \ No newline at end of file diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/zh-Hans.json b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/zh-Hans.json index 1ea05073..62a5805b 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/zh-Hans.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/zh-Hans.json @@ -10,6 +10,8 @@ "Ordering:00004": "订单项的总额低于申请的折扣", "Ordering:01001": "无法找到 id 为 {0} 的订单!", "Permission:Orders": "命令", - "Permission:OrderingService": "订购服务" + "Permission:OrderingService": "订购服务", + "Menu:Orders": "命令", + "Menu:OrderManagement": "订单管理" } } \ No newline at end of file diff --git a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Host/appsettings.json b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Host/appsettings.json index c3fabcdc..817f4dce 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Host/appsettings.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Host/appsettings.json @@ -1,7 +1,7 @@ { "App": { "SelfUrl": "https://localhost:44356", - "CorsOrigins": "https://localhost:44372,https://localhost:44373" + "CorsOrigins": "https://localhost:44372,https://localhost:44373,http://localhost:4200,https://localhost:4200" }, "AuthServer": { "Authority": "https://localhost:44330", From 71e7ef0e5febb4da57ecf688b5981c346b07ac19 Mon Sep 17 00:00:00 2001 From: malik masis Date: Mon, 14 Mar 2022 18:21:59 +0300 Subject: [PATCH 09/32] Splitted Update action 2 separate actions Splitted as 2 actions - SetAsCancelled - SetAsShipped configured its language and permission. Also added GetListPagedAsync --- .../Orders/IOrderAppService.cs | 6 +- ...UpdateOrderDto.cs => SetAsCancelledDto.cs} | 2 +- .../Orders/SetAsShippedDto.cs | 9 ++ ...ringServicePermissionDefinitionProvider.cs | 5 +- .../Permissions/OrderingServicePermissions.cs | 2 + .../Orders/OrderAppService.cs | 49 ++++-- .../Localization/OrderingService/en.json | 4 +- .../Localization/OrderingService/tr.json | 4 +- .../Localization/OrderingService/zh-Hans.json | 4 +- .../OrderClientProxy.Generated.cs | 23 ++- .../ordering-generate-proxy.json | 146 ++++++++++++++++-- .../Orders/OrderApplication_Tests.cs | 2 +- 12 files changed, 218 insertions(+), 38 deletions(-) rename services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/{UpdateOrderDto.cs => SetAsCancelledDto.cs} (86%) create mode 100644 services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/SetAsShippedDto.cs diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/IOrderAppService.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/IOrderAppService.cs index 7812d9a7..d04e7685 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/IOrderAppService.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/IOrderAppService.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; namespace EShopOnAbp.OrderingService.Orders; @@ -12,5 +13,8 @@ public interface IOrderAppService : IApplicationService Task> GetMyOrdersAsync(GetMyOrdersInput input); Task> GetOrdersAsync(GetOrdersInput input); Task GetByOrderNoAsync(int orderNo); - Task UpdateAsync(Guid id, UpdateOrderDto input); + Task SetAsCancelledAsync(Guid id, SetAsCancelledDto input); + Task SetAsShippedAsync(Guid id, SetAsShippedDto input); + Task> GetListPagedAsync(PagedAndSortedResultRequestDto input); + } \ No newline at end of file diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/UpdateOrderDto.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/SetAsCancelledDto.cs similarity index 86% rename from services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/UpdateOrderDto.cs rename to services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/SetAsCancelledDto.cs index adf69220..4f61d28a 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/UpdateOrderDto.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/SetAsCancelledDto.cs @@ -2,7 +2,7 @@ namespace EShopOnAbp.OrderingService.Orders { - public class UpdateOrderDto + public class SetAsCancelledDto { public int OrderStatusId { get; set; } public Guid PaymentRequestId { get; set; } diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/SetAsShippedDto.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/SetAsShippedDto.cs new file mode 100644 index 00000000..ff6eb986 --- /dev/null +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/SetAsShippedDto.cs @@ -0,0 +1,9 @@ +using System; + +namespace EShopOnAbp.OrderingService.Orders +{ + public class SetAsShippedDto + { + public int OrderStatusId { get; set; } + } +} \ No newline at end of file diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Permissions/OrderingServicePermissionDefinitionProvider.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Permissions/OrderingServicePermissionDefinitionProvider.cs index 9c0cc3ba..f06acec2 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Permissions/OrderingServicePermissionDefinitionProvider.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Permissions/OrderingServicePermissionDefinitionProvider.cs @@ -9,7 +9,10 @@ namespace EShopOnAbp.OrderingService.Permissions public override void Define(IPermissionDefinitionContext context) { var orderManagmentGroup = context.AddGroup(OrderingServicePermissions.GroupName, L("Permission:OrderingService")); - orderManagmentGroup.AddPermission(OrderingServicePermissions.Orders.Default, L("Permission:Orders")); + var oders = orderManagmentGroup.AddPermission(OrderingServicePermissions.Orders.Default, L("Permission:Orders")); + oders.AddChild(OrderingServicePermissions.Orders.SetAsCancelled, L("Permission:Orders.SetAsCancelled")); + oders.AddChild(OrderingServicePermissions.Orders.SetAsShipped, L("Permission:Orders.SetAsShipped")); + } private static LocalizableString L(string name) diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Permissions/OrderingServicePermissions.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Permissions/OrderingServicePermissions.cs index da35c204..30005b60 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Permissions/OrderingServicePermissions.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Permissions/OrderingServicePermissions.cs @@ -9,6 +9,8 @@ namespace EShopOnAbp.OrderingService.Permissions public static class Orders { public const string Default = GroupName + ".Orders"; + public const string SetAsCancelled = GroupName + ".SetAsCancelled"; + public const string SetAsShipped = GroupName + ".SetAsShipped"; } public static string[] GetAll() diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs index 0cd8e2e1..ea4faeef 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs @@ -5,7 +5,10 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; +using System.Linq; +using System.Linq.Dynamic.Core; using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using Volo.Abp.Specifications; using Volo.Abp.Users; @@ -48,6 +51,26 @@ public class OrderAppService : ApplicationService, IOrderAppService return CreateOrderDtoMapping(orders); } + [Authorize(OrderingServicePermissions.Orders.Default)] + public async Task> GetListPagedAsync(PagedAndSortedResultRequestDto input) + { + var queryable = await _orderRepository.GetQueryableAsync(); + + var orders = await AsyncExecuter.ToListAsync( + queryable + .OrderBy(input.Sorting ?? "OrderDate") + .Skip(input.SkipCount) + .Take(input.MaxResultCount) + ); + + var totalCount = await _orderRepository.GetCountAsync(); + //TODO Refactor Order Status + return new PagedResultDto( + totalCount, + CreateOrderDtoMapping(orders) + ); + } + public async Task GetByOrderNoAsync(int orderNo) { var order = await _orderRepository.GetByOrderNoAsync(orderNo); @@ -55,20 +78,18 @@ public class OrderAppService : ApplicationService, IOrderAppService return CreateOrderDtoMapping(order); } - public async Task UpdateAsync(Guid id, UpdateOrderDto input) + [Authorize(OrderingServicePermissions.Orders.SetAsCancelled)] + public async Task SetAsCancelledAsync(Guid id, SetAsCancelledDto input) { - var order = await _orderRepository.GetAsync(id); - if (input.OrderStatusId == OrderStatus.Shipped.Id) - { - order.SetOrderAsShipped(input.OrderStatusId); - await _orderRepository.UpdateAsync(order); - } - else if (input.OrderStatusId == OrderStatus.Cancelled.Id) - { - await _orderManager.CancelOrderAsync(id, input.PaymentRequestId, input.PaymentRequestStatus); - } + await _orderManager.CancelOrderAsync(id, input.PaymentRequestId, input.PaymentRequestStatus); + } - return CreateOrderDtoMapping(order); + [Authorize(OrderingServicePermissions.Orders.SetAsShipped)] + public async Task SetAsShippedAsync(Guid id, SetAsShippedDto input) + { + var order = await _orderRepository.GetAsync(id); + order.SetOrderAsShipped(input.OrderStatusId); + await _orderRepository.UpdateAsync(order); } public async Task CreateAsync(OrderCreateDto input) @@ -130,8 +151,8 @@ public class OrderAppService : ApplicationService, IOrderAppService Id = order.Id, OrderNo = order.OrderNo, OrderDate = order.OrderDate, - OrderStatus = order.OrderStatus.Name, - OrderStatusId = order.OrderStatus.Id, + OrderStatus = order.OrderStatus?.Name, + OrderStatusId = order.OrderStatus?.Id ?? 0, PaymentMethod = order.PaymentMethod }; } diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json index e4b05899..e6d127d4 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json @@ -11,6 +11,8 @@ "Permission:Orders": "Orders", "Permission:OrderingService": "Ordering Service", "Menu:Orders": "Orders", - "Menu:OrderManagement": "Ordering Service" + "Menu:OrderManagement": "Ordering Service", + "Permission:Orders.SetAsCancelled": "Set As Cancelled", + "Permission:Orders.SetAsShipped": "Set As Shipped" } } \ No newline at end of file diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/tr.json b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/tr.json index de8f0965..b618ca81 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/tr.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/tr.json @@ -11,6 +11,8 @@ "Permission:Orders": "Siparişler", "Permission:OrderingService": "Sipariş Servisi", "Menu:Orders": "Siparişler", - "Menu:OrderManagement": "Sipariş Yönetimi" + "Menu:OrderManagement": "Sipariş Yönetimi", + "Permission:Orders.SetAsCancelled": "İptal Edildi Olarak İşaretle", + "Permission:Orders.SetAsShipped": "Sevk Edildi Olarak İşaretle" } } \ No newline at end of file diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/zh-Hans.json b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/zh-Hans.json index 62a5805b..2aaafa54 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/zh-Hans.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/zh-Hans.json @@ -12,6 +12,8 @@ "Permission:Orders": "命令", "Permission:OrderingService": "订购服务", "Menu:Orders": "命令", - "Menu:OrderManagement": "订单管理" + "Menu:OrderManagement": "订单管理", + "Permission:Orders.SetAsCancelled": "设置为取消", + "Permission:Orders.SetAsShipped": "设置为发货" } } \ No newline at end of file diff --git a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/OrderClientProxy.Generated.cs b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/OrderClientProxy.Generated.cs index e6ff5ec0..466eb65e 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/OrderClientProxy.Generated.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/OrderClientProxy.Generated.cs @@ -40,6 +40,14 @@ public partial class OrderClientProxy : ClientProxyBase, IOrde }); } + public virtual async Task> GetListPagedAsync(PagedAndSortedResultRequestDto input) + { + return await RequestAsync>(nameof(GetListPagedAsync), new ClientProxyRequestTypeValue + { + { typeof(PagedAndSortedResultRequestDto), input } + }); + } + public virtual async Task GetByOrderNoAsync(int orderNo) { return await RequestAsync(nameof(GetByOrderNoAsync), new ClientProxyRequestTypeValue @@ -48,12 +56,21 @@ public partial class OrderClientProxy : ClientProxyBase, IOrde }); } - public virtual async Task UpdateAsync(Guid id, UpdateOrderDto input) + public virtual async Task SetAsCancelledAsync(Guid id, SetAsCancelledDto input) + { + await RequestAsync(nameof(SetAsCancelledAsync), new ClientProxyRequestTypeValue + { + { typeof(Guid), id }, + { typeof(SetAsCancelledDto), input } + }); + } + + public virtual async Task SetAsShippedAsync(Guid id, SetAsShippedDto input) { - return await RequestAsync(nameof(UpdateAsync), new ClientProxyRequestTypeValue + await RequestAsync(nameof(SetAsShippedAsync), new ClientProxyRequestTypeValue { { typeof(Guid), id }, - { typeof(UpdateOrderDto), input } + { typeof(SetAsShippedDto), input } }); } diff --git a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/ordering-generate-proxy.json b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/ordering-generate-proxy.json index 9e8c75e3..3e8f9f1c 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/ordering-generate-proxy.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/ordering-generate-proxy.json @@ -131,7 +131,68 @@ "type": "System.Collections.Generic.List", "typeSimple": "[EShopOnAbp.OrderingService.Orders.OrderDto]" }, - "allowAnonymous": null, + "allowAnonymous": false, + "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" + }, + "GetListPagedAsyncByInput": { + "uniqueName": "GetListPagedAsyncByInput", + "name": "GetListPagedAsync", + "httpMethod": "GET", + "url": "api/ordering/order/paged", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.Application.Dtos.PagedAndSortedResultRequestDto, Volo.Abp.Ddd.Application.Contracts", + "type": "Volo.Abp.Application.Dtos.PagedAndSortedResultRequestDto", + "typeSimple": "Volo.Abp.Application.Dtos.PagedAndSortedResultRequestDto", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "input", + "name": "Sorting", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + }, + { + "nameOnMethod": "input", + "name": "SkipCount", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + }, + { + "nameOnMethod": "input", + "name": "MaxResultCount", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + } + ], + "returnValue": { + "type": "Volo.Abp.Application.Dtos.PagedResultDto", + "typeSimple": "Volo.Abp.Application.Dtos.PagedResultDto" + }, + "allowAnonymous": false, "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" }, "GetByOrderNoAsyncByOrderNo": { @@ -171,11 +232,11 @@ "allowAnonymous": null, "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" }, - "UpdateAsyncByIdAndInput": { - "uniqueName": "UpdateAsyncByIdAndInput", - "name": "UpdateAsync", - "httpMethod": "PUT", - "url": "api/ordering/order/{id}", + "SetAsCancelledAsyncByIdAndInput": { + "uniqueName": "SetAsCancelledAsyncByIdAndInput", + "name": "SetAsCancelledAsync", + "httpMethod": "POST", + "url": "api/ordering/order/{id}/set-as-cancelled", "supportedVersions": [], "parametersOnMethod": [ { @@ -188,9 +249,9 @@ }, { "name": "input", - "typeAsString": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto, EShopOnAbp.OrderingService.Application.Contracts", - "type": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto", - "typeSimple": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto", + "typeAsString": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto, EShopOnAbp.OrderingService.Application.Contracts", + "type": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto", + "typeSimple": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto", "isOptional": false, "defaultValue": null } @@ -212,8 +273,8 @@ "nameOnMethod": "input", "name": "input", "jsonName": null, - "type": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto", - "typeSimple": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto", + "type": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto", + "typeSimple": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto", "isOptional": false, "defaultValue": null, "constraintTypes": null, @@ -222,10 +283,67 @@ } ], "returnValue": { - "type": "EShopOnAbp.OrderingService.Orders.OrderDto", - "typeSimple": "EShopOnAbp.OrderingService.Orders.OrderDto" + "type": "System.Void", + "typeSimple": "System.Void" }, - "allowAnonymous": null, + "allowAnonymous": false, + "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" + }, + "SetAsShippedAsyncByIdAndInput": { + "uniqueName": "SetAsShippedAsyncByIdAndInput", + "name": "SetAsShippedAsync", + "httpMethod": "POST", + "url": "api/ordering/order/{id}/set-as-shipped", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + }, + { + "name": "input", + "typeAsString": "EShopOnAbp.OrderingService.Orders.SetAsShippedDto, EShopOnAbp.OrderingService.Application.Contracts", + "type": "EShopOnAbp.OrderingService.Orders.SetAsShippedDto", + "typeSimple": "EShopOnAbp.OrderingService.Orders.SetAsShippedDto", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "id", + "name": "id", + "jsonName": null, + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": [], + "bindingSourceId": "Path", + "descriptorName": "" + }, + { + "nameOnMethod": "input", + "name": "input", + "jsonName": null, + "type": "EShopOnAbp.OrderingService.Orders.SetAsShippedDto", + "typeSimple": "EShopOnAbp.OrderingService.Orders.SetAsShippedDto", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "Body", + "descriptorName": "" + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + }, + "allowAnonymous": false, "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" }, "CreateAsyncByInput": { diff --git a/services/ordering/test/EShopOnAbp.OrderingService.Application.Tests/Orders/OrderApplication_Tests.cs b/services/ordering/test/EShopOnAbp.OrderingService.Application.Tests/Orders/OrderApplication_Tests.cs index b6543bfe..2d581037 100644 --- a/services/ordering/test/EShopOnAbp.OrderingService.Application.Tests/Orders/OrderApplication_Tests.cs +++ b/services/ordering/test/EShopOnAbp.OrderingService.Application.Tests/Orders/OrderApplication_Tests.cs @@ -67,7 +67,7 @@ public class OrderApplication_Tests : OrderingServiceApplicationTestBase myOrder.ShouldNotBeNull(); - var cancelledMyOrder = await _orderAppService.UpdateAsync(placedOrder.Id, new UpdateOrderDto() + var cancelledMyOrder = await _orderAppService.SetAsCancelledAsync(placedOrder.Id, new SetAsCancelledDto() { OrderStatusId = OrderStatus.Shipped.Id, }); From edcc3688cbdee0cae46fcf78fcd93b32702be43f Mon Sep 17 00:00:00 2001 From: malik masis Date: Tue, 15 Mar 2022 10:21:58 +0300 Subject: [PATCH 10/32] Removed SetAsShippedDto After separating the Update action it was unnecessary, so removed it and its dependencies --- .../Orders/IOrderAppService.cs | 2 +- .../Orders/SetAsCancelledDto.cs | 1 - .../Orders/SetAsShippedDto.cs | 9 ------- .../Orders/OrderAppService.cs | 4 ++-- .../Orders/Order.cs | 6 +---- .../OrderClientProxy.Generated.cs | 5 ++-- .../ordering-generate-proxy.json | 24 ++----------------- 7 files changed, 8 insertions(+), 43 deletions(-) delete mode 100644 services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/SetAsShippedDto.cs diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/IOrderAppService.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/IOrderAppService.cs index d04e7685..90dd07f2 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/IOrderAppService.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/IOrderAppService.cs @@ -14,7 +14,7 @@ public interface IOrderAppService : IApplicationService Task> GetOrdersAsync(GetOrdersInput input); Task GetByOrderNoAsync(int orderNo); Task SetAsCancelledAsync(Guid id, SetAsCancelledDto input); - Task SetAsShippedAsync(Guid id, SetAsShippedDto input); + Task SetAsShippedAsync(Guid id); Task> GetListPagedAsync(PagedAndSortedResultRequestDto input); } \ No newline at end of file diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/SetAsCancelledDto.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/SetAsCancelledDto.cs index 4f61d28a..f0cd0783 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/SetAsCancelledDto.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/SetAsCancelledDto.cs @@ -4,7 +4,6 @@ namespace EShopOnAbp.OrderingService.Orders { public class SetAsCancelledDto { - public int OrderStatusId { get; set; } public Guid PaymentRequestId { get; set; } public string PaymentRequestStatus { get; set; } } diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/SetAsShippedDto.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/SetAsShippedDto.cs deleted file mode 100644 index ff6eb986..00000000 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/SetAsShippedDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace EShopOnAbp.OrderingService.Orders -{ - public class SetAsShippedDto - { - public int OrderStatusId { get; set; } - } -} \ No newline at end of file diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs index ea4faeef..6ba22894 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs @@ -85,10 +85,10 @@ public class OrderAppService : ApplicationService, IOrderAppService } [Authorize(OrderingServicePermissions.Orders.SetAsShipped)] - public async Task SetAsShippedAsync(Guid id, SetAsShippedDto input) + public async Task SetAsShippedAsync(Guid id) { var order = await _orderRepository.GetAsync(id); - order.SetOrderAsShipped(input.OrderStatusId); + order.SetOrderAsShipped(); await _orderRepository.UpdateAsync(order); } diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/Order.cs b/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/Order.cs index 802ec1a9..2be38367 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/Order.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/Order.cs @@ -97,12 +97,8 @@ public class Order : AggregateRoot return OrderItems.Sum(o => o.Units * o.UnitPrice); } - public Order SetOrderAsShipped(int orderStatus) + public Order SetOrderAsShipped() { - if (orderStatus == OrderStatus.Cancelled.Id) - { - return this; - } //TODO no enough to update the object. _orderStatusId = OrderStatus.Shipped.Id; return this; diff --git a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/OrderClientProxy.Generated.cs b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/OrderClientProxy.Generated.cs index 466eb65e..f51841db 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/OrderClientProxy.Generated.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/OrderClientProxy.Generated.cs @@ -65,12 +65,11 @@ public partial class OrderClientProxy : ClientProxyBase, IOrde }); } - public virtual async Task SetAsShippedAsync(Guid id, SetAsShippedDto input) + public virtual async Task SetAsShippedAsync(Guid id) { await RequestAsync(nameof(SetAsShippedAsync), new ClientProxyRequestTypeValue { - { typeof(Guid), id }, - { typeof(SetAsShippedDto), input } + { typeof(Guid), id } }); } diff --git a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/ordering-generate-proxy.json b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/ordering-generate-proxy.json index 3e8f9f1c..f437165f 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/ordering-generate-proxy.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/ordering-generate-proxy.json @@ -289,8 +289,8 @@ "allowAnonymous": false, "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" }, - "SetAsShippedAsyncByIdAndInput": { - "uniqueName": "SetAsShippedAsyncByIdAndInput", + "SetAsShippedAsyncById": { + "uniqueName": "SetAsShippedAsyncById", "name": "SetAsShippedAsync", "httpMethod": "POST", "url": "api/ordering/order/{id}/set-as-shipped", @@ -303,14 +303,6 @@ "typeSimple": "string", "isOptional": false, "defaultValue": null - }, - { - "name": "input", - "typeAsString": "EShopOnAbp.OrderingService.Orders.SetAsShippedDto, EShopOnAbp.OrderingService.Application.Contracts", - "type": "EShopOnAbp.OrderingService.Orders.SetAsShippedDto", - "typeSimple": "EShopOnAbp.OrderingService.Orders.SetAsShippedDto", - "isOptional": false, - "defaultValue": null } ], "parameters": [ @@ -325,18 +317,6 @@ "constraintTypes": [], "bindingSourceId": "Path", "descriptorName": "" - }, - { - "nameOnMethod": "input", - "name": "input", - "jsonName": null, - "type": "EShopOnAbp.OrderingService.Orders.SetAsShippedDto", - "typeSimple": "EShopOnAbp.OrderingService.Orders.SetAsShippedDto", - "isOptional": false, - "defaultValue": null, - "constraintTypes": null, - "bindingSourceId": "Body", - "descriptorName": "" } ], "returnValue": { From 608f51ae3356ca727cb15d1fbb66abbd080a1a3b Mon Sep 17 00:00:00 2001 From: malik masis Date: Tue, 15 Mar 2022 10:45:36 +0300 Subject: [PATCH 11/32] Included detail into GetListPagedAsync --- .../Orders/OrderAppService.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs index 6ba22894..1e9191de 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs @@ -54,7 +54,7 @@ public class OrderAppService : ApplicationService, IOrderAppService [Authorize(OrderingServicePermissions.Orders.Default)] public async Task> GetListPagedAsync(PagedAndSortedResultRequestDto input) { - var queryable = await _orderRepository.GetQueryableAsync(); + var queryable = await _orderRepository.WithDetailsAsync(); var orders = await AsyncExecuter.ToListAsync( queryable @@ -64,7 +64,6 @@ public class OrderAppService : ApplicationService, IOrderAppService ); var totalCount = await _orderRepository.GetCountAsync(); - //TODO Refactor Order Status return new PagedResultDto( totalCount, CreateOrderDtoMapping(orders) @@ -151,8 +150,8 @@ public class OrderAppService : ApplicationService, IOrderAppService Id = order.Id, OrderNo = order.OrderNo, OrderDate = order.OrderDate, - OrderStatus = order.OrderStatus?.Name, - OrderStatusId = order.OrderStatus?.Id ?? 0, + OrderStatus = order.OrderStatus.Name, + OrderStatusId = order.OrderStatus.Id, PaymentMethod = order.PaymentMethod }; } From cc5bd21211fff849b6f8caa8a882c419d6659968 Mon Sep 17 00:00:00 2001 From: Galip Tolga Erdem Date: Tue, 15 Mar 2022 15:35:39 +0300 Subject: [PATCH 12/32] Added OrderingService scope request to angular oidc configuration --- apps/angular/src/environments/environment.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/angular/src/environments/environment.ts b/apps/angular/src/environments/environment.ts index b9654b01..d95bd122 100644 --- a/apps/angular/src/environments/environment.ts +++ b/apps/angular/src/environments/environment.ts @@ -13,7 +13,7 @@ export const environment = { redirectUri: baseUrl, clientId: 'Web', //responseType: 'code', - scope: 'offline_access openid profile email phone AccountService IdentityService AdministrationService CatalogService', + scope: 'offline_access openid profile email phone AccountService IdentityService AdministrationService CatalogService OrderingService', //requireHttps: true, }, apis: { From 01ab01009fb6aabd8c5d0320309f57c7177385b4 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Tue, 15 Mar 2022 17:57:58 +0300 Subject: [PATCH 13/32] feat: add order page --- .../projects/ordering/src/lib/index.ts | 3 + .../ordering/src/lib/order-view-model.ts | 5 ++ .../ordering/src/lib/to-order-view-model.ts | 8 +++ .../order-detail-item.component.ts | 21 ++++++ .../order-detail/order-detail.component.html | 63 +++++++++++++++-- .../order-detail/order-detail.component.ts | 19 ++---- .../src/pages/orders/orders.component.html | 59 +++++++++++----- .../src/pages/orders/orders.component.ts | 67 +++++++++++++++++-- .../src/pages/orders/orders.module.ts | 6 +- .../src/environments/environment.prod.ts | 10 +-- apps/angular/src/environments/environment.ts | 9 ++- .../src/environments/my-environment.ts | 5 ++ .../Components/UserOrders/Default.cshtml | 2 +- .../Orders/OrderAppService.cs | 2 +- 14 files changed, 227 insertions(+), 52 deletions(-) create mode 100644 apps/angular/projects/ordering/src/lib/index.ts create mode 100644 apps/angular/projects/ordering/src/lib/order-view-model.ts create mode 100644 apps/angular/projects/ordering/src/lib/to-order-view-model.ts create mode 100644 apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail-item/order-detail-item.component.ts create mode 100644 apps/angular/src/environments/my-environment.ts diff --git a/apps/angular/projects/ordering/src/lib/index.ts b/apps/angular/projects/ordering/src/lib/index.ts new file mode 100644 index 00000000..0186f742 --- /dev/null +++ b/apps/angular/projects/ordering/src/lib/index.ts @@ -0,0 +1,3 @@ +export * from './order-view-model'; +export * from './proxy'; +export * from './to-order-view-model'; diff --git a/apps/angular/projects/ordering/src/lib/order-view-model.ts b/apps/angular/projects/ordering/src/lib/order-view-model.ts new file mode 100644 index 00000000..0fee9573 --- /dev/null +++ b/apps/angular/projects/ordering/src/lib/order-view-model.ts @@ -0,0 +1,5 @@ +import { OrderDto } from './proxy/orders'; + +export interface OrderViewModel extends OrderDto { + orderTotal: number; +} diff --git a/apps/angular/projects/ordering/src/lib/to-order-view-model.ts b/apps/angular/projects/ordering/src/lib/to-order-view-model.ts new file mode 100644 index 00000000..eadb2605 --- /dev/null +++ b/apps/angular/projects/ordering/src/lib/to-order-view-model.ts @@ -0,0 +1,8 @@ +import { OrderDto } from './proxy/orders'; +import { OrderViewModel } from './order-view-model'; + +const mapItem = (x: OrderDto): OrderViewModel => { + const orderTotal = x.items?.reduce((acc, curr) => ( acc + (curr.unitPrice * curr.units)), 0) || 0; + return {...x, orderTotal}; +}; +export const toOrderViewModel = (orders: OrderDto[]) => orders.map(mapItem); diff --git a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail-item/order-detail-item.component.ts b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail-item/order-detail-item.component.ts new file mode 100644 index 00000000..e6152131 --- /dev/null +++ b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail-item/order-detail-item.component.ts @@ -0,0 +1,21 @@ +import { Component, Input } from '@angular/core'; + +@Component({ + selector: 'lib-order-detail-item', + template: ` +
+
+ {{label}} +
+ + + +
+ `, + styles: [] +}) +export class OrderDetailItemComponent { + + @Input() + label = ''; +} diff --git a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html index f1398c61..d802e87e 100644 --- a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html +++ b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html @@ -1,16 +1,67 @@ - - - + -

Modal Title

+

Order Detail

-

Modal content

+ +
+
+ #{{order.orderNo}} + {{order.orderStatus}} + {{order.buyer.name}} + {{order.buyer.email}} + + + + {{address.description}}
+ {{address.street}}
+ {{address.zipCode}}
+ {{address.city}} / {{address.country}}
+
+
+ {{order.paymentMethod}} + {{order.orderTotal | currency}} + +
+


+ + + + + + + + + + + + + + {{value | currency }} + + + + + + + {{value }} % + + + + + {{(row.units * row.unitPrice) | currency }} + + + + + +
+ - diff --git a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.ts b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.ts index cbd0d0b9..0cda0a8f 100644 --- a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.ts +++ b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.ts @@ -1,22 +1,17 @@ -import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; -import { OrderDto } from '../../../lib/proxy/orders'; +import { Component, EventEmitter, Input, Output } from '@angular/core'; +import { OrderViewModel } from '../../../lib/order-view-model'; +import { environment } from '../../../../../../src/environments/environment'; @Component({ selector: 'lib-order-detail', templateUrl: './order-detail.component.html' }) -export class OrderDetailComponent implements OnInit { - +export class OrderDetailComponent { + modalOption = { size: 'xl' } @Input() visible: boolean; @Input() - order: OrderDto | undefined; - + order: OrderViewModel | undefined; + mediaServerUrl = environment.mediaServerUrl; @Output() readonly visibleChange = new EventEmitter(); - - constructor() { } - - ngOnInit(): void { - } - } diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.html b/apps/angular/projects/ordering/src/pages/orders/orders.component.html index 1e66c318..0501af0c 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.component.html +++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.html @@ -4,36 +4,63 @@
-
{{ 'AbpCatalog::Products' | abpLocalization }}
-
-
- +
{{ 'AbpOrdering::Orders' | abpLocalization }}
+
+ + +
+ +
+ + +
+
+
+
- - {{ value | date }} + {{ value | date }} - - - - - {{ 'AbpCatalog::Detail' | abpLocalization }} - + + + {{ value | currency }} - -
+ - - + +
+ + + + + diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.ts b/apps/angular/projects/ordering/src/pages/orders/orders.component.ts index cf83d309..3fb843c2 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.component.ts +++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.ts @@ -1,20 +1,73 @@ import { Component, OnInit } from '@angular/core'; -import { OrderDto, OrderService } from '../../lib/proxy/orders'; +import { OrderService } from '../../lib/proxy/orders'; +import { OrderViewModel, toOrderViewModel } from '../../lib'; +import { Confirmation, ConfirmationService } from '@abp/ng.theme.shared'; +import { ListService } from '@abp/ng.core'; @Component({ selector: 'lib-orders', templateUrl: './orders.component.html', - styleUrls: ['./orders.component.css'] + styleUrls: ['./orders.component.css'], + providers: [ListService], }) export class OrdersComponent implements OnInit { - constructor(private orderService: OrderService) { } - list$ = this.orderService.getOrders({}); - selectedOrder: OrderDto | undefined; + constructor(private service: OrderService, + public list: ListService, + private confirmationService: ConfirmationService) { } + selectedOrder: OrderViewModel | undefined; isModalVisible = false; - ngOnInit(): void {} + items: OrderViewModel[]; + count = 0; + ngOnInit(): void { - openModal(id: string) { + const ordersStreamCreator = query => this.service.getListPaged(query); + + this.list.hookToQuery(ordersStreamCreator).subscribe(response => { + this.items = toOrderViewModel(response.items); + this.count = response.totalCount; + }); + } + + openModal(order: OrderViewModel) { + if (!order){ + return; + } + this.selectedOrder = order; this.isModalVisible = true; } + + closeModal(isVisible: boolean){ + if (isVisible){ + return; + } + this.selectedOrder = null; + this.isModalVisible = false; + } + + setAsShipped(row: OrderViewModel) { + this.confirmationService + .warn('AbpOrdering::WillSetAsShipped', { key: '::AreYouSure', defaultValue: 'Are you sure?' }) + .subscribe((status) => { + if (status !== Confirmation.Status.confirm) { + return; + } + this.service.setAsShipped(row.id).subscribe(() => { + this.list.get(); + }); + }); + } + setAsCancelled(row: OrderViewModel){ + this.confirmationService + .warn('AbpOrdering::WillSetAsCancelled', { key: '::AreYouSure', defaultValue: 'Are you sure?' }) + .subscribe((status``) => { + if (status !== Confirmation.Status.confirm) { + return; + } + this.service.setAsCancelled(row.id, { paymentRequestId: undefined, paymentRequestStatus: undefined}).subscribe(() => { + this.list.get(); + }); + }) + ; + } } diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.module.ts b/apps/angular/projects/ordering/src/pages/orders/orders.module.ts index 78ea50b9..fcc888c4 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.module.ts +++ b/apps/angular/projects/ordering/src/pages/orders/orders.module.ts @@ -6,15 +6,19 @@ import { OrdersComponent } from './orders.component'; import { ThemeSharedModule } from '@abp/ng.theme.shared'; import { CoreModule } from '@abp/ng.core'; import { OrderDetailComponent } from './order-detail/order-detail.component'; +import { OrderDetailItemComponent } from './order-detail/order-detail-item/order-detail-item.component'; +import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'; @NgModule({ declarations: [ OrdersComponent, - OrderDetailComponent + OrderDetailComponent, + OrderDetailItemComponent ], imports: [ CommonModule, + NgbDropdownModule, OrdersRoutingModule, ThemeSharedModule, CoreModule, diff --git a/apps/angular/src/environments/environment.prod.ts b/apps/angular/src/environments/environment.prod.ts index 9cc0851e..d54bc574 100644 --- a/apps/angular/src/environments/environment.prod.ts +++ b/apps/angular/src/environments/environment.prod.ts @@ -1,4 +1,4 @@ -import { Environment } from '@abp/ng.core'; +import { MyEnvironment } from './my-environment'; const baseUrl = 'http://localhost:4200'; @@ -22,8 +22,8 @@ export const environment = { rootNamespace: 'EShopOnAbp', }, }, - remoteEnv:{ - url: "/getEnvConfig", - mergeStrategy:'deepmerge' + remoteEnv: { + url: '/getEnvConfig', + mergeStrategy: 'deepmerge' } -} as Environment; +} as MyEnvironment; diff --git a/apps/angular/src/environments/environment.ts b/apps/angular/src/environments/environment.ts index d95bd122..23de1afb 100644 --- a/apps/angular/src/environments/environment.ts +++ b/apps/angular/src/environments/environment.ts @@ -1,4 +1,4 @@ -import { Environment } from '@abp/ng.core'; +import { MyEnvironment } from './my-environment'; const baseUrl = 'http://localhost:4200'; @@ -25,9 +25,12 @@ export const environment = { url: 'https://localhost:44354', rootNamespace: 'EShopOnAbp.CatalogService', }, - Ordering:{ + Ordering: { url: "https://localhost:44356", rootNamespace: 'EShopOnAbp.OrderingService', } }, -} as Environment; + mediaServerUrl:'https://localhost:44335' +} as MyEnvironment; + + diff --git a/apps/angular/src/environments/my-environment.ts b/apps/angular/src/environments/my-environment.ts new file mode 100644 index 00000000..5bae69f1 --- /dev/null +++ b/apps/angular/src/environments/my-environment.ts @@ -0,0 +1,5 @@ +import { Environment } from '@abp/ng.core'; + +export interface MyEnvironment extends Environment{ + mediaServerUrl?: string; +} diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/Components/UserOrders/Default.cshtml b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/UserOrders/Default.cshtml index 4b0bcd39..344b969e 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/Components/UserOrders/Default.cshtml +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/UserOrders/Default.cshtml @@ -13,7 +13,7 @@ @foreach (var order in Model.UserOrders) { - var orderTotalString = order.Items.Sum(q => q.UnitPrice).ToString("C", new CultureInfo("en-US")); + var orderTotalString = order.Items.Sum(q => q.UnitPrice * q.Units).ToString("C", new CultureInfo("en-US")); string addressString = $"{order.Address.Street} {order.Address.ZipCode} \n {order.Address.City}/{order.Address.Country}";
diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs index 1e9191de..213aac33 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs @@ -43,7 +43,7 @@ public class OrderAppService : ApplicationService, IOrderAppService return CreateOrderDtoMapping(orders); } - [Authorize(OrderingServicePermissions.Orders.Default)] + //[Authorize(OrderingServicePermissions.Orders.Default)] public async Task> GetOrdersAsync(GetOrdersInput input) { ISpecification specification = SpecificationFactory.Create(input.Filter); From 56b4cba0044d161f9baeae3be1365b90ac8311d8 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Tue, 15 Mar 2022 17:59:52 +0300 Subject: [PATCH 14/32] feat: add order detail modal template to ordering page --- .../src/lib/proxy/generate-proxy.json | 233 ++++++++++++++++-- .../ordering/src/lib/proxy/orders/models.ts | 5 +- .../src/lib/proxy/orders/order.service.ts | 26 +- .../src/pages/orders/orders.component.html | 19 +- .../src/pages/orders/orders.component.ts | 3 +- 5 files changed, 255 insertions(+), 31 deletions(-) diff --git a/apps/angular/projects/ordering/src/lib/proxy/generate-proxy.json b/apps/angular/projects/ordering/src/lib/proxy/generate-proxy.json index 1f441a49..ee7eda0d 100644 --- a/apps/angular/projects/ordering/src/lib/proxy/generate-proxy.json +++ b/apps/angular/projects/ordering/src/lib/proxy/generate-proxy.json @@ -215,6 +215,67 @@ "allowAnonymous": null, "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" }, + "GetListPagedAsyncByInput": { + "uniqueName": "GetListPagedAsyncByInput", + "name": "GetListPagedAsync", + "httpMethod": "GET", + "url": "api/ordering/order/paged", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "input", + "typeAsString": "Volo.Abp.Application.Dtos.PagedAndSortedResultRequestDto, Volo.Abp.Ddd.Application.Contracts", + "type": "Volo.Abp.Application.Dtos.PagedAndSortedResultRequestDto", + "typeSimple": "Volo.Abp.Application.Dtos.PagedAndSortedResultRequestDto", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "input", + "name": "Sorting", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + }, + { + "nameOnMethod": "input", + "name": "SkipCount", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + }, + { + "nameOnMethod": "input", + "name": "MaxResultCount", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "input" + } + ], + "returnValue": { + "type": "Volo.Abp.Application.Dtos.PagedResultDto", + "typeSimple": "Volo.Abp.Application.Dtos.PagedResultDto" + }, + "allowAnonymous": false, + "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" + }, "GetByOrderNoAsyncByOrderNo": { "uniqueName": "GetByOrderNoAsyncByOrderNo", "name": "GetByOrderNoAsync", @@ -252,11 +313,11 @@ "allowAnonymous": null, "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" }, - "UpdateAsyncByIdAndInput": { - "uniqueName": "UpdateAsyncByIdAndInput", - "name": "UpdateAsync", - "httpMethod": "PUT", - "url": "api/ordering/order/{id}", + "SetAsCancelledAsyncByIdAndInput": { + "uniqueName": "SetAsCancelledAsyncByIdAndInput", + "name": "SetAsCancelledAsync", + "httpMethod": "POST", + "url": "api/ordering/order/{id}/set-as-cancelled", "supportedVersions": [], "parametersOnMethod": [ { @@ -269,9 +330,9 @@ }, { "name": "input", - "typeAsString": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto, EShopOnAbp.OrderingService.Application.Contracts", - "type": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto", - "typeSimple": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto", + "typeAsString": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto, EShopOnAbp.OrderingService.Application.Contracts", + "type": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto", + "typeSimple": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto", "isOptional": false, "defaultValue": null } @@ -293,8 +354,8 @@ "nameOnMethod": "input", "name": "input", "jsonName": null, - "type": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto", - "typeSimple": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto", + "type": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto", + "typeSimple": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto", "isOptional": false, "defaultValue": null, "constraintTypes": null, @@ -303,10 +364,47 @@ } ], "returnValue": { - "type": "EShopOnAbp.OrderingService.Orders.OrderDto", - "typeSimple": "EShopOnAbp.OrderingService.Orders.OrderDto" + "type": "System.Void", + "typeSimple": "System.Void" }, - "allowAnonymous": null, + "allowAnonymous": false, + "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" + }, + "SetAsShippedAsyncById": { + "uniqueName": "SetAsShippedAsyncById", + "name": "SetAsShippedAsync", + "httpMethod": "POST", + "url": "api/ordering/order/{id}/set-as-shipped", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "id", + "typeAsString": "System.Guid, System.Private.CoreLib", + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "id", + "name": "id", + "jsonName": null, + "type": "System.Guid", + "typeSimple": "string", + "isOptional": false, + "defaultValue": null, + "constraintTypes": [], + "bindingSourceId": "Path", + "descriptorName": "" + } + ], + "returnValue": { + "type": "System.Void", + "typeSimple": "System.Void" + }, + "allowAnonymous": false, "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" }, "CreateAsyncByInput": { @@ -2098,7 +2196,39 @@ } ] }, - "EShopOnAbp.OrderingService.Orders.UpdateOrderDto": { + "Volo.Abp.Application.Dtos.PagedAndSortedResultRequestDto": { + "baseType": "Volo.Abp.Application.Dtos.PagedResultRequestDto", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "Sorting", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false + } + ] + }, + "Volo.Abp.Application.Dtos.PagedResultRequestDto": { + "baseType": "Volo.Abp.Application.Dtos.LimitedResultRequestDto", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "SkipCount", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isRequired": false + } + ] + }, + "Volo.Abp.Application.Dtos.LimitedResultRequestDto": { "baseType": null, "isEnum": false, "enumNames": null, @@ -2106,11 +2236,84 @@ "genericArguments": null, "properties": [ { - "name": "OrderStatusId", + "name": "DefaultMaxResultCount", "jsonName": null, "type": "System.Int32", "typeSimple": "number", "isRequired": false + }, + { + "name": "MaxMaxResultCount", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isRequired": false + }, + { + "name": "MaxResultCount", + "jsonName": null, + "type": "System.Int32", + "typeSimple": "number", + "isRequired": false + } + ] + }, + "Volo.Abp.Application.Dtos.PagedResultDto": { + "baseType": "Volo.Abp.Application.Dtos.ListResultDto", + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": [ + "T" + ], + "properties": [ + { + "name": "TotalCount", + "jsonName": null, + "type": "System.Int64", + "typeSimple": "number", + "isRequired": false + } + ] + }, + "Volo.Abp.Application.Dtos.ListResultDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": [ + "T" + ], + "properties": [ + { + "name": "Items", + "jsonName": null, + "type": "[T]", + "typeSimple": "[T]", + "isRequired": false + } + ] + }, + "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto": { + "baseType": null, + "isEnum": false, + "enumNames": null, + "enumValues": null, + "genericArguments": null, + "properties": [ + { + "name": "PaymentRequestId", + "jsonName": null, + "type": "System.Guid", + "typeSimple": "string", + "isRequired": false + }, + { + "name": "PaymentRequestStatus", + "jsonName": null, + "type": "System.String", + "typeSimple": "string", + "isRequired": false } ] }, diff --git a/apps/angular/projects/ordering/src/lib/proxy/orders/models.ts b/apps/angular/projects/ordering/src/lib/proxy/orders/models.ts index 071bbefe..da2b3c9a 100644 --- a/apps/angular/projects/ordering/src/lib/proxy/orders/models.ts +++ b/apps/angular/projects/ordering/src/lib/proxy/orders/models.ts @@ -57,6 +57,7 @@ export interface OrderItemDto extends EntityDto { units: number; } -export interface UpdateOrderDto { - orderStatusId: number; +export interface SetAsCancelledDto { + paymentRequestId?: string; + paymentRequestStatus?: string; } diff --git a/apps/angular/projects/ordering/src/lib/proxy/orders/order.service.ts b/apps/angular/projects/ordering/src/lib/proxy/orders/order.service.ts index 5ea19fdf..6b4e5b94 100644 --- a/apps/angular/projects/ordering/src/lib/proxy/orders/order.service.ts +++ b/apps/angular/projects/ordering/src/lib/proxy/orders/order.service.ts @@ -1,5 +1,6 @@ -import type { GetMyOrdersInput, GetOrdersInput, OrderCreateDto, OrderDto, UpdateOrderDto } from './models'; +import type { GetMyOrdersInput, GetOrdersInput, OrderCreateDto, OrderDto, SetAsCancelledDto } from './models'; import { RestService } from '@abp/ng.core'; +import type { PagedAndSortedResultRequestDto, PagedResultDto } from '@abp/ng.core'; import { Injectable } from '@angular/core'; @Injectable({ @@ -31,6 +32,14 @@ export class OrderService { }, { apiName: this.apiName }); + getListPaged = (input: PagedAndSortedResultRequestDto) => + this.restService.request>({ + method: 'GET', + url: '/api/ordering/order/paged', + params: { sorting: input.sorting, skipCount: input.skipCount, maxResultCount: input.maxResultCount }, + }, + { apiName: this.apiName }); + getMyOrders = (input: GetMyOrdersInput) => this.restService.request({ method: 'GET', @@ -47,13 +56,20 @@ export class OrderService { }, { apiName: this.apiName }); - update = (id: string, input: UpdateOrderDto) => - this.restService.request({ - method: 'PUT', - url: `/api/ordering/order/${id}`, + setAsCancelled = (id: string, input: SetAsCancelledDto) => + this.restService.request({ + method: 'POST', + url: `/api/ordering/order/${id}/set-as-cancelled`, body: input, }, { apiName: this.apiName }); + setAsShipped = (id: string) => + this.restService.request({ + method: 'POST', + url: `/api/ordering/order/${id}/set-as-shipped`, + }, + { apiName: this.apiName }); + constructor(private restService: RestService) {} } diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.html b/apps/angular/projects/ordering/src/pages/orders/orders.component.html index 0501af0c..f747ef32 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.component.html +++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.html @@ -10,7 +10,7 @@
- + @@ -27,16 +27,22 @@ + +
@@ -53,9 +59,6 @@ - - - @@ -63,4 +66,4 @@ - + diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.ts b/apps/angular/projects/ordering/src/pages/orders/orders.component.ts index 3fb843c2..9a180d7d 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.component.ts +++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.ts @@ -29,6 +29,7 @@ export class OrdersComponent implements OnInit { }); } + openModal(order: OrderViewModel) { if (!order){ return; @@ -60,7 +61,7 @@ export class OrdersComponent implements OnInit { setAsCancelled(row: OrderViewModel){ this.confirmationService .warn('AbpOrdering::WillSetAsCancelled', { key: '::AreYouSure', defaultValue: 'Are you sure?' }) - .subscribe((status``) => { + .subscribe((status) => { if (status !== Confirmation.Status.confirm) { return; } From cd6b3962a1dc5c3c042cb817895be2ef15ea6e6b Mon Sep 17 00:00:00 2001 From: malik masis Date: Wed, 16 Mar 2022 10:25:01 +0300 Subject: [PATCH 15/32] Added log once consuming the cancelling event Removed the business logic and added the log to improve it in the future --- .../EShopOnAbp.PaymentService.Domain.csproj | 1 + .../EventHandlers/OrderCancelledEventHandler.cs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/services/payment/src/EShopOnAbp.PaymentService.Domain/EShopOnAbp.PaymentService.Domain.csproj b/services/payment/src/EShopOnAbp.PaymentService.Domain/EShopOnAbp.PaymentService.Domain.csproj index a1af97d7..c87f3bb4 100644 --- a/services/payment/src/EShopOnAbp.PaymentService.Domain/EShopOnAbp.PaymentService.Domain.csproj +++ b/services/payment/src/EShopOnAbp.PaymentService.Domain/EShopOnAbp.PaymentService.Domain.csproj @@ -14,6 +14,7 @@ + diff --git a/services/payment/src/EShopOnAbp.PaymentService.Domain/EventHandlers/OrderCancelledEventHandler.cs b/services/payment/src/EShopOnAbp.PaymentService.Domain/EventHandlers/OrderCancelledEventHandler.cs index 9f1d781f..a4e3837c 100644 --- a/services/payment/src/EShopOnAbp.PaymentService.Domain/EventHandlers/OrderCancelledEventHandler.cs +++ b/services/payment/src/EShopOnAbp.PaymentService.Domain/EventHandlers/OrderCancelledEventHandler.cs @@ -1,9 +1,10 @@ using EShopOnAbp.OrderingService.Orders; using EShopOnAbp.PaymentService.PaymentRequests; +using Serilog; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; using Volo.Abp.EventBus.Distributed; -using Volo.Abp.Uow; + namespace EShopOnAbp.PaymentService.EventHandlers { @@ -16,11 +17,10 @@ namespace EShopOnAbp.PaymentService.EventHandlers _paymentRepository = paymenRepository; } - [UnitOfWork] public async Task HandleEventAsync(OrderCancelledEto eventData) { var payment = await _paymentRepository.GetAsync(eventData.Buyer.BuyerId.GetValueOrDefault()); - await _paymentRepository.DeleteAsync(payment); + Log.Information($"Cancelled the order: {payment.OrderId} payment:{payment.Id}"); } } } From d019752d7abe7b4efb6f73c86152976407b58dea Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Wed, 16 Mar 2022 13:33:16 +0300 Subject: [PATCH 16/32] feat: add orders page localization --- .../ordering/config/src/enums/route-names.ts | 3 +-- .../src/pages/orders/orders.component.html | 14 +++++++------- .../Localization/OrderingService/en.json | 7 ++++++- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/apps/angular/projects/ordering/config/src/enums/route-names.ts b/apps/angular/projects/ordering/config/src/enums/route-names.ts index 4a594fc3..4d3606c8 100644 --- a/apps/angular/projects/ordering/config/src/enums/route-names.ts +++ b/apps/angular/projects/ordering/config/src/enums/route-names.ts @@ -1,4 +1,3 @@ export const enum eOrderingRouteNames { - Ordering = 'OrderingService::Menu:Orders', - Orders = 'CatalogService::Menu:Products', + Ordering = 'OrderingService::Menu:OrderManagement' } diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.html b/apps/angular/projects/ordering/src/pages/orders/orders.component.html index f747ef32..56eb9405 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.component.html +++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.html @@ -28,37 +28,37 @@ class="dropdown-item" (click)='openModal(row)' > - {{ 'AbpOrdering::Detail' | abpLocalization }} + {{ 'AbpUi::Edit' | abpLocalization }} - - + + {{ value | date }} - + {{ value | currency }} - + diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json index e6d127d4..57abdfc2 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json @@ -11,7 +11,12 @@ "Permission:Orders": "Orders", "Permission:OrderingService": "Ordering Service", "Menu:Orders": "Orders", - "Menu:OrderManagement": "Ordering Service", + "Menu:OrderManagement": "Order Management", + + "DisplayName:OrderNo": "Order No", + "DisplayName:OrderDate": "Order Date", + "DisplayName:OrderTotal": "Total", + "DisplayName:OrderStatus": "Order Status", "Permission:Orders.SetAsCancelled": "Set As Cancelled", "Permission:Orders.SetAsShipped": "Set As Shipped" } From 98662a1a968e378d427e03498ea797e9d9ea2219 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Wed, 16 Mar 2022 14:26:00 +0300 Subject: [PATCH 17/32] feat: add order detail page localization and permission --- .../ordering/config/src/enums/policy-names.ts | 9 +++-- .../ordering/config/src/enums/route-names.ts | 2 +- .../config/src/providers/route.provider.ts | 3 +- .../order-detail/order-detail.component.html | 34 +++++++++---------- .../src/pages/orders/orders.component.html | 9 +++-- .../src/pages/orders/orders.component.ts | 6 ++++ .../Localization/OrderingService/en.json | 15 +++++++- 7 files changed, 49 insertions(+), 29 deletions(-) diff --git a/apps/angular/projects/ordering/config/src/enums/policy-names.ts b/apps/angular/projects/ordering/config/src/enums/policy-names.ts index 6ddc7800..28b6edd3 100644 --- a/apps/angular/projects/ordering/config/src/enums/policy-names.ts +++ b/apps/angular/projects/ordering/config/src/enums/policy-names.ts @@ -1,7 +1,6 @@ export const enum eOrderingPolicyNames { - Ordering = 'CatalogService.Products', - - ProductManagementCreate = 'CatalogService.Products.Create', - ProductManagementUpdate = 'CatalogService.Products.Update', - ProductManagementDelete = 'CatalogService.Products.Delete', + ordering = 'OrderingService.Orders', + detail = 'OrderingService.Orders.Orders', + setAsShipped = 'OrderingService.Orders.SetAsShipped', + setAsCancelled = 'OrderingService.Products.SetAsCancelled', } diff --git a/apps/angular/projects/ordering/config/src/enums/route-names.ts b/apps/angular/projects/ordering/config/src/enums/route-names.ts index 4d3606c8..6dc09b1f 100644 --- a/apps/angular/projects/ordering/config/src/enums/route-names.ts +++ b/apps/angular/projects/ordering/config/src/enums/route-names.ts @@ -1,3 +1,3 @@ export const enum eOrderingRouteNames { - Ordering = 'OrderingService::Menu:OrderManagement' + ordering = 'OrderingService::Menu:OrderManagement' } diff --git a/apps/angular/projects/ordering/config/src/providers/route.provider.ts b/apps/angular/projects/ordering/config/src/providers/route.provider.ts index 9a9848b5..1e892f2d 100644 --- a/apps/angular/projects/ordering/config/src/providers/route.provider.ts +++ b/apps/angular/projects/ordering/config/src/providers/route.provider.ts @@ -12,8 +12,9 @@ export function configureRoutes(routesService: RoutesService) { routesService.add([ { path: '/ordering', - name: eOrderingRouteNames.Ordering, + name: eOrderingRouteNames.ordering, layout: eLayoutType.application, + requiredPolicy: eOrderingPolicyNames.ordering, parentName: null, iconClass: 'bi bi-collection-fill', }, diff --git a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html index d802e87e..55a26904 100644 --- a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html +++ b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html @@ -1,18 +1,18 @@ -

Order Detail

+

{{"OrderingService::ModalTitle" | abpLocalization }}

- #{{order.orderNo}} - {{order.orderStatus}} - {{order.buyer.name}} - {{order.buyer.email}} + #{{order.orderNo}} + {{order.orderStatus}} + {{order.buyer.name}} + {{order.buyer.email}} - + {{address.description}}
{{address.street}}
@@ -20,35 +20,33 @@ {{address.city}} / {{address.country}}
- {{order.paymentMethod}} - {{order.orderTotal | currency}} - + {{order.paymentMethod}} + {{order.orderTotal | currency}}



- - + + - + - - + + {{value | currency }} - - - + + {{value }} % - + {{(row.units * row.unitPrice) | currency }} diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.html b/apps/angular/projects/ordering/src/pages/orders/orders.component.html index 56eb9405..e50f6daf 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.component.html +++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.html @@ -27,21 +27,24 @@
diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.ts b/apps/angular/projects/ordering/src/pages/orders/orders.component.ts index 9a180d7d..723d6bd9 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.component.ts +++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.ts @@ -3,6 +3,7 @@ import { OrderService } from '../../lib/proxy/orders'; import { OrderViewModel, toOrderViewModel } from '../../lib'; import { Confirmation, ConfirmationService } from '@abp/ng.theme.shared'; import { ListService } from '@abp/ng.core'; +import { eOrderingPolicyNames } from '@eshoponabp/ordering/config'; @Component({ selector: 'lib-orders', @@ -18,6 +19,11 @@ export class OrdersComponent implements OnInit { isModalVisible = false; items: OrderViewModel[]; count = 0; + permissions = { + detail: eOrderingPolicyNames.ordering, + setAsShipped: eOrderingPolicyNames.setAsShipped, + setAsCancelled: eOrderingPolicyNames.setAsCancelled, + }; ngOnInit(): void { diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json index 57abdfc2..1d50a6c6 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json @@ -15,8 +15,21 @@ "DisplayName:OrderNo": "Order No", "DisplayName:OrderDate": "Order Date", - "DisplayName:OrderTotal": "Total", + "DisplayName:OrderTotal": "Order Total", "DisplayName:OrderStatus": "Order Status", + + "DisplayName:ProductId": "Product Id", + "DisplayName:ProductName": "Product Name", + "DisplayName:PictureUrl": "Picture", + "DisplayName:Units": "Unit", + "DisplayName:UnitPrice": "Unit Price", + "DisplayName:Discount": "Discount", + "DisplayName:TotalPrice": "Total Price", + "DisplayName:BuyerName": "Buyer Name", + "DisplayName:BuyerEmail": "Buyer E-mail", + "DisplayName:Address": "Address", + "DisplayName:PaymentMethod": "Payment Method", + "DisplayName:Total": "Total", "Permission:Orders.SetAsCancelled": "Set As Cancelled", "Permission:Orders.SetAsShipped": "Set As Shipped" } From 597c7b61932ba38aa5d259f7b358a7e323b3dd15 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Wed, 16 Mar 2022 15:03:44 +0300 Subject: [PATCH 18/32] add forgotten codes --- .../Orders/OrderAppService.cs | 2 +- .../Localization/OrderingService/en.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs index 213aac33..1e9191de 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs @@ -43,7 +43,7 @@ public class OrderAppService : ApplicationService, IOrderAppService return CreateOrderDtoMapping(orders); } - //[Authorize(OrderingServicePermissions.Orders.Default)] + [Authorize(OrderingServicePermissions.Orders.Default)] public async Task> GetOrdersAsync(GetOrdersInput input) { ISpecification specification = SpecificationFactory.Create(input.Filter); diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json index 1d50a6c6..c1bbf183 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json @@ -12,7 +12,8 @@ "Permission:OrderingService": "Ordering Service", "Menu:Orders": "Orders", "Menu:OrderManagement": "Order Management", - + "ModalTitle":"Order Detail", + "DisplayName:OrderNo": "Order No", "DisplayName:OrderDate": "Order Date", "DisplayName:OrderTotal": "Order Total", From 029be2c8406cbad3f9b4ee8c600fa3aacef390b4 Mon Sep 17 00:00:00 2001 From: malik masis Date: Wed, 16 Mar 2022 16:26:19 +0300 Subject: [PATCH 19/32] Removed case for update action in unit test --- .../Orders/OrderApplication_Tests.cs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/services/ordering/test/EShopOnAbp.OrderingService.Application.Tests/Orders/OrderApplication_Tests.cs b/services/ordering/test/EShopOnAbp.OrderingService.Application.Tests/Orders/OrderApplication_Tests.cs index 2d581037..5adf2e5e 100644 --- a/services/ordering/test/EShopOnAbp.OrderingService.Application.Tests/Orders/OrderApplication_Tests.cs +++ b/services/ordering/test/EShopOnAbp.OrderingService.Application.Tests/Orders/OrderApplication_Tests.cs @@ -66,15 +66,6 @@ public class OrderApplication_Tests : OrderingServiceApplicationTestBase var myOrder = await _orderAppService.GetByOrderNoAsync(placedOrder.OrderNo); myOrder.ShouldNotBeNull(); - - var cancelledMyOrder = await _orderAppService.SetAsCancelledAsync(placedOrder.Id, new SetAsCancelledDto() - { - OrderStatusId = OrderStatus.Shipped.Id, - }); - //TODO - temp value - it should be Shipped - cancelledMyOrder.OrderStatus.ShouldBe(OrderStatus.Placed.ToString()); - - // Get all orders var orders = await _orderAppService.GetOrdersAsync(new GetOrdersInput() { From b8d0820a52bfe50903976ccbe19c336a728ebde9 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Fri, 18 Mar 2022 16:24:20 +0300 Subject: [PATCH 20/32] Update policies, set status from enum. --- .../ordering/config/src/enums/policy-names.ts | 6 ++-- .../order-status/order-status.component.ts | 33 +++++++++++++++++++ .../src/lib/proxy/generate-proxy.json | 31 +++++++++++------ .../ordering/src/lib/proxy/orders/index.ts | 1 + .../ordering/src/lib/proxy/orders/models.ts | 4 +-- .../src/lib/proxy/orders/order-status.enum.ts | 10 ++++++ .../projects/ordering/src/ordering.module.ts | 9 +++-- .../src/pages/orders/orders.component.html | 16 +++++---- .../src/pages/orders/orders.component.ts | 2 ++ .../src/pages/orders/orders.module.ts | 16 +++++---- 10 files changed, 98 insertions(+), 30 deletions(-) create mode 100644 apps/angular/projects/ordering/src/lib/components/order-status/order-status.component.ts create mode 100644 apps/angular/projects/ordering/src/lib/proxy/orders/order-status.enum.ts diff --git a/apps/angular/projects/ordering/config/src/enums/policy-names.ts b/apps/angular/projects/ordering/config/src/enums/policy-names.ts index 28b6edd3..6fd27f3c 100644 --- a/apps/angular/projects/ordering/config/src/enums/policy-names.ts +++ b/apps/angular/projects/ordering/config/src/enums/policy-names.ts @@ -1,6 +1,6 @@ export const enum eOrderingPolicyNames { ordering = 'OrderingService.Orders', - detail = 'OrderingService.Orders.Orders', - setAsShipped = 'OrderingService.Orders.SetAsShipped', - setAsCancelled = 'OrderingService.Products.SetAsCancelled', + detail = 'OrderingService.Orders', + setAsShipped = 'OrderingService.SetAsShipped', + setAsCancelled = 'OrderingService.SetAsCancelled', } diff --git a/apps/angular/projects/ordering/src/lib/components/order-status/order-status.component.ts b/apps/angular/projects/ordering/src/lib/components/order-status/order-status.component.ts new file mode 100644 index 00000000..85194f8a --- /dev/null +++ b/apps/angular/projects/ordering/src/lib/components/order-status/order-status.component.ts @@ -0,0 +1,33 @@ +import {ChangeDetectionStrategy, Component, Input} from '@angular/core'; +import {orderStatusOptions} from '../../proxy/orders'; + +@Component({ + selector: 'lib-order-status', + template: ` + {{statusText}} + `, + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class OrderStatusComponent { + + @Input() + set id(v: number) { + this.statusText = this.idToText(v); + } + + options = orderStatusOptions; + + statusText: string; + + private idToText(id: number): string | null { + console.log('hello', new Date().toLocalISOString()) + const item = this.options.find(x => x.value === id); + + if (!item) { + return null; + } + return item.key; + } + + +} diff --git a/apps/angular/projects/ordering/src/lib/proxy/generate-proxy.json b/apps/angular/projects/ordering/src/lib/proxy/generate-proxy.json index ee7eda0d..9c464296 100644 --- a/apps/angular/projects/ordering/src/lib/proxy/generate-proxy.json +++ b/apps/angular/projects/ordering/src/lib/proxy/generate-proxy.json @@ -212,7 +212,7 @@ "type": "System.Collections.Generic.List", "typeSimple": "[EShopOnAbp.OrderingService.Orders.OrderDto]" }, - "allowAnonymous": null, + "allowAnonymous": false, "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" }, "GetListPagedAsyncByInput": { @@ -1976,18 +1976,11 @@ "typeSimple": "number", "isRequired": false }, - { - "name": "OrderStatusId", - "jsonName": null, - "type": "System.Int32", - "typeSimple": "number", - "isRequired": false - }, { "name": "OrderStatus", "jsonName": null, - "type": "System.String", - "typeSimple": "string", + "type": "EShopOnAbp.OrderingService.Orders.OrderStatus", + "typeSimple": "EShopOnAbp.OrderingService.Orders.OrderStatus", "isRequired": false }, { @@ -2046,6 +2039,24 @@ "genericArguments": null, "properties": [] }, + "EShopOnAbp.OrderingService.Orders.OrderStatus": { + "baseType": "System.Enum", + "isEnum": true, + "enumNames": [ + "Placed", + "Paid", + "Shipped", + "Cancelled" + ], + "enumValues": [ + 0, + 1, + 2, + 3 + ], + "genericArguments": null, + "properties": null + }, "EShopOnAbp.OrderingService.Orders.BuyerDto": { "baseType": "Volo.Abp.Application.Dtos.EntityDto", "isEnum": false, diff --git a/apps/angular/projects/ordering/src/lib/proxy/orders/index.ts b/apps/angular/projects/ordering/src/lib/proxy/orders/index.ts index d6641f7d..989de0e0 100644 --- a/apps/angular/projects/ordering/src/lib/proxy/orders/index.ts +++ b/apps/angular/projects/ordering/src/lib/proxy/orders/index.ts @@ -1,2 +1,3 @@ export * from './models'; +export * from './order-status.enum'; export * from './order.service'; diff --git a/apps/angular/projects/ordering/src/lib/proxy/orders/models.ts b/apps/angular/projects/ordering/src/lib/proxy/orders/models.ts index da2b3c9a..31c23a05 100644 --- a/apps/angular/projects/ordering/src/lib/proxy/orders/models.ts +++ b/apps/angular/projects/ordering/src/lib/proxy/orders/models.ts @@ -1,4 +1,5 @@ import type { EntityDto } from '@abp/ng.core'; +import type { OrderStatus } from './order-status.enum'; export interface BuyerDto extends EntityDto { name?: string; @@ -30,8 +31,7 @@ export interface OrderCreateDto { export interface OrderDto extends EntityDto { orderDate?: string; orderNo: number; - orderStatusId: number; - orderStatus?: string; + orderStatus: OrderStatus; paymentMethod?: string; buyer: BuyerDto; address: OrderAddressDto; diff --git a/apps/angular/projects/ordering/src/lib/proxy/orders/order-status.enum.ts b/apps/angular/projects/ordering/src/lib/proxy/orders/order-status.enum.ts new file mode 100644 index 00000000..d63bfc72 --- /dev/null +++ b/apps/angular/projects/ordering/src/lib/proxy/orders/order-status.enum.ts @@ -0,0 +1,10 @@ +import { mapEnumToOptions } from '@abp/ng.core'; + +export enum OrderStatus { + Placed = 0, + Paid = 1, + Shipped = 2, + Cancelled = 3, +} + +export const orderStatusOptions = mapEnumToOptions(OrderStatus); diff --git a/apps/angular/projects/ordering/src/ordering.module.ts b/apps/angular/projects/ordering/src/ordering.module.ts index 7c7702f5..5d342ad0 100644 --- a/apps/angular/projects/ordering/src/ordering.module.ts +++ b/apps/angular/projects/ordering/src/ordering.module.ts @@ -1,13 +1,18 @@ import { NgModule } from '@angular/core'; import { OrderingRoutingModule } from './ordering-routing.module'; +import { OrderStatusComponent } from './lib/components/order-status/order-status.component'; @NgModule({ - declarations: [], + declarations: [ + OrderStatusComponent + ], imports: [ OrderingRoutingModule ], - exports: [] + exports: [ + OrderStatusComponent + ] }) export class OrderingModule { } diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.html b/apps/angular/projects/ordering/src/pages/orders/orders.component.html index e50f6daf..162a7297 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.component.html +++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.html @@ -13,7 +13,7 @@ - +
@@ -61,7 +61,11 @@ {{ value | currency }}
- + + + + +
diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.ts b/apps/angular/projects/ordering/src/pages/orders/orders.component.ts index 723d6bd9..b5fff269 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.component.ts +++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.ts @@ -25,8 +25,10 @@ export class OrdersComponent implements OnInit { setAsCancelled: eOrderingPolicyNames.setAsCancelled, }; + ngOnInit(): void { + console.log(this.permissions) const ordersStreamCreator = query => this.service.getListPaged(query); this.list.hookToQuery(ordersStreamCreator).subscribe(response => { diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.module.ts b/apps/angular/projects/ordering/src/pages/orders/orders.module.ts index fcc888c4..4397bc98 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.module.ts +++ b/apps/angular/projects/ordering/src/pages/orders/orders.module.ts @@ -8,6 +8,7 @@ import { CoreModule } from '@abp/ng.core'; import { OrderDetailComponent } from './order-detail/order-detail.component'; import { OrderDetailItemComponent } from './order-detail/order-detail-item/order-detail-item.component'; import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'; +import {OrderingModule} from "../../ordering.module"; @NgModule({ @@ -16,12 +17,13 @@ import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'; OrderDetailComponent, OrderDetailItemComponent ], - imports: [ - CommonModule, - NgbDropdownModule, - OrdersRoutingModule, - ThemeSharedModule, - CoreModule, - ] + imports: [ + CommonModule, + NgbDropdownModule, + OrdersRoutingModule, + ThemeSharedModule, + CoreModule, + OrderingModule, + ] }) export class OrdersModule { } From 619bf7bc3d8c7f102893c68bb915c04909143a28 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Fri, 18 Mar 2022 17:05:52 +0300 Subject: [PATCH 21/32] Get value of OrderStatusEnum at localization --- .../order-status/order-status.component.ts | 33 ------------------- .../projects/ordering/src/ordering.module.ts | 7 +--- .../src/pages/orders/orders.component.html | 2 +- .../src/pages/orders/orders.module.ts | 2 -- .../Localization/OrderingService/en.json | 6 +++- 5 files changed, 7 insertions(+), 43 deletions(-) delete mode 100644 apps/angular/projects/ordering/src/lib/components/order-status/order-status.component.ts diff --git a/apps/angular/projects/ordering/src/lib/components/order-status/order-status.component.ts b/apps/angular/projects/ordering/src/lib/components/order-status/order-status.component.ts deleted file mode 100644 index 85194f8a..00000000 --- a/apps/angular/projects/ordering/src/lib/components/order-status/order-status.component.ts +++ /dev/null @@ -1,33 +0,0 @@ -import {ChangeDetectionStrategy, Component, Input} from '@angular/core'; -import {orderStatusOptions} from '../../proxy/orders'; - -@Component({ - selector: 'lib-order-status', - template: ` - {{statusText}} - `, - changeDetection: ChangeDetectionStrategy.OnPush -}) -export class OrderStatusComponent { - - @Input() - set id(v: number) { - this.statusText = this.idToText(v); - } - - options = orderStatusOptions; - - statusText: string; - - private idToText(id: number): string | null { - console.log('hello', new Date().toLocalISOString()) - const item = this.options.find(x => x.value === id); - - if (!item) { - return null; - } - return item.key; - } - - -} diff --git a/apps/angular/projects/ordering/src/ordering.module.ts b/apps/angular/projects/ordering/src/ordering.module.ts index 5d342ad0..75e1eb8b 100644 --- a/apps/angular/projects/ordering/src/ordering.module.ts +++ b/apps/angular/projects/ordering/src/ordering.module.ts @@ -1,18 +1,13 @@ import { NgModule } from '@angular/core'; import { OrderingRoutingModule } from './ordering-routing.module'; -import { OrderStatusComponent } from './lib/components/order-status/order-status.component'; - @NgModule({ declarations: [ - OrderStatusComponent ], imports: [ OrderingRoutingModule ], - exports: [ - OrderStatusComponent - ] + exports: [] }) export class OrderingModule { } diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.html b/apps/angular/projects/ordering/src/pages/orders/orders.component.html index 162a7297..cc116521 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.component.html +++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.html @@ -63,7 +63,7 @@
- + {{ "OrderingService::Enum:OrderStatus:" + value | abpLocalization }} diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.module.ts b/apps/angular/projects/ordering/src/pages/orders/orders.module.ts index 4397bc98..ee7f4aac 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.module.ts +++ b/apps/angular/projects/ordering/src/pages/orders/orders.module.ts @@ -8,7 +8,6 @@ import { CoreModule } from '@abp/ng.core'; import { OrderDetailComponent } from './order-detail/order-detail.component'; import { OrderDetailItemComponent } from './order-detail/order-detail-item/order-detail-item.component'; import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'; -import {OrderingModule} from "../../ordering.module"; @NgModule({ @@ -23,7 +22,6 @@ import {OrderingModule} from "../../ordering.module"; OrdersRoutingModule, ThemeSharedModule, CoreModule, - OrderingModule, ] }) export class OrdersModule { } diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json index c1bbf183..1166f1a6 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json @@ -32,6 +32,10 @@ "DisplayName:PaymentMethod": "Payment Method", "DisplayName:Total": "Total", "Permission:Orders.SetAsCancelled": "Set As Cancelled", - "Permission:Orders.SetAsShipped": "Set As Shipped" + "Permission:Orders.SetAsShipped": "Set As Shipped", + "Enum:OrderStatus:0":"Placed", + "Enum:OrderStatus:1":"Paid", + "Enum:OrderStatus:2":"Shipped", + "Enum:OrderStatus:3":"Cancelled" } } \ No newline at end of file From 6c9fee5864ee1002fa58cc2ac61c57da5582acdb Mon Sep 17 00:00:00 2001 From: malik masis Date: Fri, 18 Mar 2022 19:18:40 +0300 Subject: [PATCH 22/32] Added missed words for Turkish language --- .../Localization/OrderingService/en.json | 8 +++--- .../Localization/OrderingService/tr.json | 27 ++++++++++++++++++- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json index 1166f1a6..f3484dd7 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json @@ -12,13 +12,13 @@ "Permission:OrderingService": "Ordering Service", "Menu:Orders": "Orders", "Menu:OrderManagement": "Order Management", + "ModalTitle":"Order Detail", "DisplayName:OrderNo": "Order No", "DisplayName:OrderDate": "Order Date", "DisplayName:OrderTotal": "Order Total", "DisplayName:OrderStatus": "Order Status", - "DisplayName:ProductId": "Product Id", "DisplayName:ProductName": "Product Name", "DisplayName:PictureUrl": "Picture", @@ -28,11 +28,13 @@ "DisplayName:TotalPrice": "Total Price", "DisplayName:BuyerName": "Buyer Name", "DisplayName:BuyerEmail": "Buyer E-mail", - "DisplayName:Address": "Address", - "DisplayName:PaymentMethod": "Payment Method", + "DisplayName:Address": "Address", + "DisplayName:PaymentMethod": "Payment Method", "DisplayName:Total": "Total", + "Permission:Orders.SetAsCancelled": "Set As Cancelled", "Permission:Orders.SetAsShipped": "Set As Shipped", + "Enum:OrderStatus:0":"Placed", "Enum:OrderStatus:1":"Paid", "Enum:OrderStatus:2":"Shipped", diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/tr.json b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/tr.json index b618ca81..59f1b966 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/tr.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/tr.json @@ -12,7 +12,32 @@ "Permission:OrderingService": "Sipariş Servisi", "Menu:Orders": "Siparişler", "Menu:OrderManagement": "Sipariş Yönetimi", + + "ModalTitle": "Sipariş Detayı", + + "DisplayName:OrderNo": "Sipariş Numarası", + "DisplayName:OrderDate": "Sipariş Tarihi", + "DisplayName:OrderTotal": "Sipariş Toplamı", + "DisplayName:OrderStatus": "Sipariş Durumu", + "DisplayName:ProductId": "Ürün Anahtarı", + "DisplayName:ProductName": "Ürün Adı", + "DisplayName:PictureUrl": "Resim", + "DisplayName:Units": "Adet", + "DisplayName:UnitPrice": "Adet Fiyatı", + "DisplayName:Discount": "İndirim", + "DisplayName:TotalPrice": "Toplam Fiyat", + "DisplayName:BuyerName": "Alan Kişi", + "DisplayName:BuyerEmail": "Alan Kişi Mail", + "DisplayName:Address": "Adres", + "DisplayName:PaymentMethod": "Ödeme Şekli", + "DisplayName:Total": "Toplam", + "Permission:Orders.SetAsCancelled": "İptal Edildi Olarak İşaretle", - "Permission:Orders.SetAsShipped": "Sevk Edildi Olarak İşaretle" + "Permission:Orders.SetAsShipped": "Sevk Edildi Olarak İşaretle", + + "Enum:OrderStatus:0": "Oluşturuldu", + "Enum:OrderStatus:1": "Ödendi", + "Enum:OrderStatus:2": "Sevk Edildi", + "Enum:OrderStatus:3": "İptal Edildi" } } \ No newline at end of file From 671608331879b25f63b3510ec6343001196c0713 Mon Sep 17 00:00:00 2001 From: malik masis Date: Tue, 22 Mar 2022 11:31:25 +0300 Subject: [PATCH 23/32] Completed some requests of the reviewer Still need to work on some of them --- .../Orders/IOrderAppService.cs | 2 +- .../Orders/SetAsCancelledDto.cs | 10 -------- .../Orders/OrderAppService.cs | 6 ++--- .../Orders/OrderCancelledEto.cs | 1 + .../Orders/IOrderRepository.cs | 2 +- .../Orders/Order.cs | 7 ++---- .../Orders/OrderManager.cs | 5 ++-- .../Orders/EfCoreOrderRepository.cs | 2 +- .../OrderClientProxy.Generated.cs | 5 ++-- .../ordering-generate-proxy.json | 24 ++----------------- .../appsettings.json | 2 +- .../OrderCancelledEventHandler.cs | 2 +- 12 files changed, 18 insertions(+), 50 deletions(-) delete mode 100644 services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/SetAsCancelledDto.cs diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/IOrderAppService.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/IOrderAppService.cs index 90dd07f2..169ab68a 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/IOrderAppService.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/IOrderAppService.cs @@ -13,7 +13,7 @@ public interface IOrderAppService : IApplicationService Task> GetMyOrdersAsync(GetMyOrdersInput input); Task> GetOrdersAsync(GetOrdersInput input); Task GetByOrderNoAsync(int orderNo); - Task SetAsCancelledAsync(Guid id, SetAsCancelledDto input); + Task SetAsCancelledAsync(Guid id); Task SetAsShippedAsync(Guid id); Task> GetListPagedAsync(PagedAndSortedResultRequestDto input); diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/SetAsCancelledDto.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/SetAsCancelledDto.cs deleted file mode 100644 index f0cd0783..00000000 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/SetAsCancelledDto.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; - -namespace EShopOnAbp.OrderingService.Orders -{ - public class SetAsCancelledDto - { - public Guid PaymentRequestId { get; set; } - public string PaymentRequestStatus { get; set; } - } -} \ No newline at end of file diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs index 516d7a5b..45fae33e 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs @@ -47,7 +47,7 @@ public class OrderAppService : ApplicationService, IOrderAppService public async Task> GetOrdersAsync(GetOrdersInput input) { ISpecification specification = SpecificationFactory.Create(input.Filter); - var orders = await _orderRepository.GetOrders(specification, true); + var orders = await _orderRepository.GetOrdersAsync(specification, true); return CreateOrderDtoMapping(orders); } @@ -78,9 +78,9 @@ public class OrderAppService : ApplicationService, IOrderAppService } [Authorize(OrderingServicePermissions.Orders.SetAsCancelled)] - public async Task SetAsCancelledAsync(Guid id, SetAsCancelledDto input) + public async Task SetAsCancelledAsync(Guid id) { - await _orderManager.CancelOrderAsync(id, input.PaymentRequestId, input.PaymentRequestStatus); + await _orderManager.CancelOrderAsync(id); } [Authorize(OrderingServicePermissions.Orders.SetAsShipped)] diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Orders/OrderCancelledEto.cs b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Orders/OrderCancelledEto.cs index 62e221fd..9eef325d 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Orders/OrderCancelledEto.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Orders/OrderCancelledEto.cs @@ -8,6 +8,7 @@ namespace EShopOnAbp.OrderingService.Orders; [EventName("EShopOnAbp.Order.Cancelled")] public class OrderCancelledEto : EtoBase { + public Guid PaymentRequestId { get; set; } public Guid OrderId { get; set; } public int OrderNo { get; set; } public DateTime OrderDate { get; set; } diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/IOrderRepository.cs b/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/IOrderRepository.cs index c031ea4f..71ea87dc 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/IOrderRepository.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/IOrderRepository.cs @@ -15,7 +15,7 @@ public interface IOrderRepository : IRepository bool includeDetails = true, CancellationToken cancellationToken = default); - Task> GetOrders( + Task> GetOrdersAsync( ISpecification spec, bool includeDetails = true, CancellationToken cancellationToken = default); diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/Order.cs b/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/Order.cs index f942af8c..7ce801c6 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/Order.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/Order.cs @@ -57,12 +57,9 @@ public class Order : AggregateRoot return this; } - public Order SetOrderCancelled(Guid paymentRequestId, string paymentRequestStatus) + public Order SetOrderCancelled() { - PaymentRequestId = paymentRequestId; - PaymentStatus = paymentRequestStatus; OrderStatus = OrderStatus.Cancelled; - return this; } @@ -97,7 +94,7 @@ public class Order : AggregateRoot public Order SetOrderAsShipped() { - if(OrderStatus == OrderStatus.Cancelled) + if (OrderStatus == OrderStatus.Cancelled) { return this; } diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/OrderManager.cs b/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/OrderManager.cs index 37da005a..5bcd0dd0 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/OrderManager.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/OrderManager.cs @@ -91,7 +91,7 @@ public class OrderManager : DomainService return await _orderRepository.UpdateAsync(order, autoSave: true); } - public async Task CancelOrderAsync(Guid orderId, Guid paymentRequestId, string paymentRequestStatus) + public async Task CancelOrderAsync(Guid orderId) { var order = await _orderRepository.GetAsync(orderId); if (order == null) @@ -100,11 +100,12 @@ public class OrderManager : DomainService .WithData("OrderId", orderId); } - order.SetOrderCancelled(paymentRequestId, paymentRequestStatus); + order.SetOrderCancelled(); // Publish order cancelled event await _distributedEventBus.PublishAsync(new OrderCancelledEto { + PaymentRequestId = order.PaymentRequestId.GetValueOrDefault(), OrderId = order.Id, OrderDate = order.OrderDate, OrderNo = order.OrderNo, diff --git a/services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/Orders/EfCoreOrderRepository.cs b/services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/Orders/EfCoreOrderRepository.cs index 9f6c1452..98349251 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/Orders/EfCoreOrderRepository.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/Orders/EfCoreOrderRepository.cs @@ -34,7 +34,7 @@ public class EfCoreOrderRepository : EfCoreRepository> GetOrders( + public async Task> GetOrdersAsync( ISpecification spec, bool includeDetails = false, CancellationToken cancellationToken = default) diff --git a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/OrderClientProxy.Generated.cs b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/OrderClientProxy.Generated.cs index f51841db..26616094 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/OrderClientProxy.Generated.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/OrderClientProxy.Generated.cs @@ -56,12 +56,11 @@ public partial class OrderClientProxy : ClientProxyBase, IOrde }); } - public virtual async Task SetAsCancelledAsync(Guid id, SetAsCancelledDto input) + public virtual async Task SetAsCancelledAsync(Guid id) { await RequestAsync(nameof(SetAsCancelledAsync), new ClientProxyRequestTypeValue { - { typeof(Guid), id }, - { typeof(SetAsCancelledDto), input } + { typeof(Guid), id } }); } diff --git a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/ordering-generate-proxy.json b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/ordering-generate-proxy.json index f437165f..37b59d11 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/ordering-generate-proxy.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Client/ClientProxies/ordering-generate-proxy.json @@ -232,8 +232,8 @@ "allowAnonymous": null, "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" }, - "SetAsCancelledAsyncByIdAndInput": { - "uniqueName": "SetAsCancelledAsyncByIdAndInput", + "SetAsCancelledAsyncById": { + "uniqueName": "SetAsCancelledAsyncById", "name": "SetAsCancelledAsync", "httpMethod": "POST", "url": "api/ordering/order/{id}/set-as-cancelled", @@ -246,14 +246,6 @@ "typeSimple": "string", "isOptional": false, "defaultValue": null - }, - { - "name": "input", - "typeAsString": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto, EShopOnAbp.OrderingService.Application.Contracts", - "type": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto", - "typeSimple": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto", - "isOptional": false, - "defaultValue": null } ], "parameters": [ @@ -268,18 +260,6 @@ "constraintTypes": [], "bindingSourceId": "Path", "descriptorName": "" - }, - { - "nameOnMethod": "input", - "name": "input", - "jsonName": null, - "type": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto", - "typeSimple": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto", - "isOptional": false, - "defaultValue": null, - "constraintTypes": null, - "bindingSourceId": "Body", - "descriptorName": "" } ], "returnValue": { diff --git a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Host/appsettings.json b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Host/appsettings.json index 817f4dce..9def8b83 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Host/appsettings.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Host/appsettings.json @@ -1,7 +1,7 @@ { "App": { "SelfUrl": "https://localhost:44356", - "CorsOrigins": "https://localhost:44372,https://localhost:44373,http://localhost:4200,https://localhost:4200" + "CorsOrigins": "https://localhost:44372,https://localhost:44373,https://localhost:4200" }, "AuthServer": { "Authority": "https://localhost:44330", diff --git a/services/payment/src/EShopOnAbp.PaymentService.Domain/EventHandlers/OrderCancelledEventHandler.cs b/services/payment/src/EShopOnAbp.PaymentService.Domain/EventHandlers/OrderCancelledEventHandler.cs index a4e3837c..8940dc74 100644 --- a/services/payment/src/EShopOnAbp.PaymentService.Domain/EventHandlers/OrderCancelledEventHandler.cs +++ b/services/payment/src/EShopOnAbp.PaymentService.Domain/EventHandlers/OrderCancelledEventHandler.cs @@ -19,7 +19,7 @@ namespace EShopOnAbp.PaymentService.EventHandlers public async Task HandleEventAsync(OrderCancelledEto eventData) { - var payment = await _paymentRepository.GetAsync(eventData.Buyer.BuyerId.GetValueOrDefault()); + var payment = await _paymentRepository.GetAsync(eventData.PaymentRequestId); Log.Information($"Cancelled the order: {payment.OrderId} payment:{payment.Id}"); } } From 3ee37335f0063909df0a81f323377d066934ef59 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Tue, 22 Mar 2022 11:05:30 +0300 Subject: [PATCH 24/32] remove unused Module --- .../ordering/config/src/order-config-routing.module.ts | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 apps/angular/projects/ordering/config/src/order-config-routing.module.ts diff --git a/apps/angular/projects/ordering/config/src/order-config-routing.module.ts b/apps/angular/projects/ordering/config/src/order-config-routing.module.ts deleted file mode 100644 index b82cfada..00000000 --- a/apps/angular/projects/ordering/config/src/order-config-routing.module.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -const routes: Routes = []; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule] -}) -export class OrderConfigRoutingModule { } From 749cad94185c9ac4cbca0c89b0f28b3062dd93c3 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Tue, 22 Mar 2022 11:23:41 +0300 Subject: [PATCH 25/32] add prettier to angular and format ordering classes --- apps/angular/package.json | 3 +- .../config/src/ordering-config.module.ts | 1 - .../config/src/providers/route.provider.ts | 4 +- .../projects/ordering/src/ordering.module.ts | 12 ++--- .../order-detail-item.component.ts | 11 ++--- .../order-detail/order-detail.component.ts | 6 +-- .../src/pages/orders/orders.component.ts | 48 +++++++++++-------- .../src/pages/orders/orders.module.ts | 17 ++----- 8 files changed, 47 insertions(+), 55 deletions(-) diff --git a/apps/angular/package.json b/apps/angular/package.json index 8643fb78..da420ecb 100644 --- a/apps/angular/package.json +++ b/apps/angular/package.json @@ -52,9 +52,10 @@ "karma-jasmine": "~4.0.0", "karma-jasmine-html-reporter": "^1.5.0", "ng-packagr": "^12.2.2", + "prettier": "^2.6.0", "protractor": "~7.0.0", "ts-node": "~8.3.0", "tslint": "~6.1.0", "typescript": "~4.3.5" } -} \ No newline at end of file +} diff --git a/apps/angular/projects/ordering/config/src/ordering-config.module.ts b/apps/angular/projects/ordering/config/src/ordering-config.module.ts index cfe437fe..53537295 100644 --- a/apps/angular/projects/ordering/config/src/ordering-config.module.ts +++ b/apps/angular/projects/ordering/config/src/ordering-config.module.ts @@ -1,7 +1,6 @@ import { ModuleWithProviders, NgModule } from '@angular/core'; import { ORDERING_ROUTE_PROVIDERS } from './providers/route.provider'; - @NgModule() export class OrderingConfigModule { static forRoot(): ModuleWithProviders { diff --git a/apps/angular/projects/ordering/config/src/providers/route.provider.ts b/apps/angular/projects/ordering/config/src/providers/route.provider.ts index 1e892f2d..be624bc5 100644 --- a/apps/angular/projects/ordering/config/src/providers/route.provider.ts +++ b/apps/angular/projects/ordering/config/src/providers/route.provider.ts @@ -1,7 +1,7 @@ import { eLayoutType, RoutesService } from '@abp/ng.core'; import { APP_INITIALIZER } from '@angular/core'; import { eOrderingPolicyNames } from '../enums/policy-names'; -import { eOrderingRouteNames} from '../enums/route-names'; +import { eOrderingRouteNames } from '../enums/route-names'; export const ORDERING_ROUTE_PROVIDERS = [ { provide: APP_INITIALIZER, useFactory: configureRoutes, deps: [RoutesService], multi: true }, @@ -14,7 +14,7 @@ export function configureRoutes(routesService: RoutesService) { path: '/ordering', name: eOrderingRouteNames.ordering, layout: eLayoutType.application, - requiredPolicy: eOrderingPolicyNames.ordering, + requiredPolicy: eOrderingPolicyNames.ordering, parentName: null, iconClass: 'bi bi-collection-fill', }, diff --git a/apps/angular/projects/ordering/src/ordering.module.ts b/apps/angular/projects/ordering/src/ordering.module.ts index 75e1eb8b..724b0dfb 100644 --- a/apps/angular/projects/ordering/src/ordering.module.ts +++ b/apps/angular/projects/ordering/src/ordering.module.ts @@ -2,12 +2,8 @@ import { NgModule } from '@angular/core'; import { OrderingRoutingModule } from './ordering-routing.module'; @NgModule({ - declarations: [ - ], - imports: [ - OrderingRoutingModule - ], - exports: [] + declarations: [], + imports: [OrderingRoutingModule], + exports: [], }) -export class OrderingModule { -} +export class OrderingModule {} diff --git a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail-item/order-detail-item.component.ts b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail-item/order-detail-item.component.ts index e6152131..22f931dd 100644 --- a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail-item/order-detail-item.component.ts +++ b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail-item/order-detail-item.component.ts @@ -3,19 +3,18 @@ import { Component, Input } from '@angular/core'; @Component({ selector: 'lib-order-detail-item', template: ` -
-
- {{label}} +
+
+ {{ label }}
- +
`, - styles: [] + styles: [], }) export class OrderDetailItemComponent { - @Input() label = ''; } diff --git a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.ts b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.ts index 0cda0a8f..a38ef123 100644 --- a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.ts +++ b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.ts @@ -4,10 +4,10 @@ import { environment } from '../../../../../../src/environments/environment'; @Component({ selector: 'lib-order-detail', - templateUrl: './order-detail.component.html' + templateUrl: './order-detail.component.html', }) -export class OrderDetailComponent { - modalOption = { size: 'xl' } +export class OrderDetailComponent { + modalOption = { size: 'xl' }; @Input() visible: boolean; @Input() diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.ts b/apps/angular/projects/ordering/src/pages/orders/orders.component.ts index b5fff269..9361ce13 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.component.ts +++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { OrderService } from '../../lib/proxy/orders'; +import { OrderService } from '../../lib/proxy/orders'; import { OrderViewModel, toOrderViewModel } from '../../lib'; import { Confirmation, ConfirmationService } from '@abp/ng.theme.shared'; import { ListService } from '@abp/ng.core'; @@ -12,9 +12,12 @@ import { eOrderingPolicyNames } from '@eshoponabp/ordering/config'; providers: [ListService], }) export class OrdersComponent implements OnInit { - constructor(private service: OrderService, - public list: ListService, - private confirmationService: ConfirmationService) { } + constructor( + private service: OrderService, + public list: ListService, + private confirmationService: ConfirmationService + ) {} + selectedOrder: OrderViewModel | undefined; isModalVisible = false; items: OrderViewModel[]; @@ -25,10 +28,8 @@ export class OrdersComponent implements OnInit { setAsCancelled: eOrderingPolicyNames.setAsCancelled, }; - ngOnInit(): void { - - console.log(this.permissions) + console.log(this.permissions); const ordersStreamCreator = query => this.service.getListPaged(query); this.list.hookToQuery(ordersStreamCreator).subscribe(response => { @@ -37,17 +38,16 @@ export class OrdersComponent implements OnInit { }); } - openModal(order: OrderViewModel) { - if (!order){ + if (!order) { return; } this.selectedOrder = order; this.isModalVisible = true; } - closeModal(isVisible: boolean){ - if (isVisible){ + closeModal(isVisible: boolean) { + if (isVisible) { return; } this.selectedOrder = null; @@ -57,7 +57,7 @@ export class OrdersComponent implements OnInit { setAsShipped(row: OrderViewModel) { this.confirmationService .warn('AbpOrdering::WillSetAsShipped', { key: '::AreYouSure', defaultValue: 'Are you sure?' }) - .subscribe((status) => { + .subscribe(status => { if (status !== Confirmation.Status.confirm) { return; } @@ -66,17 +66,25 @@ export class OrdersComponent implements OnInit { }); }); } - setAsCancelled(row: OrderViewModel){ + + setAsCancelled(row: OrderViewModel) { this.confirmationService - .warn('AbpOrdering::WillSetAsCancelled', { key: '::AreYouSure', defaultValue: 'Are you sure?' }) - .subscribe((status) => { + .warn('AbpOrdering::WillSetAsCancelled', { + key: '::AreYouSure', + defaultValue: 'Are you sure?', + }) + .subscribe(status => { if (status !== Confirmation.Status.confirm) { return; } - this.service.setAsCancelled(row.id, { paymentRequestId: undefined, paymentRequestStatus: undefined}).subscribe(() => { - this.list.get(); - }); - }) - ; + this.service + .setAsCancelled(row.id, { + paymentRequestId: undefined, + paymentRequestStatus: undefined, + }) + .subscribe(() => { + this.list.get(); + }); + }); } } diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.module.ts b/apps/angular/projects/ordering/src/pages/orders/orders.module.ts index ee7f4aac..38d8e79f 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.module.ts +++ b/apps/angular/projects/ordering/src/pages/orders/orders.module.ts @@ -9,19 +9,8 @@ import { OrderDetailComponent } from './order-detail/order-detail.component'; import { OrderDetailItemComponent } from './order-detail/order-detail-item/order-detail-item.component'; import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'; - @NgModule({ - declarations: [ - OrdersComponent, - OrderDetailComponent, - OrderDetailItemComponent - ], - imports: [ - CommonModule, - NgbDropdownModule, - OrdersRoutingModule, - ThemeSharedModule, - CoreModule, - ] + declarations: [OrdersComponent, OrderDetailComponent, OrderDetailItemComponent], + imports: [CommonModule, NgbDropdownModule, OrdersRoutingModule, ThemeSharedModule, CoreModule], }) -export class OrdersModule { } +export class OrdersModule {} From b0f06531d8f97898ef1c8bf43a3ffacd78d31f04 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Tue, 22 Mar 2022 11:25:58 +0300 Subject: [PATCH 26/32] remove abpLocalization from order-detail and add order-detail-item --- .../order-detail-item.component.ts | 2 +- .../order-detail/order-detail.component.html | 32 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail-item/order-detail-item.component.ts b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail-item/order-detail-item.component.ts index 22f931dd..e6044526 100644 --- a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail-item/order-detail-item.component.ts +++ b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail-item/order-detail-item.component.ts @@ -5,7 +5,7 @@ import { Component, Input } from '@angular/core'; template: `
- {{ label }} + {{ label | abpLocalization }}
diff --git a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html index 55a26904..0fe82696 100644 --- a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html +++ b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html @@ -1,18 +1,18 @@ -

{{"OrderingService::ModalTitle" | abpLocalization }}

+

{{"OrderingService::ModalTitle" }}

- #{{order.orderNo}} - {{order.orderStatus}} - {{order.buyer.name}} - {{order.buyer.email}} + #{{order.orderNo}} + {{order.orderStatus}} + {{order.buyer.name}} + {{order.buyer.email}} - + {{address.description}}
{{address.street}}
@@ -20,33 +20,33 @@ {{address.city}} / {{address.country}}
- {{order.paymentMethod}} - {{order.orderTotal | currency}} + {{order.paymentMethod}} + {{order.orderTotal | currency}}



- - + + - - + + {{value | currency }} - - + + {{value }} % - + {{(row.units * row.unitPrice) | currency }} @@ -60,7 +60,7 @@ From 67ce9abb158197e20e1bfa59c10345b46bd17351 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Tue, 22 Mar 2022 11:31:32 +0300 Subject: [PATCH 27/32] Format with prettier orders and order detail --- .../order-detail/order-detail.component.html | 96 +++++++++++-------- .../src/pages/orders/orders.component.html | 61 +++++++----- 2 files changed, 90 insertions(+), 67 deletions(-) diff --git a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html index 0fe82696..f3f8d19a 100644 --- a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html +++ b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html @@ -1,66 +1,78 @@ - + -

{{"OrderingService::ModalTitle" }}

+

{{ 'OrderingService::ModalTitle' }}

+
+
+ #{{ order.orderNo }} + {{ + order.orderStatus + }} + {{ + order.buyer.name + }} + {{ + order.buyer.email + }} -
-
- #{{order.orderNo}} - {{order.orderStatus}} - {{order.buyer.name}} - {{order.buyer.email}} - - - - {{address.description}}
- {{address.street}}
- {{address.zipCode}}
- {{address.city}} / {{address.country}}
-
+ + + {{ address.description }}
+ {{ address.street }}
+ {{ address.zipCode }}
+ {{ address.city }} / {{ address.country }}
+
- {{order.paymentMethod}} - {{order.orderTotal | currency}} + {{ + order.paymentMethod + }} + {{ + order.orderTotal | currency + }}
-


+


- + - - - - + + + + - - - - - {{value | currency }} + + + + {{ value | currency }} - - - - {{value }} % - + + + {{ value }} % - - {{(row.units * row.unitPrice) | currency }} + + {{ row.units * row.unitPrice | currency }} - -
- - + diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.html b/apps/angular/projects/ordering/src/pages/orders/orders.component.html index cc116521..d0c6963b 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.component.html +++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.html @@ -1,18 +1,15 @@ - -
{{ 'AbpOrdering::Orders' | abpLocalization }}
-
- +
+ class="dropdown-item" + *abpPermission="permissions.setAsCancelled" + (click)="setAsCancelled(row)" + > + {{ 'OrderingService::Permission:Orders.SetAsCancelled' | abpLocalization }} +
- - + + - {{ value | date }} + {{ value | date }} - + - {{ value | currency }} + {{ value | currency }} - + - {{ "OrderingService::Enum:OrderStatus:" + value | abpLocalization }} + {{ 'OrderingService::Enum:OrderStatus:' + value | abpLocalization }}
- - - - + + From 10c7d66431c6bc28f27861c3464d71ca9dd6614e Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Tue, 22 Mar 2022 11:33:48 +0300 Subject: [PATCH 28/32] remove console.log on orders.component --- .../projects/ordering/src/pages/orders/orders.component.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.ts b/apps/angular/projects/ordering/src/pages/orders/orders.component.ts index 9361ce13..09720e40 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.component.ts +++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.ts @@ -29,7 +29,6 @@ export class OrdersComponent implements OnInit { }; ngOnInit(): void { - console.log(this.permissions); const ordersStreamCreator = query => this.service.getListPaged(query); this.list.hookToQuery(ordersStreamCreator).subscribe(response => { From 0469d7a8d1028251dfbb8814cd7ec789c3ab48af Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Tue, 22 Mar 2022 11:34:38 +0300 Subject: [PATCH 29/32] remove comments in tsconfig.x.json --- apps/angular/projects/catalog/tsconfig.lib.json | 1 - apps/angular/projects/catalog/tsconfig.lib.prod.json | 1 - apps/angular/projects/ordering/tsconfig.lib.json | 1 - apps/angular/projects/ordering/tsconfig.lib.prod.json | 1 - 4 files changed, 4 deletions(-) diff --git a/apps/angular/projects/catalog/tsconfig.lib.json b/apps/angular/projects/catalog/tsconfig.lib.json index 1407202d..25910deb 100644 --- a/apps/angular/projects/catalog/tsconfig.lib.json +++ b/apps/angular/projects/catalog/tsconfig.lib.json @@ -1,4 +1,3 @@ -/* To learn more about this file see: https://angular.io/config/tsconfig. */ { "extends": "../../tsconfig.json", "compilerOptions": { diff --git a/apps/angular/projects/catalog/tsconfig.lib.prod.json b/apps/angular/projects/catalog/tsconfig.lib.prod.json index 06de549e..2a2faa88 100644 --- a/apps/angular/projects/catalog/tsconfig.lib.prod.json +++ b/apps/angular/projects/catalog/tsconfig.lib.prod.json @@ -1,4 +1,3 @@ -/* To learn more about this file see: https://angular.io/config/tsconfig. */ { "extends": "./tsconfig.lib.json", "compilerOptions": { diff --git a/apps/angular/projects/ordering/tsconfig.lib.json b/apps/angular/projects/ordering/tsconfig.lib.json index 1407202d..25910deb 100644 --- a/apps/angular/projects/ordering/tsconfig.lib.json +++ b/apps/angular/projects/ordering/tsconfig.lib.json @@ -1,4 +1,3 @@ -/* To learn more about this file see: https://angular.io/config/tsconfig. */ { "extends": "../../tsconfig.json", "compilerOptions": { diff --git a/apps/angular/projects/ordering/tsconfig.lib.prod.json b/apps/angular/projects/ordering/tsconfig.lib.prod.json index 06de549e..2a2faa88 100644 --- a/apps/angular/projects/ordering/tsconfig.lib.prod.json +++ b/apps/angular/projects/ordering/tsconfig.lib.prod.json @@ -1,4 +1,3 @@ -/* To learn more about this file see: https://angular.io/config/tsconfig. */ { "extends": "./tsconfig.lib.json", "compilerOptions": { From 9601940f56714e2defc5cd925524a8561fa99cba Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Tue, 22 Mar 2022 11:35:54 +0300 Subject: [PATCH 30/32] format env and remove css in orders.component.ts --- .../projects/ordering/src/pages/orders/orders.component.css | 0 .../projects/ordering/src/pages/orders/orders.component.ts | 1 - apps/angular/src/environments/my-environment.ts | 2 +- 3 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 apps/angular/projects/ordering/src/pages/orders/orders.component.css diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.css b/apps/angular/projects/ordering/src/pages/orders/orders.component.css deleted file mode 100644 index e69de29b..00000000 diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.ts b/apps/angular/projects/ordering/src/pages/orders/orders.component.ts index 09720e40..71bd8c70 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.component.ts +++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.ts @@ -8,7 +8,6 @@ import { eOrderingPolicyNames } from '@eshoponabp/ordering/config'; @Component({ selector: 'lib-orders', templateUrl: './orders.component.html', - styleUrls: ['./orders.component.css'], providers: [ListService], }) export class OrdersComponent implements OnInit { diff --git a/apps/angular/src/environments/my-environment.ts b/apps/angular/src/environments/my-environment.ts index 5bae69f1..f240e510 100644 --- a/apps/angular/src/environments/my-environment.ts +++ b/apps/angular/src/environments/my-environment.ts @@ -1,5 +1,5 @@ import { Environment } from '@abp/ng.core'; -export interface MyEnvironment extends Environment{ +export interface MyEnvironment extends Environment { mediaServerUrl?: string; } From 57beb49f846ea020e4aaa54848afefc3a9253a4c Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Tue, 22 Mar 2022 11:41:59 +0300 Subject: [PATCH 31/32] update proxy of orderService --- .../src/lib/proxy/generate-proxy.json | 203 +++++++----------- .../ordering/src/lib/proxy/orders/models.ts | 5 - .../src/lib/proxy/orders/order.service.ts | 5 +- .../src/pages/orders/orders.component.ts | 11 +- 4 files changed, 85 insertions(+), 139 deletions(-) diff --git a/apps/angular/projects/ordering/src/lib/proxy/generate-proxy.json b/apps/angular/projects/ordering/src/lib/proxy/generate-proxy.json index 9c464296..626d4922 100644 --- a/apps/angular/projects/ordering/src/lib/proxy/generate-proxy.json +++ b/apps/angular/projects/ordering/src/lib/proxy/generate-proxy.json @@ -3,84 +3,6 @@ "ordering" ], "modules": { - "abp": { - "rootPath": "abp", - "remoteServiceName": "abp", - "controllers": { - "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController": { - "controllerName": "AbpApplicationConfiguration", - "controllerGroupName": "AbpApplicationConfiguration", - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController", - "interfaces": [ - { - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IAbpApplicationConfigurationAppService" - } - ], - "actions": { - "GetAsync": { - "uniqueName": "GetAsync", - "name": "GetAsync", - "httpMethod": "GET", - "url": "api/abp/application-configuration", - "supportedVersions": [], - "parametersOnMethod": [], - "parameters": [], - "returnValue": { - "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto", - "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto" - }, - "allowAnonymous": null, - "implementFrom": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IAbpApplicationConfigurationAppService" - } - } - }, - "Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController": { - "controllerName": "AbpApiDefinition", - "controllerGroupName": "AbpApiDefinition", - "type": "Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController", - "interfaces": [], - "actions": { - "GetByModel": { - "uniqueName": "GetByModel", - "name": "Get", - "httpMethod": "GET", - "url": "api/abp/api-definition", - "supportedVersions": [], - "parametersOnMethod": [ - { - "name": "model", - "typeAsString": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModelRequestDto, Volo.Abp.Http", - "type": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModelRequestDto", - "typeSimple": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModelRequestDto", - "isOptional": false, - "defaultValue": null - } - ], - "parameters": [ - { - "nameOnMethod": "model", - "name": "IncludeTypes", - "jsonName": null, - "type": "System.Boolean", - "typeSimple": "boolean", - "isOptional": false, - "defaultValue": null, - "constraintTypes": null, - "bindingSourceId": "ModelBinding", - "descriptorName": "model" - } - ], - "returnValue": { - "type": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel", - "typeSimple": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel" - }, - "allowAnonymous": null, - "implementFrom": "Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController" - } - } - } - } - }, "ordering": { "rootPath": "ordering", "remoteServiceName": "Ordering", @@ -313,8 +235,8 @@ "allowAnonymous": null, "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" }, - "SetAsCancelledAsyncByIdAndInput": { - "uniqueName": "SetAsCancelledAsyncByIdAndInput", + "SetAsCancelledAsyncById": { + "uniqueName": "SetAsCancelledAsyncById", "name": "SetAsCancelledAsync", "httpMethod": "POST", "url": "api/ordering/order/{id}/set-as-cancelled", @@ -327,14 +249,6 @@ "typeSimple": "string", "isOptional": false, "defaultValue": null - }, - { - "name": "input", - "typeAsString": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto, EShopOnAbp.OrderingService.Application.Contracts", - "type": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto", - "typeSimple": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto", - "isOptional": false, - "defaultValue": null } ], "parameters": [ @@ -349,18 +263,6 @@ "constraintTypes": [], "bindingSourceId": "Path", "descriptorName": "" - }, - { - "nameOnMethod": "input", - "name": "input", - "jsonName": null, - "type": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto", - "typeSimple": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto", - "isOptional": false, - "defaultValue": null, - "constraintTypes": null, - "bindingSourceId": "Body", - "descriptorName": "" } ], "returnValue": { @@ -447,6 +349,84 @@ } } } + }, + "abp": { + "rootPath": "abp", + "remoteServiceName": "abp", + "controllers": { + "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController": { + "controllerName": "AbpApplicationConfiguration", + "controllerGroupName": "AbpApplicationConfiguration", + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController", + "interfaces": [ + { + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IAbpApplicationConfigurationAppService" + } + ], + "actions": { + "GetAsync": { + "uniqueName": "GetAsync", + "name": "GetAsync", + "httpMethod": "GET", + "url": "api/abp/application-configuration", + "supportedVersions": [], + "parametersOnMethod": [], + "parameters": [], + "returnValue": { + "type": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto", + "typeSimple": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IAbpApplicationConfigurationAppService" + } + } + }, + "Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController": { + "controllerName": "AbpApiDefinition", + "controllerGroupName": "AbpApiDefinition", + "type": "Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController", + "interfaces": [], + "actions": { + "GetByModel": { + "uniqueName": "GetByModel", + "name": "Get", + "httpMethod": "GET", + "url": "api/abp/api-definition", + "supportedVersions": [], + "parametersOnMethod": [ + { + "name": "model", + "typeAsString": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModelRequestDto, Volo.Abp.Http", + "type": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModelRequestDto", + "typeSimple": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModelRequestDto", + "isOptional": false, + "defaultValue": null + } + ], + "parameters": [ + { + "nameOnMethod": "model", + "name": "IncludeTypes", + "jsonName": null, + "type": "System.Boolean", + "typeSimple": "boolean", + "isOptional": false, + "defaultValue": null, + "constraintTypes": null, + "bindingSourceId": "ModelBinding", + "descriptorName": "model" + } + ], + "returnValue": { + "type": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel", + "typeSimple": "Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel" + }, + "allowAnonymous": null, + "implementFrom": "Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController" + } + } + } + } } }, "types": { @@ -2305,29 +2285,6 @@ } ] }, - "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto": { - "baseType": null, - "isEnum": false, - "enumNames": null, - "enumValues": null, - "genericArguments": null, - "properties": [ - { - "name": "PaymentRequestId", - "jsonName": null, - "type": "System.Guid", - "typeSimple": "string", - "isRequired": false - }, - { - "name": "PaymentRequestStatus", - "jsonName": null, - "type": "System.String", - "typeSimple": "string", - "isRequired": false - } - ] - }, "EShopOnAbp.OrderingService.Orders.OrderCreateDto": { "baseType": null, "isEnum": false, diff --git a/apps/angular/projects/ordering/src/lib/proxy/orders/models.ts b/apps/angular/projects/ordering/src/lib/proxy/orders/models.ts index 31c23a05..8abaecce 100644 --- a/apps/angular/projects/ordering/src/lib/proxy/orders/models.ts +++ b/apps/angular/projects/ordering/src/lib/proxy/orders/models.ts @@ -56,8 +56,3 @@ export interface OrderItemDto extends EntityDto { discount: number; units: number; } - -export interface SetAsCancelledDto { - paymentRequestId?: string; - paymentRequestStatus?: string; -} diff --git a/apps/angular/projects/ordering/src/lib/proxy/orders/order.service.ts b/apps/angular/projects/ordering/src/lib/proxy/orders/order.service.ts index 6b4e5b94..efe0ba2a 100644 --- a/apps/angular/projects/ordering/src/lib/proxy/orders/order.service.ts +++ b/apps/angular/projects/ordering/src/lib/proxy/orders/order.service.ts @@ -1,4 +1,4 @@ -import type { GetMyOrdersInput, GetOrdersInput, OrderCreateDto, OrderDto, SetAsCancelledDto } from './models'; +import type { GetMyOrdersInput, GetOrdersInput, OrderCreateDto, OrderDto } from './models'; import { RestService } from '@abp/ng.core'; import type { PagedAndSortedResultRequestDto, PagedResultDto } from '@abp/ng.core'; import { Injectable } from '@angular/core'; @@ -56,11 +56,10 @@ export class OrderService { }, { apiName: this.apiName }); - setAsCancelled = (id: string, input: SetAsCancelledDto) => + setAsCancelled = (id: string) => this.restService.request({ method: 'POST', url: `/api/ordering/order/${id}/set-as-cancelled`, - body: input, }, { apiName: this.apiName }); diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.ts b/apps/angular/projects/ordering/src/pages/orders/orders.component.ts index 71bd8c70..680e10a4 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.component.ts +++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.ts @@ -75,14 +75,9 @@ export class OrdersComponent implements OnInit { if (status !== Confirmation.Status.confirm) { return; } - this.service - .setAsCancelled(row.id, { - paymentRequestId: undefined, - paymentRequestStatus: undefined, - }) - .subscribe(() => { - this.list.get(); - }); + this.service.setAsCancelled(row.id).subscribe(() => { + this.list.get(); + }); }); } } From 4286e5b6bd43885b5734dd52cdf8b0d32f88db7d Mon Sep 17 00:00:00 2001 From: malik masis Date: Tue, 22 Mar 2022 12:07:32 +0300 Subject: [PATCH 32/32] Fixed the permission issue It's ready for PR --- .../Orders/OrderAppService.cs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs index 45fae33e..3e134693 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs @@ -5,8 +5,6 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; -using System.Linq; -using System.Linq.Dynamic.Core; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; @@ -15,6 +13,7 @@ using Volo.Abp.Users; namespace EShopOnAbp.OrderingService.Orders; +[Authorize(OrderingServicePermissions.Orders.Default)] public class OrderAppService : ApplicationService, IOrderAppService { private readonly OrderManager _orderManager; @@ -36,6 +35,7 @@ public class OrderAppService : ApplicationService, IOrderAppService return CreateOrderDtoMapping(order); } + [AllowAnonymous] public async Task> GetMyOrdersAsync(GetMyOrdersInput input) { ISpecification specification = SpecificationFactory.Create(input.Filter); @@ -43,7 +43,6 @@ public class OrderAppService : ApplicationService, IOrderAppService return CreateOrderDtoMapping(orders); } - [Authorize(OrderingServicePermissions.Orders.Default)] public async Task> GetOrdersAsync(GetOrdersInput input) { ISpecification specification = SpecificationFactory.Create(input.Filter); @@ -51,17 +50,9 @@ public class OrderAppService : ApplicationService, IOrderAppService return CreateOrderDtoMapping(orders); } - [Authorize(OrderingServicePermissions.Orders.Default)] public async Task> GetListPagedAsync(PagedAndSortedResultRequestDto input) { - var queryable = await _orderRepository.WithDetailsAsync(); - - var orders = await AsyncExecuter.ToListAsync( - queryable - .OrderBy(input.Sorting ?? "OrderDate") - .Skip(input.SkipCount) - .Take(input.MaxResultCount) - ); + var orders = await _orderRepository.GetPagedListAsync(input.SkipCount, input.MaxResultCount, input.Sorting ?? "OrderDate", true); var totalCount = await _orderRepository.GetCountAsync(); return new PagedResultDto( @@ -70,6 +61,7 @@ public class OrderAppService : ApplicationService, IOrderAppService ); } + [AllowAnonymous] public async Task GetByOrderNoAsync(int orderNo) { var order = await _orderRepository.GetByOrderNoAsync(orderNo); @@ -92,6 +84,7 @@ public class OrderAppService : ApplicationService, IOrderAppService await _orderRepository.UpdateAsync(order); } + [AllowAnonymous] public async Task CreateAsync(OrderCreateDto input) { var orderItems = GetProductListTuple(input.Products); @@ -113,6 +106,7 @@ public class OrderAppService : ApplicationService, IOrderAppService return CreateOrderDtoMapping(placedOrder); } + private List<(Guid productId, string productName, string productCode, decimal unitPrice, decimal discount, string pictureUrl, int units )> GetProductListTuple(List products)