committed by
GitHub
60 changed files with 2181 additions and 267 deletions
@ -0,0 +1,10 @@ |
|||
using System; |
|||
using Volo.Abp.Application.Dtos; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Orders; |
|||
|
|||
public class BuyerDto : EntityDto<Guid> |
|||
{ |
|||
public string Name { get; set; } |
|||
public string Email { get; set; } |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Orders; |
|||
|
|||
public interface IOrderAppService : IApplicationService |
|||
{ |
|||
Task<OrderDto> CreateAsync(OrderCreateDto input); |
|||
Task<OrderDto> GetAsync(Guid id); |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Orders; |
|||
|
|||
public class OrderAddressDto |
|||
{ |
|||
public string Description { get; set; } |
|||
[Required]public string Street { get; set; } |
|||
[Required]public string City { get; set; } |
|||
[Required]public string Country { get; set; } |
|||
[Required]public string ZipCode { get; set; } |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
using System.Collections.Generic; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Orders; |
|||
|
|||
public class OrderCreateDto |
|||
{ |
|||
public int PaymentTypeId { get; set; } |
|||
public OrderAddressDto Address { get; set; } = new(); |
|||
public List<OrderItemCreateDto> Products { get; set; } = new(); |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Volo.Abp.Application.Dtos; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Orders; |
|||
|
|||
public class OrderDto : EntityDto<Guid> |
|||
{ |
|||
public DateTime OrderDate { get; set; } |
|||
public int OrderStatusId { get; set; } |
|||
public string OrderStatus { get; set; } |
|||
public int PaymentTypeId { get; set; } |
|||
public string PaymentType { get; set; } |
|||
public BuyerDto Buyer { get; set; } |
|||
public OrderAddressDto Address { get; set; } = new(); |
|||
public List<OrderItemDto> Items { get; set; } = new(); |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using System; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Orders; |
|||
|
|||
public class OrderItemCreateDto |
|||
{ |
|||
public Guid ProductId { get; set; } |
|||
public string ProductCode { get; set; } |
|||
public string ProductName { get; set; } |
|||
public string PictureUrl { get; set; } |
|||
public decimal UnitPrice { get; set; } |
|||
public decimal Discount { get; set; } |
|||
public int Units { get; set; } |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using System; |
|||
using Volo.Abp.Application.Dtos; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Orders; |
|||
|
|||
public class OrderItemDto : EntityDto<Guid> |
|||
{ |
|||
public Guid ProductId { get; set; } |
|||
public string ProductName { get; set; } |
|||
public string PictureUrl { get; set; } |
|||
public decimal UnitPrice { get; set; } |
|||
public decimal Discount { get; set; } |
|||
public int Units { get; set; } |
|||
} |
|||
@ -1,14 +0,0 @@ |
|||
using EShopOnAbp.OrderingService.Localization; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace EShopOnAbp.OrderingService |
|||
{ |
|||
public abstract class OrderingServiceAppService : ApplicationService |
|||
{ |
|||
protected OrderingServiceAppService() |
|||
{ |
|||
LocalizationResource = typeof(OrderingServiceResource); |
|||
ObjectMapperContext = typeof(OrderingServiceApplicationModule); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,85 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using EShopOnAbp.OrderingService.Buyers; |
|||
using EShopOnAbp.OrderingService.Localization; |
|||
using Volo.Abp.Application.Services; |
|||
using Volo.Abp.Users; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Orders; |
|||
|
|||
public class OrderAppService : ApplicationService, IOrderAppService |
|||
{ |
|||
private readonly OrderManager _orderManager; |
|||
private readonly IOrderRepository _orderRepository; |
|||
|
|||
public OrderAppService(OrderManager orderManager, |
|||
IOrderRepository orderRepository |
|||
) |
|||
{ |
|||
_orderManager = orderManager; |
|||
_orderRepository = orderRepository; |
|||
LocalizationResource = typeof(OrderingServiceResource); |
|||
ObjectMapperContext = typeof(OrderingServiceApplicationModule); |
|||
} |
|||
|
|||
public async Task<OrderDto> GetAsync(Guid id) |
|||
{ |
|||
var order = await _orderRepository.GetAsync(id); |
|||
return await CreateOrderDtoMappingAsync(order); |
|||
} |
|||
|
|||
public async Task<OrderDto> CreateAsync(OrderCreateDto input) |
|||
{ |
|||
var orderItems = GetProductListTuple(input.Products); |
|||
|
|||
var placedOrder = await _orderManager.CreateOrderAsync |
|||
( |
|||
paymentTypeId: input.PaymentTypeId, |
|||
buyerId: CurrentUser.GetId(), |
|||
buyerName: CurrentUser.Name, |
|||
buyerEmail: CurrentUser.Email, |
|||
orderItems: orderItems, |
|||
addressStreet: input.Address.Street, |
|||
addressCity: input.Address.City, |
|||
addressCountry: input.Address.Country, |
|||
addressZipCode: input.Address.ZipCode, |
|||
addressDescription: input.Address.Description |
|||
); |
|||
|
|||
return await CreateOrderDtoMappingAsync(placedOrder); |
|||
} |
|||
|
|||
private List<(Guid productId, string productName, string productCode, decimal unitPrice, decimal discount, string |
|||
pictureUrl, int units |
|||
)> GetProductListTuple(List<OrderItemCreateDto> products) |
|||
{ |
|||
var orderItems = |
|||
new List<(Guid productId, string productName, string productCode, decimal unitPrice, decimal discount, |
|||
string pictureUrl, int |
|||
units)>(); |
|||
foreach (var product in products) |
|||
{ |
|||
orderItems.Add((product.ProductId, product.ProductName, product.ProductCode, product.UnitPrice, |
|||
product.Discount, product.PictureUrl, product.Units)); |
|||
} |
|||
|
|||
return orderItems; |
|||
} |
|||
|
|||
private async Task<OrderDto> CreateOrderDtoMappingAsync(Order placedOrder) |
|||
{ |
|||
return new OrderDto() |
|||
{ |
|||
Address = ObjectMapper.Map<Address, OrderAddressDto>(placedOrder.Address), |
|||
Items = ObjectMapper.Map<List<OrderItem>, List<OrderItemDto>>(placedOrder.OrderItems), |
|||
Buyer = ObjectMapper.Map<Buyer, BuyerDto>(placedOrder.Buyer), |
|||
Id = placedOrder.Id, |
|||
OrderDate = placedOrder.OrderDate, |
|||
OrderStatus = placedOrder.OrderStatus.Name, |
|||
OrderStatusId = placedOrder.OrderStatus.Id, |
|||
PaymentType = placedOrder.PaymentType.Name, |
|||
PaymentTypeId = placedOrder.PaymentType.Id |
|||
}; |
|||
} |
|||
} |
|||
@ -1,11 +1,12 @@ |
|||
namespace EShopOnAbp.OrderingService |
|||
namespace EShopOnAbp.OrderingService; |
|||
|
|||
public static class OrderingServiceErrorCodes |
|||
{ |
|||
public static class OrderingServiceErrorCodes |
|||
{ |
|||
public const string OrderingStatusNotFound = "Ordering:00001"; |
|||
public const string InvalidUnits = "Ordering:00002"; |
|||
public const string InvalidDiscount = "Ordering:00003"; |
|||
public const string InvalidTotalForDiscount = "Ordering:00004"; |
|||
|
|||
} |
|||
} |
|||
public const string OrderingStatusNotFound = "Ordering:00001"; |
|||
public const string PaymentTypeNotFound = "Ordering:00011"; |
|||
public const string InvalidUnits = "Ordering:00002"; |
|||
public const string InvalidDiscount = "Ordering:00003"; |
|||
public const string InvalidTotalForDiscount = "Ordering:00004"; |
|||
public const string OrderIdIdNotGuid = "Ordering:01000"; |
|||
public const string OrderWithIdNotFound = "Ordering:01001"; |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using System; |
|||
using Volo.Abp.Domain.Entities.Events.Distributed; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Orders; |
|||
|
|||
public class BuyerEto : EtoBase |
|||
{ |
|||
public Guid? BuyerId { get; set; } |
|||
public string BuyerEmail { get; set; } |
|||
public string BuyerName { get; set; } |
|||
} |
|||
@ -1,15 +1,16 @@ |
|||
using System; |
|||
using Volo.Abp.Domain.Entities.Events.Distributed; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Orders |
|||
{ |
|||
public class OrderItemEto |
|||
public class OrderItemEto : EtoBase |
|||
{ |
|||
public Guid ProductId { get; set; } |
|||
|
|||
public string ProductCode { get; set; } |
|||
public string ProductName { get; set; } |
|||
public string PictureUrl { get; set; } |
|||
public decimal UnitPrice { get; set; } |
|||
public decimal Discount { get; set; } |
|||
public int Units { get; set; } |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Volo.Abp.Domain.Entities.Events.Distributed; |
|||
using Volo.Abp.EventBus; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Orders; |
|||
|
|||
[EventName("EShopOnAbp.Order.Placed")] |
|||
public class OrderPlacedEto : EtoBase |
|||
{ |
|||
public Guid OrderId { get; set; } |
|||
public DateTime OrderDate { get; set; } |
|||
public BuyerEto Buyer { get; set; } |
|||
public List<OrderItemEto> Items { get; set; } = new(); |
|||
} |
|||
@ -1,24 +0,0 @@ |
|||
using System; |
|||
using JetBrains.Annotations; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Buyers; |
|||
|
|||
public class Buyer : AggregateRoot<Guid> |
|||
{ |
|||
public string UserName { get; private set; } |
|||
public string Name { get; private set; } |
|||
public string PaymentId { get; private set; } |
|||
|
|||
private Buyer() |
|||
{ |
|||
} |
|||
|
|||
public Buyer(Guid id, [NotNull] string userName, [NotNull] string name, [NotNull] string paymentId) : base(id) |
|||
{ |
|||
UserName = Check.NotNullOrEmpty(userName, nameof(userName)); |
|||
Name = Check.NotNullOrEmpty(name, nameof(name)); |
|||
PaymentId = Check.NotNullOrEmpty(paymentId, nameof(paymentId)); |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Domain.Values; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Orders; |
|||
|
|||
public class Buyer: ValueObject |
|||
{ |
|||
public Guid? Id { get; private set; } |
|||
public string Name { get; private set; } |
|||
public string Email { get; private set; } |
|||
|
|||
private Buyer() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public Buyer(string email, string name, Guid? id) |
|||
{ |
|||
Name = Check.NotNullOrEmpty(name, nameof(name)); |
|||
Email = Check.NotNullOrEmpty(email, nameof(email)); |
|||
Id = id; |
|||
} |
|||
protected override IEnumerable<object> GetAtomicValues() |
|||
{ |
|||
yield return Id; |
|||
yield return Name; |
|||
yield return Email; |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
using System; |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Orders; |
|||
|
|||
public interface IOrderRepository : IRepository<Order, Guid> |
|||
{ |
|||
} |
|||
@ -0,0 +1,123 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using EShopOnAbp.OrderingService.Buyers; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Domain.Services; |
|||
using Volo.Abp.EventBus.Distributed; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Orders; |
|||
|
|||
public class OrderManager : DomainService |
|||
{ |
|||
private readonly IOrderRepository _orderRepository; |
|||
private readonly IDistributedEventBus _distributedEventBus; |
|||
|
|||
public OrderManager( |
|||
IOrderRepository orderRepository, |
|||
IDistributedEventBus distributedEventBus) |
|||
{ |
|||
_orderRepository = orderRepository; |
|||
_distributedEventBus = distributedEventBus; |
|||
} |
|||
|
|||
public async Task<Order> CreateOrderAsync( |
|||
int paymentTypeId, |
|||
Guid buyerId, |
|||
string buyerName, |
|||
string buyerEmail, |
|||
List<(Guid productId, string productName, string productCode, decimal unitPrice, decimal discount, string |
|||
pictureUrl, int units)> |
|||
orderItems, |
|||
string addressStreet, |
|||
string addressCity, |
|||
string addressCountry, |
|||
string addressZipCode, |
|||
string addressDescription = null |
|||
) |
|||
{ |
|||
// Create new order
|
|||
Order order = new Order( |
|||
id: GuidGenerator.Create(), |
|||
buyer: new Buyer(buyerEmail, buyerName, buyerId), |
|||
address: new Address(street: addressStreet, |
|||
city: addressCity, |
|||
country: addressCountry, |
|||
zipcode: addressZipCode, |
|||
description: addressDescription), |
|||
paymentType: PaymentType.From(paymentTypeId) |
|||
); |
|||
|
|||
// Add new order items
|
|||
foreach (var orderItem in orderItems) |
|||
{ |
|||
order.AddOrderItem( |
|||
id: GuidGenerator.Create(), |
|||
productId: orderItem.productId, |
|||
productName: orderItem.productName, |
|||
productCode: orderItem.productCode, |
|||
unitPrice: orderItem.unitPrice, |
|||
discount: orderItem.discount, |
|||
pictureUrl: orderItem.pictureUrl, |
|||
units: orderItem.units |
|||
); |
|||
} |
|||
|
|||
var placedOrder = await _orderRepository.InsertAsync(order, true); |
|||
|
|||
|
|||
// Publish Order placed event
|
|||
await _distributedEventBus.PublishAsync(new OrderPlacedEto |
|||
{ |
|||
OrderId = placedOrder.Id, |
|||
OrderDate = placedOrder.OrderDate, |
|||
Buyer = GetBuyerEto(order.Buyer), |
|||
Items = GetProductItemEtoList(order.OrderItems) |
|||
}); |
|||
|
|||
return placedOrder; |
|||
} |
|||
|
|||
public async Task<Order> AcceptOrderAsync(Guid orderId, Guid paymentRequestId, string paymentRequestStatus) |
|||
{ |
|||
var order = await _orderRepository.GetAsync(orderId); |
|||
if (order == null) |
|||
{ |
|||
throw new BusinessException(OrderingServiceErrorCodes.OrderWithIdNotFound) |
|||
.WithData("OrderId", orderId); |
|||
} |
|||
|
|||
order.SetOrderAccepted(paymentRequestId, paymentRequestStatus); |
|||
return await _orderRepository.UpdateAsync(order, autoSave: true); |
|||
} |
|||
|
|||
private BuyerEto GetBuyerEto(Buyer buyer) |
|||
{ |
|||
return new BuyerEto |
|||
{ |
|||
BuyerEmail = buyer.Email, |
|||
BuyerName = buyer.Name, |
|||
BuyerId = buyer.Id |
|||
}; |
|||
} |
|||
|
|||
private List<OrderItemEto> GetProductItemEtoList(List<OrderItem> orderItems) |
|||
{ |
|||
List<OrderItemEto> etoList = new List<OrderItemEto>(); |
|||
foreach (var oItem in orderItems) |
|||
{ |
|||
etoList.Add(new OrderItemEto() |
|||
{ |
|||
Discount = oItem.Discount, |
|||
PictureUrl = oItem.PictureUrl, |
|||
ProductCode = oItem.ProductCode, |
|||
ProductId = oItem.ProductId, |
|||
ProductName = oItem.ProductName, |
|||
UnitPrice = oItem.UnitPrice, |
|||
Units = oItem.Units |
|||
}); |
|||
} |
|||
|
|||
return etoList; |
|||
} |
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using Volo.Abp; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Buyers; |
|||
|
|||
public class PaymentType : Enumeration |
|||
{ |
|||
public static PaymentType Paypal = new PaymentType(1, nameof(Paypal).ToLowerInvariant()); |
|||
public static PaymentType Demo = new PaymentType(2, nameof(Paypal).ToLowerInvariant()); |
|||
|
|||
public PaymentType(int id, string name) : base(id, name) |
|||
{ |
|||
} |
|||
|
|||
public static IEnumerable<PaymentType> List() => |
|||
new[] {Paypal, Demo}; |
|||
|
|||
public static PaymentType FromName(string name) |
|||
{ |
|||
var state = List() |
|||
.SingleOrDefault(s => String.Equals(s.Name, name, StringComparison.CurrentCultureIgnoreCase)); |
|||
|
|||
if (state == null) |
|||
{ |
|||
throw new BusinessException(OrderingServiceErrorCodes.PaymentTypeNotFound) |
|||
.WithData("PaymentType", String.Join(",", List().Select(s => s.Name))); |
|||
} |
|||
|
|||
return state; |
|||
} |
|||
|
|||
public static PaymentType From(int id) |
|||
{ |
|||
var state = List().SingleOrDefault(s => s.Id == id); |
|||
|
|||
if (state == null) |
|||
{ |
|||
throw new BusinessException(OrderingServiceErrorCodes.PaymentTypeNotFound) |
|||
.WithData("PaymentType", String.Join(",", List().Select(s => s.Name))); |
|||
} |
|||
|
|||
return state; |
|||
} |
|||
} |
|||
@ -0,0 +1,240 @@ |
|||
// <auto-generated />
|
|||
using System; |
|||
using EShopOnAbp.OrderingService.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace EShopOnAbp.OrderingService.Migrations |
|||
{ |
|||
[DbContext(typeof(OrderingServiceDbContext))] |
|||
[Migration("20211231094501_Updated-Order-and-Buyer")] |
|||
partial class UpdatedOrderandBuyer |
|||
{ |
|||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.PostgreSql) |
|||
.HasAnnotation("ProductVersion", "6.0.0") |
|||
.HasAnnotation("Relational:MaxIdentifierLength", 63); |
|||
|
|||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Buyers.Buyer", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("character varying(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<string>("Email") |
|||
.IsRequired() |
|||
.HasColumnType("text"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("text") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasColumnType("text"); |
|||
|
|||
b.Property<int>("_paymentTypeId") |
|||
.HasColumnType("integer") |
|||
.HasColumnName("PaymentTypeId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("_paymentTypeId"); |
|||
|
|||
b.ToTable("Buyers", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Buyers.PaymentType", b => |
|||
{ |
|||
b.Property<int>("Id") |
|||
.HasColumnType("integer") |
|||
.HasDefaultValue(1); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(128) |
|||
.HasColumnType("character varying(128)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("PaymentTypes", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.Order", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<Guid?>("BuyerId") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("character varying(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("text") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<DateTime>("OrderDate") |
|||
.HasColumnType("timestamp with time zone"); |
|||
|
|||
b.Property<string>("PaymentMethodToken") |
|||
.HasColumnType("text"); |
|||
|
|||
b.Property<int>("_orderStatusId") |
|||
.HasColumnType("integer") |
|||
.HasColumnName("OrderStatusId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("BuyerId"); |
|||
|
|||
b.HasIndex("Id"); |
|||
|
|||
b.HasIndex("_orderStatusId"); |
|||
|
|||
b.ToTable("Orders", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.OrderItem", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<decimal>("Discount") |
|||
.HasColumnType("numeric"); |
|||
|
|||
b.Property<Guid>("OrderId") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<string>("PictureUrl") |
|||
.HasColumnType("text"); |
|||
|
|||
b.Property<Guid>("ProductId") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<string>("ProductName") |
|||
.IsRequired() |
|||
.HasColumnType("text"); |
|||
|
|||
b.Property<decimal>("UnitPrice") |
|||
.HasColumnType("numeric"); |
|||
|
|||
b.Property<int>("Units") |
|||
.HasColumnType("integer"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("OrderId"); |
|||
|
|||
b.ToTable("OrderItems", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.OrderStatus", b => |
|||
{ |
|||
b.Property<int>("Id") |
|||
.HasColumnType("integer") |
|||
.HasDefaultValue(1); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(256) |
|||
.HasColumnType("character varying(256)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("OrderStatus", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Buyers.Buyer", b => |
|||
{ |
|||
b.HasOne("EShopOnAbp.OrderingService.Buyers.PaymentType", "PaymentType") |
|||
.WithMany() |
|||
.HasForeignKey("_paymentTypeId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
|
|||
b.Navigation("PaymentType"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.Order", b => |
|||
{ |
|||
b.HasOne("EShopOnAbp.OrderingService.Buyers.Buyer", null) |
|||
.WithMany() |
|||
.HasForeignKey("BuyerId"); |
|||
|
|||
b.HasOne("EShopOnAbp.OrderingService.Orders.OrderStatus", "OrderStatus") |
|||
.WithMany() |
|||
.HasForeignKey("_orderStatusId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
|
|||
b.OwnsOne("EShopOnAbp.OrderingService.Orders.Address", "Address", b1 => |
|||
{ |
|||
b1.Property<Guid>("OrderId") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b1.Property<string>("City") |
|||
.HasColumnType("text"); |
|||
|
|||
b1.Property<string>("Country") |
|||
.HasColumnType("text"); |
|||
|
|||
b1.Property<string>("Description") |
|||
.HasColumnType("text"); |
|||
|
|||
b1.Property<string>("Street") |
|||
.HasColumnType("text"); |
|||
|
|||
b1.Property<string>("ZipCode") |
|||
.HasColumnType("text"); |
|||
|
|||
b1.HasKey("OrderId"); |
|||
|
|||
b1.ToTable("Orders"); |
|||
|
|||
b1.WithOwner() |
|||
.HasForeignKey("OrderId"); |
|||
}); |
|||
|
|||
b.Navigation("Address"); |
|||
|
|||
b.Navigation("OrderStatus"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.OrderItem", b => |
|||
{ |
|||
b.HasOne("EShopOnAbp.OrderingService.Orders.Order", null) |
|||
.WithMany("OrderItems") |
|||
.HasForeignKey("OrderId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.Order", b => |
|||
{ |
|||
b.Navigation("OrderItems"); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,94 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace EShopOnAbp.OrderingService.Migrations |
|||
{ |
|||
public partial class UpdatedOrderandBuyer : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "Description", |
|||
table: "Orders"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "PaymentId", |
|||
table: "Buyers"); |
|||
|
|||
migrationBuilder.RenameColumn( |
|||
name: "UserName", |
|||
table: "Buyers", |
|||
newName: "Email"); |
|||
|
|||
migrationBuilder.AddColumn<int>( |
|||
name: "PaymentTypeId", |
|||
table: "Buyers", |
|||
type: "integer", |
|||
nullable: false, |
|||
defaultValue: 0); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "PaymentTypes", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<int>(type: "integer", nullable: false, defaultValue: 1), |
|||
Name = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_PaymentTypes", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Buyers_PaymentTypeId", |
|||
table: "Buyers", |
|||
column: "PaymentTypeId"); |
|||
|
|||
migrationBuilder.AddForeignKey( |
|||
name: "FK_Buyers_PaymentTypes_PaymentTypeId", |
|||
table: "Buyers", |
|||
column: "PaymentTypeId", |
|||
principalTable: "PaymentTypes", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropForeignKey( |
|||
name: "FK_Buyers_PaymentTypes_PaymentTypeId", |
|||
table: "Buyers"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "PaymentTypes"); |
|||
|
|||
migrationBuilder.DropIndex( |
|||
name: "IX_Buyers_PaymentTypeId", |
|||
table: "Buyers"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "PaymentTypeId", |
|||
table: "Buyers"); |
|||
|
|||
migrationBuilder.RenameColumn( |
|||
name: "Email", |
|||
table: "Buyers", |
|||
newName: "UserName"); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "Description", |
|||
table: "Orders", |
|||
type: "character varying(1024)", |
|||
maxLength: 1024, |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "PaymentId", |
|||
table: "Buyers", |
|||
type: "text", |
|||
nullable: false, |
|||
defaultValue: ""); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,244 @@ |
|||
// <auto-generated />
|
|||
using System; |
|||
using EShopOnAbp.OrderingService.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace EShopOnAbp.OrderingService.Migrations |
|||
{ |
|||
[DbContext(typeof(OrderingServiceDbContext))] |
|||
[Migration("20211231135901_Added-ProductCode")] |
|||
partial class AddedProductCode |
|||
{ |
|||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.PostgreSql) |
|||
.HasAnnotation("ProductVersion", "6.0.0") |
|||
.HasAnnotation("Relational:MaxIdentifierLength", 63); |
|||
|
|||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Buyers.Buyer", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("character varying(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<string>("Email") |
|||
.IsRequired() |
|||
.HasColumnType("text"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("text") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasColumnType("text"); |
|||
|
|||
b.Property<int>("_paymentTypeId") |
|||
.HasColumnType("integer") |
|||
.HasColumnName("PaymentTypeId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("_paymentTypeId"); |
|||
|
|||
b.ToTable("Buyers", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Buyers.PaymentType", b => |
|||
{ |
|||
b.Property<int>("Id") |
|||
.HasColumnType("integer") |
|||
.HasDefaultValue(1); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(128) |
|||
.HasColumnType("character varying(128)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("PaymentTypes", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.Order", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<Guid?>("BuyerId") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("character varying(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("text") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<DateTime>("OrderDate") |
|||
.HasColumnType("timestamp with time zone"); |
|||
|
|||
b.Property<string>("PaymentMethodToken") |
|||
.HasColumnType("text"); |
|||
|
|||
b.Property<int>("_orderStatusId") |
|||
.HasColumnType("integer") |
|||
.HasColumnName("OrderStatusId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("BuyerId"); |
|||
|
|||
b.HasIndex("Id"); |
|||
|
|||
b.HasIndex("_orderStatusId"); |
|||
|
|||
b.ToTable("Orders", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.OrderItem", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<decimal>("Discount") |
|||
.HasColumnType("numeric"); |
|||
|
|||
b.Property<Guid>("OrderId") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<string>("PictureUrl") |
|||
.HasColumnType("text"); |
|||
|
|||
b.Property<string>("ProductCode") |
|||
.IsRequired() |
|||
.HasColumnType("text"); |
|||
|
|||
b.Property<Guid>("ProductId") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<string>("ProductName") |
|||
.IsRequired() |
|||
.HasColumnType("text"); |
|||
|
|||
b.Property<decimal>("UnitPrice") |
|||
.HasColumnType("numeric"); |
|||
|
|||
b.Property<int>("Units") |
|||
.HasColumnType("integer"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("OrderId"); |
|||
|
|||
b.ToTable("OrderItems", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.OrderStatus", b => |
|||
{ |
|||
b.Property<int>("Id") |
|||
.HasColumnType("integer") |
|||
.HasDefaultValue(1); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(256) |
|||
.HasColumnType("character varying(256)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("OrderStatus", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Buyers.Buyer", b => |
|||
{ |
|||
b.HasOne("EShopOnAbp.OrderingService.Buyers.PaymentType", "PaymentType") |
|||
.WithMany() |
|||
.HasForeignKey("_paymentTypeId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
|
|||
b.Navigation("PaymentType"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.Order", b => |
|||
{ |
|||
b.HasOne("EShopOnAbp.OrderingService.Buyers.Buyer", null) |
|||
.WithMany() |
|||
.HasForeignKey("BuyerId"); |
|||
|
|||
b.HasOne("EShopOnAbp.OrderingService.Orders.OrderStatus", "OrderStatus") |
|||
.WithMany() |
|||
.HasForeignKey("_orderStatusId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
|
|||
b.OwnsOne("EShopOnAbp.OrderingService.Orders.Address", "Address", b1 => |
|||
{ |
|||
b1.Property<Guid>("OrderId") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b1.Property<string>("City") |
|||
.HasColumnType("text"); |
|||
|
|||
b1.Property<string>("Country") |
|||
.HasColumnType("text"); |
|||
|
|||
b1.Property<string>("Description") |
|||
.HasColumnType("text"); |
|||
|
|||
b1.Property<string>("Street") |
|||
.HasColumnType("text"); |
|||
|
|||
b1.Property<string>("ZipCode") |
|||
.HasColumnType("text"); |
|||
|
|||
b1.HasKey("OrderId"); |
|||
|
|||
b1.ToTable("Orders"); |
|||
|
|||
b1.WithOwner() |
|||
.HasForeignKey("OrderId"); |
|||
}); |
|||
|
|||
b.Navigation("Address"); |
|||
|
|||
b.Navigation("OrderStatus"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.OrderItem", b => |
|||
{ |
|||
b.HasOne("EShopOnAbp.OrderingService.Orders.Order", null) |
|||
.WithMany("OrderItems") |
|||
.HasForeignKey("OrderId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.Order", b => |
|||
{ |
|||
b.Navigation("OrderItems"); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace EShopOnAbp.OrderingService.Migrations |
|||
{ |
|||
public partial class AddedProductCode : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AddColumn<string>( |
|||
name: "ProductCode", |
|||
table: "OrderItems", |
|||
type: "text", |
|||
nullable: false, |
|||
defaultValue: ""); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "ProductCode", |
|||
table: "OrderItems"); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,248 @@ |
|||
// <auto-generated />
|
|||
using System; |
|||
using EShopOnAbp.OrderingService.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace EShopOnAbp.OrderingService.Migrations |
|||
{ |
|||
[DbContext(typeof(OrderingServiceDbContext))] |
|||
[Migration("20220104093641_Added_Order_PaymentRequest_Info")] |
|||
partial class Added_Order_PaymentRequest_Info |
|||
{ |
|||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.PostgreSql) |
|||
.HasAnnotation("ProductVersion", "6.0.0") |
|||
.HasAnnotation("Relational:MaxIdentifierLength", 63); |
|||
|
|||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Buyers.Buyer", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("character varying(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<string>("Email") |
|||
.IsRequired() |
|||
.HasColumnType("text"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("text") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasColumnType("text"); |
|||
|
|||
b.Property<int>("_paymentTypeId") |
|||
.HasColumnType("integer") |
|||
.HasColumnName("PaymentTypeId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("_paymentTypeId"); |
|||
|
|||
b.ToTable("Buyers", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Buyers.PaymentType", b => |
|||
{ |
|||
b.Property<int>("Id") |
|||
.HasColumnType("integer") |
|||
.HasDefaultValue(1); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(128) |
|||
.HasColumnType("character varying(128)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("PaymentTypes", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.Order", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<Guid?>("BuyerId") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("character varying(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("text") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<DateTime>("OrderDate") |
|||
.HasColumnType("timestamp with time zone"); |
|||
|
|||
b.Property<Guid?>("PaymentRequestId") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<string>("PaymentStatus") |
|||
.HasMaxLength(256) |
|||
.HasColumnType("character varying(256)"); |
|||
|
|||
b.Property<int>("_orderStatusId") |
|||
.HasColumnType("integer") |
|||
.HasColumnName("OrderStatusId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("BuyerId"); |
|||
|
|||
b.HasIndex("Id"); |
|||
|
|||
b.HasIndex("_orderStatusId"); |
|||
|
|||
b.ToTable("Orders", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.OrderItem", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<decimal>("Discount") |
|||
.HasColumnType("numeric"); |
|||
|
|||
b.Property<Guid>("OrderId") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<string>("PictureUrl") |
|||
.HasColumnType("text"); |
|||
|
|||
b.Property<string>("ProductCode") |
|||
.IsRequired() |
|||
.HasColumnType("text"); |
|||
|
|||
b.Property<Guid>("ProductId") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<string>("ProductName") |
|||
.IsRequired() |
|||
.HasColumnType("text"); |
|||
|
|||
b.Property<decimal>("UnitPrice") |
|||
.HasColumnType("numeric"); |
|||
|
|||
b.Property<int>("Units") |
|||
.HasColumnType("integer"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("OrderId"); |
|||
|
|||
b.ToTable("OrderItems", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.OrderStatus", b => |
|||
{ |
|||
b.Property<int>("Id") |
|||
.HasColumnType("integer") |
|||
.HasDefaultValue(1); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(256) |
|||
.HasColumnType("character varying(256)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("OrderStatus", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Buyers.Buyer", b => |
|||
{ |
|||
b.HasOne("EShopOnAbp.OrderingService.Buyers.PaymentType", "PaymentType") |
|||
.WithMany() |
|||
.HasForeignKey("_paymentTypeId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
|
|||
b.Navigation("PaymentType"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.Order", b => |
|||
{ |
|||
b.HasOne("EShopOnAbp.OrderingService.Buyers.Buyer", null) |
|||
.WithMany() |
|||
.HasForeignKey("BuyerId"); |
|||
|
|||
b.HasOne("EShopOnAbp.OrderingService.Orders.OrderStatus", "OrderStatus") |
|||
.WithMany() |
|||
.HasForeignKey("_orderStatusId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
|
|||
b.OwnsOne("EShopOnAbp.OrderingService.Orders.Address", "Address", b1 => |
|||
{ |
|||
b1.Property<Guid>("OrderId") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b1.Property<string>("City") |
|||
.HasColumnType("text"); |
|||
|
|||
b1.Property<string>("Country") |
|||
.HasColumnType("text"); |
|||
|
|||
b1.Property<string>("Description") |
|||
.HasColumnType("text"); |
|||
|
|||
b1.Property<string>("Street") |
|||
.HasColumnType("text"); |
|||
|
|||
b1.Property<string>("ZipCode") |
|||
.HasColumnType("text"); |
|||
|
|||
b1.HasKey("OrderId"); |
|||
|
|||
b1.ToTable("Orders"); |
|||
|
|||
b1.WithOwner() |
|||
.HasForeignKey("OrderId"); |
|||
}); |
|||
|
|||
b.Navigation("Address"); |
|||
|
|||
b.Navigation("OrderStatus"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.OrderItem", b => |
|||
{ |
|||
b.HasOne("EShopOnAbp.OrderingService.Orders.Order", null) |
|||
.WithMany("OrderItems") |
|||
.HasForeignKey("OrderId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.Order", b => |
|||
{ |
|||
b.Navigation("OrderItems"); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace EShopOnAbp.OrderingService.Migrations |
|||
{ |
|||
public partial class Added_Order_PaymentRequest_Info : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "PaymentMethodToken", |
|||
table: "Orders"); |
|||
|
|||
migrationBuilder.AddColumn<Guid>( |
|||
name: "PaymentRequestId", |
|||
table: "Orders", |
|||
type: "uuid", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "PaymentStatus", |
|||
table: "Orders", |
|||
type: "character varying(256)", |
|||
maxLength: 256, |
|||
nullable: true); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "PaymentRequestId", |
|||
table: "Orders"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "PaymentStatus", |
|||
table: "Orders"); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "PaymentMethodToken", |
|||
table: "Orders", |
|||
type: "text", |
|||
nullable: true); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,230 @@ |
|||
// <auto-generated />
|
|||
using System; |
|||
using EShopOnAbp.OrderingService.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace EShopOnAbp.OrderingService.Migrations |
|||
{ |
|||
[DbContext(typeof(OrderingServiceDbContext))] |
|||
[Migration("20220104115822_Removed_Buyer_Domain")] |
|||
partial class Removed_Buyer_Domain |
|||
{ |
|||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.PostgreSql) |
|||
.HasAnnotation("ProductVersion", "6.0.0") |
|||
.HasAnnotation("Relational:MaxIdentifierLength", 63); |
|||
|
|||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Buyers.PaymentType", b => |
|||
{ |
|||
b.Property<int>("Id") |
|||
.HasColumnType("integer") |
|||
.HasDefaultValue(1); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(128) |
|||
.HasColumnType("character varying(128)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("PaymentTypes", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.Order", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("character varying(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("text") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<DateTime>("OrderDate") |
|||
.HasColumnType("timestamp with time zone"); |
|||
|
|||
b.Property<Guid?>("PaymentRequestId") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<string>("PaymentStatus") |
|||
.HasMaxLength(256) |
|||
.HasColumnType("character varying(256)"); |
|||
|
|||
b.Property<int>("_orderStatusId") |
|||
.HasColumnType("integer") |
|||
.HasColumnName("OrderStatusId"); |
|||
|
|||
b.Property<int>("_paymentTypeId") |
|||
.HasColumnType("integer") |
|||
.HasColumnName("PaymentTypeId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("_orderStatusId"); |
|||
|
|||
b.HasIndex("_paymentTypeId"); |
|||
|
|||
b.ToTable("Orders", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.OrderItem", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<decimal>("Discount") |
|||
.HasColumnType("numeric"); |
|||
|
|||
b.Property<Guid>("OrderId") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<string>("PictureUrl") |
|||
.HasColumnType("text"); |
|||
|
|||
b.Property<string>("ProductCode") |
|||
.IsRequired() |
|||
.HasColumnType("text"); |
|||
|
|||
b.Property<Guid>("ProductId") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b.Property<string>("ProductName") |
|||
.IsRequired() |
|||
.HasColumnType("text"); |
|||
|
|||
b.Property<decimal>("UnitPrice") |
|||
.HasColumnType("numeric"); |
|||
|
|||
b.Property<int>("Units") |
|||
.HasColumnType("integer"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("OrderId"); |
|||
|
|||
b.ToTable("OrderItems", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.OrderStatus", b => |
|||
{ |
|||
b.Property<int>("Id") |
|||
.HasColumnType("integer") |
|||
.HasDefaultValue(1); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(256) |
|||
.HasColumnType("character varying(256)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("OrderStatus", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.Order", b => |
|||
{ |
|||
b.HasOne("EShopOnAbp.OrderingService.Orders.OrderStatus", "OrderStatus") |
|||
.WithMany() |
|||
.HasForeignKey("_orderStatusId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
|
|||
b.HasOne("EShopOnAbp.OrderingService.Buyers.PaymentType", "PaymentType") |
|||
.WithMany() |
|||
.HasForeignKey("_paymentTypeId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
|
|||
b.OwnsOne("EShopOnAbp.OrderingService.Orders.Address", "Address", b1 => |
|||
{ |
|||
b1.Property<Guid>("OrderId") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b1.Property<string>("City") |
|||
.HasColumnType("text"); |
|||
|
|||
b1.Property<string>("Country") |
|||
.HasColumnType("text"); |
|||
|
|||
b1.Property<string>("Description") |
|||
.HasColumnType("text"); |
|||
|
|||
b1.Property<string>("Street") |
|||
.HasColumnType("text"); |
|||
|
|||
b1.Property<string>("ZipCode") |
|||
.HasColumnType("text"); |
|||
|
|||
b1.HasKey("OrderId"); |
|||
|
|||
b1.ToTable("Orders"); |
|||
|
|||
b1.WithOwner() |
|||
.HasForeignKey("OrderId"); |
|||
}); |
|||
|
|||
b.OwnsOne("EShopOnAbp.OrderingService.Orders.Buyer", "Buyer", b1 => |
|||
{ |
|||
b1.Property<Guid>("OrderId") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b1.Property<string>("Email") |
|||
.HasColumnType("text"); |
|||
|
|||
b1.Property<Guid?>("Id") |
|||
.HasColumnType("uuid"); |
|||
|
|||
b1.Property<string>("Name") |
|||
.HasColumnType("text"); |
|||
|
|||
b1.HasKey("OrderId"); |
|||
|
|||
b1.ToTable("Orders"); |
|||
|
|||
b1.WithOwner() |
|||
.HasForeignKey("OrderId"); |
|||
}); |
|||
|
|||
b.Navigation("Address"); |
|||
|
|||
b.Navigation("Buyer"); |
|||
|
|||
b.Navigation("OrderStatus"); |
|||
|
|||
b.Navigation("PaymentType"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.OrderItem", b => |
|||
{ |
|||
b.HasOne("EShopOnAbp.OrderingService.Orders.Order", null) |
|||
.WithMany("OrderItems") |
|||
.HasForeignKey("OrderId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
}); |
|||
|
|||
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.Order", b => |
|||
{ |
|||
b.Navigation("OrderItems"); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,137 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace EShopOnAbp.OrderingService.Migrations |
|||
{ |
|||
public partial class Removed_Buyer_Domain : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropForeignKey( |
|||
name: "FK_Orders_Buyers_BuyerId", |
|||
table: "Orders"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "Buyers"); |
|||
|
|||
migrationBuilder.DropIndex( |
|||
name: "IX_Orders_BuyerId", |
|||
table: "Orders"); |
|||
|
|||
migrationBuilder.DropIndex( |
|||
name: "IX_Orders_Id", |
|||
table: "Orders"); |
|||
|
|||
migrationBuilder.RenameColumn( |
|||
name: "BuyerId", |
|||
table: "Orders", |
|||
newName: "Buyer_Id"); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "Buyer_Email", |
|||
table: "Orders", |
|||
type: "text", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "Buyer_Name", |
|||
table: "Orders", |
|||
type: "text", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<int>( |
|||
name: "PaymentTypeId", |
|||
table: "Orders", |
|||
type: "integer", |
|||
nullable: false, |
|||
defaultValue: 0); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Orders_PaymentTypeId", |
|||
table: "Orders", |
|||
column: "PaymentTypeId"); |
|||
|
|||
migrationBuilder.AddForeignKey( |
|||
name: "FK_Orders_PaymentTypes_PaymentTypeId", |
|||
table: "Orders", |
|||
column: "PaymentTypeId", |
|||
principalTable: "PaymentTypes", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropForeignKey( |
|||
name: "FK_Orders_PaymentTypes_PaymentTypeId", |
|||
table: "Orders"); |
|||
|
|||
migrationBuilder.DropIndex( |
|||
name: "IX_Orders_PaymentTypeId", |
|||
table: "Orders"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "Buyer_Email", |
|||
table: "Orders"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "Buyer_Name", |
|||
table: "Orders"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "PaymentTypeId", |
|||
table: "Orders"); |
|||
|
|||
migrationBuilder.RenameColumn( |
|||
name: "Buyer_Id", |
|||
table: "Orders", |
|||
newName: "BuyerId"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "Buyers", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "uuid", nullable: false), |
|||
PaymentTypeId = table.Column<int>(type: "integer", nullable: false), |
|||
ConcurrencyStamp = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true), |
|||
Email = table.Column<string>(type: "text", nullable: false), |
|||
ExtraProperties = table.Column<string>(type: "text", nullable: true), |
|||
Name = table.Column<string>(type: "text", nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_Buyers", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_Buyers_PaymentTypes_PaymentTypeId", |
|||
column: x => x.PaymentTypeId, |
|||
principalTable: "PaymentTypes", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Orders_BuyerId", |
|||
table: "Orders", |
|||
column: "BuyerId"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Orders_Id", |
|||
table: "Orders", |
|||
column: "Id"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Buyers_PaymentTypeId", |
|||
table: "Buyers", |
|||
column: "PaymentTypeId"); |
|||
|
|||
migrationBuilder.AddForeignKey( |
|||
name: "FK_Orders_Buyers_BuyerId", |
|||
table: "Orders", |
|||
column: "BuyerId", |
|||
principalTable: "Buyers", |
|||
principalColumn: "Id"); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,34 @@ |
|||
using System; |
|||
using System.Linq; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using EShopOnAbp.OrderingService.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Orders; |
|||
|
|||
public class EfCoreOrderRepository : EfCoreRepository<OrderingServiceDbContext, Order, Guid>, IOrderRepository |
|||
{ |
|||
public EfCoreOrderRepository(IDbContextProvider<OrderingServiceDbContext> dbContextProvider) : base( |
|||
dbContextProvider) |
|||
{ |
|||
} |
|||
|
|||
public override async Task<Order> InsertAsync(Order entity, bool autoSave = false, |
|||
CancellationToken cancellationToken = default) |
|||
{ |
|||
var newEntity = await base.InsertAsync(entity, autoSave, GetCancellationToken(cancellationToken)); |
|||
await EnsurePropertyLoadedAsync(newEntity, o => o.OrderStatus, GetCancellationToken(cancellationToken)); |
|||
await EnsurePropertyLoadedAsync(newEntity, o => o.PaymentType, GetCancellationToken(cancellationToken)); |
|||
return newEntity; |
|||
} |
|||
|
|||
public override async Task<IQueryable<Order>> WithDetailsAsync() |
|||
{ |
|||
return (await GetQueryableAsync()) |
|||
.Include(q => q.OrderStatus) |
|||
.Include(q => q.PaymentType); |
|||
} |
|||
} |
|||
@ -0,0 +1,34 @@ |
|||
// This file is automatically generated by ABP framework to use MVC Controllers from CSharp
|
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.Http.Client; |
|||
using Volo.Abp.Http.Modeling; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Http.Client.ClientProxying; |
|||
using EShopOnAbp.OrderingService.Orders; |
|||
|
|||
// ReSharper disable once CheckNamespace
|
|||
namespace EShopOnAbp.OrderingService.Orders.ClientProxies |
|||
{ |
|||
[Dependency(ReplaceServices = true)] |
|||
[ExposeServices(typeof(IOrderAppService), typeof(OrderClientProxy))] |
|||
public partial class OrderClientProxy : ClientProxyBase<IOrderAppService>, IOrderAppService |
|||
{ |
|||
public virtual async Task<OrderDto> GetAsync(Guid id) |
|||
{ |
|||
return await RequestAsync<OrderDto>(nameof(GetAsync), new ClientProxyRequestTypeValue |
|||
{ |
|||
{ typeof(Guid), id } |
|||
}); |
|||
} |
|||
|
|||
public virtual async Task<OrderDto> CreateAsync(OrderCreateDto input) |
|||
{ |
|||
return await RequestAsync<OrderDto>(nameof(CreateAsync), new ClientProxyRequestTypeValue |
|||
{ |
|||
{ typeof(OrderCreateDto), input } |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
// This file is part of OrderClientProxy, you can customize it here
|
|||
// ReSharper disable once CheckNamespace
|
|||
namespace EShopOnAbp.OrderingService.Orders.ClientProxies |
|||
{ |
|||
public partial class OrderClientProxy |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,106 @@ |
|||
{ |
|||
"modules": { |
|||
"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" |
|||
}, |
|||
"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": {} |
|||
} |
|||
@ -1,53 +0,0 @@ |
|||
{ |
|||
"modules": { |
|||
"OrderingService": { |
|||
"rootPath": "OrderingService", |
|||
"remoteServiceName": "OrderingService", |
|||
"controllers": { |
|||
"EShopOnAbp.OrderingService.Samples.SampleController": { |
|||
"controllerName": "Sample", |
|||
"controllerGroupName": "Sample", |
|||
"type": "EShopOnAbp.OrderingService.Samples.SampleController", |
|||
"interfaces": [ |
|||
{ |
|||
"type": "EShopOnAbp.OrderingService.Samples.ISampleAppService" |
|||
} |
|||
], |
|||
"actions": { |
|||
"GetAsync": { |
|||
"uniqueName": "GetAsync", |
|||
"name": "GetAsync", |
|||
"httpMethod": "GET", |
|||
"url": "api/OrderingService/sample", |
|||
"supportedVersions": [], |
|||
"parametersOnMethod": [], |
|||
"parameters": [], |
|||
"returnValue": { |
|||
"type": "EShopOnAbp.OrderingService.Samples.SampleDto", |
|||
"typeSimple": "EShopOnAbp.OrderingService.Samples.SampleDto" |
|||
}, |
|||
"allowAnonymous": null, |
|||
"implementFrom": "EShopOnAbp.OrderingService.Samples.ISampleAppService" |
|||
}, |
|||
"GetAuthorizedAsync": { |
|||
"uniqueName": "GetAuthorizedAsync", |
|||
"name": "GetAuthorizedAsync", |
|||
"httpMethod": "GET", |
|||
"url": "api/OrderingService/sample/authorized", |
|||
"supportedVersions": [], |
|||
"parametersOnMethod": [], |
|||
"parameters": [], |
|||
"returnValue": { |
|||
"type": "EShopOnAbp.OrderingService.Samples.SampleDto", |
|||
"typeSimple": "EShopOnAbp.OrderingService.Samples.SampleDto" |
|||
}, |
|||
"allowAnonymous": false, |
|||
"implementFrom": "EShopOnAbp.OrderingService.Samples.ISampleAppService" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
"types": {} |
|||
} |
|||
@ -1,15 +0,0 @@ |
|||
// This file is automatically generated by ABP framework to use MVC Controllers from CSharp
|
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.Http.Client; |
|||
using Volo.Abp.Http.Modeling; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Http.Client.ClientProxying; |
|||
using EShopOnAbp.OrderingService.Samples; |
|||
|
|||
// ReSharper disable once CheckNamespace
|
|||
namespace EShopOnAbp.OrderingService.Samples.ClientProxies |
|||
{ |
|||
|
|||
} |
|||
@ -1,8 +0,0 @@ |
|||
// This file is part of SampleClientProxy, you can customize it here
|
|||
// ReSharper disable once CheckNamespace
|
|||
namespace EShopOnAbp.OrderingService.Samples.ClientProxies |
|||
{ |
|||
public partial class SampleClientProxy |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,42 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using EShopOnAbp.OrderingService.Buyers; |
|||
using Shouldly; |
|||
using Xunit; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Orders; |
|||
|
|||
public class OrderManagerUnitTests : OrderingServiceDomainTestBase |
|||
{ |
|||
private readonly OrderManager _orderManager; |
|||
|
|||
public OrderManagerUnitTests() |
|||
{ |
|||
_orderManager = GetRequiredService<OrderManager>(); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_CreateOrderAsync() |
|||
{ |
|||
var orderItems = |
|||
new List<(Guid productId, string productName, string productCode, decimal unitPrice, decimal discount, |
|||
string pictureUrl, int |
|||
units)>(); |
|||
orderItems.Add((Guid.NewGuid(), "Test product", "Code:001", 15, 0, "", 1)); |
|||
var createdOrder = await _orderManager.CreateOrderAsync( |
|||
1, |
|||
Guid.Parse("11CA0F6D-208E-441A-9F9B-3611C96E4383"), |
|||
"gterdem", |
|||
"gterdem@volosoft.com", |
|||
orderItems, |
|||
"Test Street", |
|||
"Test City", |
|||
"Test Country", |
|||
"Test zipCode"); |
|||
|
|||
createdOrder.ShouldNotBeNull(); |
|||
createdOrder.OrderStatus.ShouldBe(OrderStatus.Placed); |
|||
createdOrder.PaymentType.ShouldBe(PaymentType.Paypal); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue