diff --git a/samples/VirtoCommerce.OrdersModule2.Web/VirtoCommerce.OrdersModule2.Web.csproj b/samples/VirtoCommerce.OrdersModule2.Web/VirtoCommerce.OrdersModule2.Web.csproj index e27da859..29d1fb03 100644 --- a/samples/VirtoCommerce.OrdersModule2.Web/VirtoCommerce.OrdersModule2.Web.csproj +++ b/samples/VirtoCommerce.OrdersModule2.Web/VirtoCommerce.OrdersModule2.Web.csproj @@ -5,11 +5,11 @@ Library - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/VirtoCommerce.OrdersModule.Core/Model/ConfigurationItem.cs b/src/VirtoCommerce.OrdersModule.Core/Model/ConfigurationItem.cs new file mode 100644 index 00000000..eca08fef --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Core/Model/ConfigurationItem.cs @@ -0,0 +1,29 @@ +using VirtoCommerce.Platform.Core.Common; +using VirtoCommerce.Platform.Core.Swagger; + +namespace VirtoCommerce.OrdersModule.Core.Model; + +[SwaggerSchemaId("OrderConfigurationItem")] +public class ConfigurationItem : AuditableEntity +{ + public string LineItemId { get; set; } + + public string ProductId { get; set; } + + public string Name { get; set; } + + public string Sku { get; set; } + + public int Quantity { get; set; } + + public string ImageUrl { get; set; } + + public string CatalogId { get; set; } + + public string CategoryId { get; set; } + + public object Clone() + { + return MemberwiseClone(); + } +} diff --git a/src/VirtoCommerce.OrdersModule.Core/Model/LineItem.cs b/src/VirtoCommerce.OrdersModule.Core/Model/LineItem.cs index 27205fb6..7f61412f 100644 --- a/src/VirtoCommerce.OrdersModule.Core/Model/LineItem.cs +++ b/src/VirtoCommerce.OrdersModule.Core/Model/LineItem.cs @@ -97,6 +97,8 @@ public class LineItem : AuditableEntity, IHasTaxDetalization, ISupportCancellati public string VendorId { get; set; } + public bool IsConfigured { get; set; } + #region IHaveDimension Members public string WeightUnit { get; set; } @@ -135,6 +137,12 @@ public class LineItem : AuditableEntity, IHasTaxDetalization, ISupportCancellati #endregion + #region Configuration Items + + public ICollection ConfigurationItems { get; set; } + + #endregion + public virtual void ReduceDetails(string responseGroup) { var orderResponseGroup = EnumUtility.SafeParseFlags(responseGroup, CustomerOrderResponseGroup.Full); diff --git a/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj b/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj index 47286f54..18011af6 100644 --- a/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj +++ b/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj @@ -15,12 +15,12 @@ - - + + - + diff --git a/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20241121125717_AddConfigurationItems.Designer.cs b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20241121125717_AddConfigurationItems.Designer.cs new file mode 100644 index 00000000..57732d8d --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20241121125717_AddConfigurationItems.Designer.cs @@ -0,0 +1,2146 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using VirtoCommerce.OrdersModule.Data.Repositories; + +#nullable disable + +namespace VirtoCommerce.OrdersModule.Data.MySql.Migrations +{ + [DbContext(typeof(OrderDbContext))] + [Migration("20241121125717_AddConfigurationItems")] + partial class AddConfigurationItems + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.AddressEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("AddressType") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CountryCode") + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CountryName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("Description") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("FirstName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("LastName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Line1") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("Line2") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("Name") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("Organization") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("PaymentInId") + .HasColumnType("varchar(128)"); + + b.Property("Phone") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("PostalCode") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("RegionId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("RegionName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ShipmentId") + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderAddress", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Amount") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime(6)"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("CloseTransaction") + .HasColumnType("tinyint(1)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("IsCancelled") + .HasColumnType("tinyint(1)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("PaymentId") + .HasColumnType("varchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Sum") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("TransactionId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("VendorId") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("TransactionId", "CustomerOrderId") + .IsUnique(); + + b.ToTable("OrderCapture", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CaptureId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CaptureId"); + + b.HasIndex("LineItemId"); + + b.ToTable("OrderCaptureItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ConfigurationItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CatalogId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CategoryId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("ImageUrl") + .HasMaxLength(1028) + .HasColumnType("varchar(1028)"); + + b.Property("LineItemId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("ProductId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("Sku") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.ToTable("OrderConfigurationItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime(6)"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("ChannelId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CustomerId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CustomerName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("DiscountAmount") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("DiscountTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("DiscountTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("EmployeeId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("EmployeeName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Fee") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("FeeTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("FeeTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("FeeWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("HandlingTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("HandlingTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("IsAnonymous") + .HasColumnType("tinyint(1)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("IsCancelled") + .HasColumnType("tinyint(1)"); + + b.Property("IsPrototype") + .HasColumnType("tinyint(1)"); + + b.Property("LanguageCode") + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("PaymentTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("PaymentTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("PurchaseOrderNumber") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("timestamp(6)"); + + b.Property("ShippingTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("ShippingTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("ShoppingCartId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("StoreId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("StoreName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("SubTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("SubTotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("SubscriptionId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SubscriptionNumber") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Sum") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("Total") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.HasKey("Id"); + + b.ToTable("CustomerOrder", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.DiscountEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CouponCode") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CouponInvalidDescription") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("DiscountAmount") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("DiscountAmountWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("LineItemId") + .HasColumnType("varchar(128)"); + + b.Property("PaymentInId") + .HasColumnType("varchar(128)"); + + b.Property("PromotionDescription") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("PromotionId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("PromotionName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ShipmentId") + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderDiscount", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.FeeDetailEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Amount") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("Currency") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeeId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("LineItemId") + .HasColumnType("varchar(128)"); + + b.Property("PaymentInId") + .HasColumnType("varchar(128)"); + + b.Property("ShipmentId") + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderFeeDetail", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime(6)"); + + b.Property("CatalogId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CategoryId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("DiscountAmount") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("DiscountAmountWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("Fee") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("FeeWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("FulfillmentCenterId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("FulfillmentCenterName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("FulfillmentLocationCode") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("ImageUrl") + .HasMaxLength(1028) + .HasColumnType("varchar(1028)"); + + b.Property("IsCancelled") + .HasColumnType("tinyint(1)"); + + b.Property("IsConfigured") + .HasColumnType("tinyint(1)"); + + b.Property("IsGift") + .HasColumnType("tinyint(1)"); + + b.Property("IsReccuring") + .HasColumnType("tinyint(1)"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Price") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("PriceId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("PriceWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("ProductId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ProductOuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ProductType") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("ShippingMethodCode") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Sku") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("VendorId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.ToTable("OrderLineItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.OrderDynamicPropertyObjectValueEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("BooleanValue") + .HasColumnType("tinyint(1)"); + + b.Property("CaptureId") + .HasColumnType("varchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("DateTimeValue") + .HasColumnType("datetime(6)"); + + b.Property("DecimalValue") + .HasColumnType("decimal(18,5)"); + + b.Property("DictionaryItemId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("IntegerValue") + .HasColumnType("int"); + + b.Property("LineItemId") + .HasColumnType("varchar(128)"); + + b.Property("Locale") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("LongTextValue") + .HasColumnType("longtext"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("ObjectId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ObjectType") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PaymentInId") + .HasColumnType("varchar(128)"); + + b.Property("PropertyId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("PropertyName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("RefundId") + .HasColumnType("varchar(128)"); + + b.Property("ShipmentId") + .HasColumnType("varchar(128)"); + + b.Property("ShortTextValue") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("ValueType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("CaptureId"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("RefundId"); + + b.HasIndex("ShipmentId"); + + b.HasIndex("ObjectType", "CustomerOrderId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_CustomerOrderId"); + + b.HasIndex("ObjectType", "LineItemId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_LineItemId"); + + b.HasIndex("ObjectType", "ObjectId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_ObjectId"); + + b.HasIndex("ObjectType", "PaymentInId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_PaymentInId"); + + b.HasIndex("ObjectType", "RefundId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_RefundId"); + + b.HasIndex("ObjectType", "ShipmentId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_ShipmentId"); + + b.ToTable("OrderDynamicPropertyObjectValue", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentGatewayTransactionEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Amount") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Currency") + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("GatewayIpAddress") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("IsProcessed") + .HasColumnType("tinyint(1)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Note") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("PaymentInId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("ProcessAttemptCount") + .HasColumnType("int"); + + b.Property("ProcessError") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("ProcessedDate") + .HasColumnType("datetime(6)"); + + b.Property("RequestData") + .HasColumnType("longtext"); + + b.Property("ResponseCode") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ResponseData") + .HasColumnType("longtext"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Type") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("PaymentInId"); + + b.ToTable("OrderPaymentGatewayTransaction", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("AuthorizedDate") + .HasColumnType("datetime(6)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime(6)"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("CapturedDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CustomerId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CustomerName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("DiscountAmount") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("DiscountAmountWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("GatewayCode") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("IncomingDate") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("IsCancelled") + .HasColumnType("tinyint(1)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Price") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("PriceWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("Purpose") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("ShipmentId") + .HasColumnType("varchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Sum") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Total") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("TotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("VendorId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("VoidedDate") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderPaymentIn", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Amount") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime(6)"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("IsCancelled") + .HasColumnType("tinyint(1)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("PaymentId") + .HasColumnType("varchar(128)"); + + b.Property("ReasonCode") + .HasColumnType("longtext"); + + b.Property("ReasonMessage") + .HasColumnType("longtext"); + + b.Property("RejectReasonMessage") + .HasColumnType("longtext"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Sum") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("TransactionId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("VendorId") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("TransactionId", "CustomerOrderId") + .IsUnique(); + + b.ToTable("OrderRefund", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("RefundId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.HasIndex("RefundId"); + + b.ToTable("OrderRefundItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime(6)"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("varchar(3)"); + + b.Property("CustomerOrderId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("DeliveryDate") + .HasColumnType("datetime(6)"); + + b.Property("DiscountAmount") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("DiscountAmountWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("EmployeeId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("EmployeeName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Fee") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("FeeWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("FulfillmentCenterId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("FulfillmentCenterName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("IsCancelled") + .HasColumnType("tinyint(1)"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Price") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("PriceWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("ShipmentMethodCode") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ShipmentMethodOption") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Sum") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Total") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("TotalWithTax") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("TrackingNumber") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("TrackingUrl") + .HasColumnType("longtext"); + + b.Property("VendorId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("VolumetricWeight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.ToTable("OrderShipment", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("BarCode") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("ShipmentId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("ShipmentPackageId") + .HasColumnType("varchar(128)"); + + b.Property("Status") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.HasIndex("ShipmentId"); + + b.HasIndex("ShipmentPackageId"); + + b.ToTable("OrderShipmentItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("BarCode") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("PackageType") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ShipmentId") + .IsRequired() + .HasColumnType("varchar(128)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderShipmentPackage", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.TaxDetailEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Amount") + .HasPrecision(18, 4) + .HasColumnType("decimal"); + + b.Property("CustomerOrderId") + .HasColumnType("varchar(128)"); + + b.Property("LineItemId") + .HasColumnType("varchar(128)"); + + b.Property("Name") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("PaymentInId") + .HasColumnType("varchar(128)"); + + b.Property("Rate") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ShipmentId") + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderTaxDetail", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.AddressEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Addresses") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Addresses") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Addresses") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany() + .HasForeignKey("CustomerOrderId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "Payment") + .WithMany("Captures") + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", "Capture") + .WithMany("Items") + .HasForeignKey("CaptureId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("CaptureItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Capture"); + + b.Navigation("LineItem"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ConfigurationItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("ConfigurationItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.ClientCascade) + .IsRequired(); + + b.Navigation("LineItem"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.DiscountEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Discounts") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("Discounts") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Discounts") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Discounts") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.FeeDetailEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("FeeDetails") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("FeeDetails") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("FeeDetails") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("FeeDetails") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Items") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.OrderDynamicPropertyObjectValueEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", "Capture") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("CaptureId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", "Refund") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("RefundId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Capture"); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Refund"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentGatewayTransactionEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Transactions") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PaymentIn"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("InPayments") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("InPayments") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("CustomerOrder"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany() + .HasForeignKey("CustomerOrderId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "Payment") + .WithMany("Refunds") + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("RefundItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", "Refund") + .WithMany("Items") + .HasForeignKey("RefundId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("LineItem"); + + b.Navigation("Refund"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Shipments") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CustomerOrder"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("ShipmentItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Items") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", "ShipmentPackage") + .WithMany("Items") + .HasForeignKey("ShipmentPackageId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("LineItem"); + + b.Navigation("Shipment"); + + b.Navigation("ShipmentPackage"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Packages") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.TaxDetailEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("TaxDetails") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("TaxDetails") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("TaxDetails") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("TaxDetails") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("InPayments"); + + b.Navigation("Items"); + + b.Navigation("Shipments"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.Navigation("CaptureItems"); + + b.Navigation("ConfigurationItems"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("RefundItems"); + + b.Navigation("ShipmentItems"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Captures"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("Refunds"); + + b.Navigation("TaxDetails"); + + b.Navigation("Transactions"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("InPayments"); + + b.Navigation("Items"); + + b.Navigation("Packages"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.Navigation("Items"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20241121125717_AddConfigurationItems.cs b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20241121125717_AddConfigurationItems.cs new file mode 100644 index 00000000..402955bb --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20241121125717_AddConfigurationItems.cs @@ -0,0 +1,77 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace VirtoCommerce.OrdersModule.Data.MySql.Migrations +{ + /// + public partial class AddConfigurationItems : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "IsConfigured", + table: "OrderLineItem", + type: "tinyint(1)", + nullable: false, + defaultValue: false); + + migrationBuilder.CreateTable( + name: "OrderConfigurationItem", + columns: table => new + { + Id = table.Column(type: "varchar(128)", maxLength: 128, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + LineItemId = table.Column(type: "varchar(128)", maxLength: 128, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ProductId = table.Column(type: "varchar(128)", maxLength: 128, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Name = table.Column(type: "varchar(1024)", maxLength: 1024, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Sku = table.Column(type: "varchar(128)", maxLength: 128, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Quantity = table.Column(type: "int", nullable: false), + ImageUrl = table.Column(type: "varchar(1028)", maxLength: 1028, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + CatalogId = table.Column(type: "varchar(128)", maxLength: 128, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + CategoryId = table.Column(type: "varchar(128)", maxLength: 128, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + CreatedDate = table.Column(type: "datetime(6)", nullable: false), + ModifiedDate = table.Column(type: "datetime(6)", nullable: true), + CreatedBy = table.Column(type: "varchar(64)", maxLength: 64, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + ModifiedBy = table.Column(type: "varchar(64)", maxLength: 64, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_OrderConfigurationItem", x => x.Id); + table.ForeignKey( + name: "FK_OrderConfigurationItem_OrderLineItem_LineItemId", + column: x => x.LineItemId, + principalTable: "OrderLineItem", + principalColumn: "Id"); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_OrderConfigurationItem_LineItemId", + table: "OrderConfigurationItem", + column: "LineItemId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "OrderConfigurationItem"); + + migrationBuilder.DropColumn( + name: "IsConfigured", + table: "OrderLineItem"); + } + } +} diff --git a/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/OrderDbContextModelSnapshot.cs b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/OrderDbContextModelSnapshot.cs index d5a39ef2..a7ed7402 100644 --- a/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/OrderDbContextModelSnapshot.cs +++ b/src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/OrderDbContextModelSnapshot.cs @@ -266,6 +266,66 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("OrderCaptureItem", (string)null); }); + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ConfigurationItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CatalogId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CategoryId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("ImageUrl") + .HasMaxLength(1028) + .HasColumnType("varchar(1028)"); + + b.Property("LineItemId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("ProductId") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("Sku") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.ToTable("OrderConfigurationItem", (string)null); + }); + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", b => { b.Property("Id") @@ -672,6 +732,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("IsCancelled") .HasColumnType("tinyint(1)"); + b.Property("IsConfigured") + .HasColumnType("tinyint(1)"); + b.Property("IsGift") .HasColumnType("tinyint(1)"); @@ -1711,6 +1774,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("LineItem"); }); + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ConfigurationItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("ConfigurationItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.ClientCascade) + .IsRequired(); + + b.Navigation("LineItem"); + }); + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.DiscountEntity", b => { b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") @@ -1999,6 +2073,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.Navigation("CaptureItems"); + b.Navigation("ConfigurationItems"); + b.Navigation("Discounts"); b.Navigation("DynamicPropertyObjectValues"); diff --git a/src/VirtoCommerce.OrdersModule.Data.MySql/VirtoCommerce.OrdersModule.Data.MySql.csproj b/src/VirtoCommerce.OrdersModule.Data.MySql/VirtoCommerce.OrdersModule.Data.MySql.csproj index 7a1f1c74..6aefe976 100644 --- a/src/VirtoCommerce.OrdersModule.Data.MySql/VirtoCommerce.OrdersModule.Data.MySql.csproj +++ b/src/VirtoCommerce.OrdersModule.Data.MySql/VirtoCommerce.OrdersModule.Data.MySql.csproj @@ -5,7 +5,7 @@ enable - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -13,7 +13,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20241121125805_AddConfigurationItems.Designer.cs b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20241121125805_AddConfigurationItems.Designer.cs new file mode 100644 index 00000000..03009e7d --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20241121125805_AddConfigurationItems.Designer.cs @@ -0,0 +1,2095 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using VirtoCommerce.OrdersModule.Data.Repositories; + +#nullable disable + +namespace VirtoCommerce.OrdersModule.Data.PostgreSql.Migrations +{ + [DbContext(typeof(OrderDbContext))] + [Migration("20241121125805_AddConfigurationItems")] + partial class AddConfigurationItems + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.AddressEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("AddressType") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CountryCode") + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CountryName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("Description") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("FirstName") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("LastName") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Line1") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("Line2") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("Name") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("Organization") + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("PaymentInId") + .HasColumnType("character varying(128)"); + + b.Property("Phone") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("PostalCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("RegionId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("RegionName") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ShipmentId") + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderAddress", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CancelledDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("CloseTransaction") + .HasColumnType("boolean"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("IsApproved") + .HasColumnType("boolean"); + + b.Property("IsCancelled") + .HasColumnType("boolean"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("PaymentId") + .HasColumnType("character varying(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TransactionId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("VendorId") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("TransactionId", "CustomerOrderId") + .IsUnique(); + + b.ToTable("OrderCapture", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CaptureId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Quantity") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CaptureId"); + + b.HasIndex("LineItemId"); + + b.ToTable("OrderCaptureItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ConfigurationItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CatalogId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CategoryId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ImageUrl") + .HasMaxLength(1028) + .HasColumnType("character varying(1028)"); + + b.Property("LineItemId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("ProductId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Quantity") + .HasColumnType("integer"); + + b.Property("Sku") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.ToTable("OrderConfigurationItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CancelledDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("ChannelId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CustomerId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CustomerName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountTotal") + .HasColumnType("Money"); + + b.Property("DiscountTotalWithTax") + .HasColumnType("Money"); + + b.Property("EmployeeId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("EmployeeName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Fee") + .HasColumnType("Money"); + + b.Property("FeeTotal") + .HasColumnType("Money"); + + b.Property("FeeTotalWithTax") + .HasColumnType("Money"); + + b.Property("FeeWithTax") + .HasColumnType("Money"); + + b.Property("HandlingTotal") + .HasColumnType("Money"); + + b.Property("HandlingTotalWithTax") + .HasColumnType("Money"); + + b.Property("IsAnonymous") + .HasColumnType("boolean"); + + b.Property("IsApproved") + .HasColumnType("boolean"); + + b.Property("IsCancelled") + .HasColumnType("boolean"); + + b.Property("IsPrototype") + .HasColumnType("boolean"); + + b.Property("LanguageCode") + .HasMaxLength(16) + .HasColumnType("character varying(16)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("PaymentTotal") + .HasColumnType("Money"); + + b.Property("PaymentTotalWithTax") + .HasColumnType("Money"); + + b.Property("PurchaseOrderNumber") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.Property("ShippingTotal") + .HasColumnType("Money"); + + b.Property("ShippingTotalWithTax") + .HasColumnType("Money"); + + b.Property("ShoppingCartId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("StoreId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("StoreName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("SubTotal") + .HasColumnType("Money"); + + b.Property("SubTotalWithTax") + .HasColumnType("Money"); + + b.Property("SubscriptionId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("SubscriptionNumber") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("Total") + .HasColumnType("Money"); + + b.HasKey("Id"); + + b.ToTable("CustomerOrder", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.DiscountEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CouponCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CouponInvalidDescription") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("LineItemId") + .HasColumnType("character varying(128)"); + + b.Property("PaymentInId") + .HasColumnType("character varying(128)"); + + b.Property("PromotionDescription") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("PromotionId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("PromotionName") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ShipmentId") + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderDiscount", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.FeeDetailEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("Currency") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("FeeId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("LineItemId") + .HasColumnType("character varying(128)"); + + b.Property("PaymentInId") + .HasColumnType("character varying(128)"); + + b.Property("ShipmentId") + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderFeeDetail", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CancelledDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CatalogId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CategoryId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("Fee") + .HasColumnType("Money"); + + b.Property("FeeWithTax") + .HasColumnType("Money"); + + b.Property("FulfillmentCenterId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("FulfillmentCenterName") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("FulfillmentLocationCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("ImageUrl") + .HasMaxLength(1028) + .HasColumnType("character varying(1028)"); + + b.Property("IsCancelled") + .HasColumnType("boolean"); + + b.Property("IsConfigured") + .HasColumnType("boolean"); + + b.Property("IsGift") + .HasColumnType("boolean"); + + b.Property("IsReccuring") + .HasColumnType("boolean"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Price") + .HasColumnType("Money"); + + b.Property("PriceId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("PriceWithTax") + .HasColumnType("Money"); + + b.Property("ProductId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ProductOuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ProductType") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Quantity") + .HasColumnType("integer"); + + b.Property("ShippingMethodCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Sku") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("VendorId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.ToTable("OrderLineItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.OrderDynamicPropertyObjectValueEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("BooleanValue") + .HasColumnType("boolean"); + + b.Property("CaptureId") + .HasColumnType("character varying(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("DateTimeValue") + .HasColumnType("timestamp with time zone"); + + b.Property("DecimalValue") + .HasColumnType("decimal(18,5)"); + + b.Property("DictionaryItemId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("IntegerValue") + .HasColumnType("integer"); + + b.Property("LineItemId") + .HasColumnType("character varying(128)"); + + b.Property("Locale") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("LongTextValue") + .HasColumnType("text"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ObjectId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ObjectType") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PaymentInId") + .HasColumnType("character varying(128)"); + + b.Property("PropertyId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("PropertyName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("RefundId") + .HasColumnType("character varying(128)"); + + b.Property("ShipmentId") + .HasColumnType("character varying(128)"); + + b.Property("ShortTextValue") + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("ValueType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.HasKey("Id"); + + b.HasIndex("CaptureId"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("RefundId"); + + b.HasIndex("ShipmentId"); + + b.HasIndex("ObjectType", "CustomerOrderId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_CustomerOrderId"); + + b.HasIndex("ObjectType", "LineItemId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_LineItemId"); + + b.HasIndex("ObjectType", "ObjectId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_ObjectId"); + + b.HasIndex("ObjectType", "PaymentInId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_PaymentInId"); + + b.HasIndex("ObjectType", "RefundId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_RefundId"); + + b.HasIndex("ObjectType", "ShipmentId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_ShipmentId"); + + b.ToTable("OrderDynamicPropertyObjectValue", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentGatewayTransactionEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Currency") + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("GatewayIpAddress") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("IsProcessed") + .HasColumnType("boolean"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Note") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("PaymentInId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("ProcessAttemptCount") + .HasColumnType("integer"); + + b.Property("ProcessError") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("ProcessedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("RequestData") + .HasColumnType("text"); + + b.Property("ResponseCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ResponseData") + .HasColumnType("text"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Type") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.HasKey("Id"); + + b.HasIndex("PaymentInId"); + + b.ToTable("OrderPaymentGatewayTransaction", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("AuthorizedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CancelledDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("CapturedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CustomerId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CustomerName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("GatewayCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("IncomingDate") + .HasColumnType("timestamp with time zone"); + + b.Property("IsApproved") + .HasColumnType("boolean"); + + b.Property("IsCancelled") + .HasColumnType("boolean"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Price") + .HasColumnType("Money"); + + b.Property("PriceWithTax") + .HasColumnType("Money"); + + b.Property("Purpose") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("ShipmentId") + .HasColumnType("character varying(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Total") + .HasColumnType("Money"); + + b.Property("TotalWithTax") + .HasColumnType("Money"); + + b.Property("VendorId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("VoidedDate") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderPaymentIn", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CancelledDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("IsApproved") + .HasColumnType("boolean"); + + b.Property("IsCancelled") + .HasColumnType("boolean"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("PaymentId") + .HasColumnType("character varying(128)"); + + b.Property("ReasonCode") + .HasColumnType("text"); + + b.Property("ReasonMessage") + .HasColumnType("text"); + + b.Property("RejectReasonMessage") + .HasColumnType("text"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TransactionId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("VendorId") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("TransactionId", "CustomerOrderId") + .IsUnique(); + + b.ToTable("OrderRefund", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Quantity") + .HasColumnType("integer"); + + b.Property("RefundId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.HasIndex("RefundId"); + + b.ToTable("OrderRefundItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CancelledDate") + .HasColumnType("timestamp with time zone"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("character varying(3)"); + + b.Property("CustomerOrderId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("DeliveryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("EmployeeId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("EmployeeName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Fee") + .HasColumnType("Money"); + + b.Property("FeeWithTax") + .HasColumnType("Money"); + + b.Property("FulfillmentCenterId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("FulfillmentCenterName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("IsApproved") + .HasColumnType("boolean"); + + b.Property("IsCancelled") + .HasColumnType("boolean"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Price") + .HasColumnType("Money"); + + b.Property("PriceWithTax") + .HasColumnType("Money"); + + b.Property("ShipmentMethodCode") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ShipmentMethodOption") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Total") + .HasColumnType("Money"); + + b.Property("TotalWithTax") + .HasColumnType("Money"); + + b.Property("TrackingNumber") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("TrackingUrl") + .HasColumnType("text"); + + b.Property("VendorId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("VolumetricWeight") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.ToTable("OrderShipment", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("BarCode") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Quantity") + .HasColumnType("integer"); + + b.Property("ShipmentId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("ShipmentPackageId") + .HasColumnType("character varying(128)"); + + b.Property("Status") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.HasIndex("ShipmentId"); + + b.HasIndex("ShipmentPackageId"); + + b.ToTable("OrderShipmentItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("BarCode") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("PackageType") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ShipmentId") + .IsRequired() + .HasColumnType("character varying(128)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("character varying(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderShipmentPackage", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.TaxDetailEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CustomerOrderId") + .HasColumnType("character varying(128)"); + + b.Property("LineItemId") + .HasColumnType("character varying(128)"); + + b.Property("Name") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("PaymentInId") + .HasColumnType("character varying(128)"); + + b.Property("Rate") + .HasPrecision(18, 2) + .HasColumnType("numeric(18,2)"); + + b.Property("ShipmentId") + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderTaxDetail", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.AddressEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Addresses") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Addresses") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Addresses") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany() + .HasForeignKey("CustomerOrderId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "Payment") + .WithMany("Captures") + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", "Capture") + .WithMany("Items") + .HasForeignKey("CaptureId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("CaptureItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Capture"); + + b.Navigation("LineItem"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ConfigurationItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("ConfigurationItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.ClientCascade) + .IsRequired(); + + b.Navigation("LineItem"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.DiscountEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Discounts") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("Discounts") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Discounts") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Discounts") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.FeeDetailEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("FeeDetails") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("FeeDetails") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("FeeDetails") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("FeeDetails") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Items") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.OrderDynamicPropertyObjectValueEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", "Capture") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("CaptureId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", "Refund") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("RefundId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Capture"); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Refund"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentGatewayTransactionEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Transactions") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PaymentIn"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("InPayments") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("InPayments") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("CustomerOrder"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany() + .HasForeignKey("CustomerOrderId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "Payment") + .WithMany("Refunds") + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("RefundItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", "Refund") + .WithMany("Items") + .HasForeignKey("RefundId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("LineItem"); + + b.Navigation("Refund"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Shipments") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CustomerOrder"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("ShipmentItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Items") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", "ShipmentPackage") + .WithMany("Items") + .HasForeignKey("ShipmentPackageId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("LineItem"); + + b.Navigation("Shipment"); + + b.Navigation("ShipmentPackage"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Packages") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.TaxDetailEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("TaxDetails") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("TaxDetails") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("TaxDetails") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("TaxDetails") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("InPayments"); + + b.Navigation("Items"); + + b.Navigation("Shipments"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.Navigation("CaptureItems"); + + b.Navigation("ConfigurationItems"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("RefundItems"); + + b.Navigation("ShipmentItems"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Captures"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("Refunds"); + + b.Navigation("TaxDetails"); + + b.Navigation("Transactions"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("InPayments"); + + b.Navigation("Items"); + + b.Navigation("Packages"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.Navigation("Items"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20241121125805_AddConfigurationItems.cs b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20241121125805_AddConfigurationItems.cs new file mode 100644 index 00000000..63021a19 --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20241121125805_AddConfigurationItems.cs @@ -0,0 +1,66 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace VirtoCommerce.OrdersModule.Data.PostgreSql.Migrations +{ + /// + public partial class AddConfigurationItems : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "IsConfigured", + table: "OrderLineItem", + type: "boolean", + nullable: false, + defaultValue: false); + + migrationBuilder.CreateTable( + name: "OrderConfigurationItem", + columns: table => new + { + Id = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), + LineItemId = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), + ProductId = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), + Name = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true), + Sku = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), + Quantity = table.Column(type: "integer", nullable: false), + ImageUrl = table.Column(type: "character varying(1028)", maxLength: 1028, nullable: true), + CatalogId = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), + CategoryId = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), + CreatedDate = table.Column(type: "timestamp with time zone", nullable: false), + ModifiedDate = table.Column(type: "timestamp with time zone", nullable: true), + CreatedBy = table.Column(type: "character varying(64)", maxLength: 64, nullable: true), + ModifiedBy = table.Column(type: "character varying(64)", maxLength: 64, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_OrderConfigurationItem", x => x.Id); + table.ForeignKey( + name: "FK_OrderConfigurationItem_OrderLineItem_LineItemId", + column: x => x.LineItemId, + principalTable: "OrderLineItem", + principalColumn: "Id"); + }); + + migrationBuilder.CreateIndex( + name: "IX_OrderConfigurationItem_LineItemId", + table: "OrderConfigurationItem", + column: "LineItemId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "OrderConfigurationItem"); + + migrationBuilder.DropColumn( + name: "IsConfigured", + table: "OrderLineItem"); + } + } +} diff --git a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/OrderDbContextModelSnapshot.cs b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/OrderDbContextModelSnapshot.cs index 073cfb33..88dda8b0 100644 --- a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/OrderDbContextModelSnapshot.cs +++ b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/OrderDbContextModelSnapshot.cs @@ -264,6 +264,66 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("OrderCaptureItem", (string)null); }); + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ConfigurationItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CatalogId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CategoryId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreatedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ImageUrl") + .HasMaxLength(1028) + .HasColumnType("character varying(1028)"); + + b.Property("LineItemId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("ProductId") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Quantity") + .HasColumnType("integer"); + + b.Property("Sku") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.ToTable("OrderConfigurationItem", (string)null); + }); + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", b => { b.Property("Id") @@ -646,6 +706,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("IsCancelled") .HasColumnType("boolean"); + b.Property("IsConfigured") + .HasColumnType("boolean"); + b.Property("IsGift") .HasColumnType("boolean"); @@ -1660,6 +1723,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("LineItem"); }); + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ConfigurationItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("ConfigurationItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.ClientCascade) + .IsRequired(); + + b.Navigation("LineItem"); + }); + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.DiscountEntity", b => { b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") @@ -1948,6 +2022,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.Navigation("CaptureItems"); + b.Navigation("ConfigurationItems"); + b.Navigation("Discounts"); b.Navigation("DynamicPropertyObjectValues"); diff --git a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/VirtoCommerce.OrdersModule.Data.PostgreSql.csproj b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/VirtoCommerce.OrdersModule.Data.PostgreSql.csproj index 931d5100..d09d7991 100644 --- a/src/VirtoCommerce.OrdersModule.Data.PostgreSql/VirtoCommerce.OrdersModule.Data.PostgreSql.csproj +++ b/src/VirtoCommerce.OrdersModule.Data.PostgreSql/VirtoCommerce.OrdersModule.Data.PostgreSql.csproj @@ -4,7 +4,7 @@ enable - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -12,7 +12,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20241121082404_AddConfigurationItems.Designer.cs b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20241121082404_AddConfigurationItems.Designer.cs new file mode 100644 index 00000000..54e1dd74 --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20241121082404_AddConfigurationItems.Designer.cs @@ -0,0 +1,2096 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using VirtoCommerce.OrdersModule.Data.Repositories; + +#nullable disable + +namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations +{ + [DbContext(typeof(OrderDbContext))] + [Migration("20241121082404_AddConfigurationItems")] + partial class AddConfigurationItems + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.AddressEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("AddressType") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CountryCode") + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CountryName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("Description") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("FirstName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("LastName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Line1") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("Line2") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("Name") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("Organization") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("PaymentInId") + .HasColumnType("nvarchar(128)"); + + b.Property("Phone") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("PostalCode") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("RegionId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("RegionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ShipmentId") + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderAddress", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime2"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("CloseTransaction") + .HasColumnType("bit"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("IsApproved") + .HasColumnType("bit"); + + b.Property("IsCancelled") + .HasColumnType("bit"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("PaymentId") + .HasColumnType("nvarchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TransactionId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("VendorId") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("TransactionId", "CustomerOrderId") + .IsUnique() + .HasFilter("[CustomerOrderId] IS NOT NULL"); + + b.ToTable("OrderCapture", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CaptureId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CaptureId"); + + b.HasIndex("LineItemId"); + + b.ToTable("OrderCaptureItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ConfigurationItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CatalogId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CategoryId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("ImageUrl") + .HasMaxLength(1028) + .HasColumnType("nvarchar(1028)"); + + b.Property("LineItemId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Name") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("ProductId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("Sku") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.ToTable("OrderConfigurationItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime2"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("ChannelId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CustomerId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CustomerName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountTotal") + .HasColumnType("Money"); + + b.Property("DiscountTotalWithTax") + .HasColumnType("Money"); + + b.Property("EmployeeId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EmployeeName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Fee") + .HasColumnType("Money"); + + b.Property("FeeTotal") + .HasColumnType("Money"); + + b.Property("FeeTotalWithTax") + .HasColumnType("Money"); + + b.Property("FeeWithTax") + .HasColumnType("Money"); + + b.Property("HandlingTotal") + .HasColumnType("Money"); + + b.Property("HandlingTotalWithTax") + .HasColumnType("Money"); + + b.Property("IsAnonymous") + .HasColumnType("bit"); + + b.Property("IsApproved") + .HasColumnType("bit"); + + b.Property("IsCancelled") + .HasColumnType("bit"); + + b.Property("IsPrototype") + .HasColumnType("bit"); + + b.Property("LanguageCode") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("PaymentTotal") + .HasColumnType("Money"); + + b.Property("PaymentTotalWithTax") + .HasColumnType("Money"); + + b.Property("PurchaseOrderNumber") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("RowVersion") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("rowversion"); + + b.Property("ShippingTotal") + .HasColumnType("Money"); + + b.Property("ShippingTotalWithTax") + .HasColumnType("Money"); + + b.Property("ShoppingCartId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("StoreId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("StoreName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("SubTotal") + .HasColumnType("Money"); + + b.Property("SubTotalWithTax") + .HasColumnType("Money"); + + b.Property("SubscriptionId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("SubscriptionNumber") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("Total") + .HasColumnType("Money"); + + b.HasKey("Id"); + + b.ToTable("CustomerOrder", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.DiscountEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CouponCode") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CouponInvalidDescription") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("LineItemId") + .HasColumnType("nvarchar(128)"); + + b.Property("PaymentInId") + .HasColumnType("nvarchar(128)"); + + b.Property("PromotionDescription") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("PromotionId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("PromotionName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ShipmentId") + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderDiscount", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.FeeDetailEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("Currency") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("FeeId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("LineItemId") + .HasColumnType("nvarchar(128)"); + + b.Property("PaymentInId") + .HasColumnType("nvarchar(128)"); + + b.Property("ShipmentId") + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderFeeDetail", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime2"); + + b.Property("CatalogId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CategoryId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("Fee") + .HasColumnType("Money"); + + b.Property("FeeWithTax") + .HasColumnType("Money"); + + b.Property("FulfillmentCenterId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("FulfillmentCenterName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("FulfillmentLocationCode") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("ImageUrl") + .HasMaxLength(1028) + .HasColumnType("nvarchar(1028)"); + + b.Property("IsCancelled") + .HasColumnType("bit"); + + b.Property("IsConfigured") + .HasColumnType("bit"); + + b.Property("IsGift") + .HasColumnType("bit"); + + b.Property("IsReccuring") + .HasColumnType("bit"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Price") + .HasColumnType("Money"); + + b.Property("PriceId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("PriceWithTax") + .HasColumnType("Money"); + + b.Property("ProductId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProductOuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProductType") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("ShippingMethodCode") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Sku") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("VendorId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.ToTable("OrderLineItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.OrderDynamicPropertyObjectValueEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("BooleanValue") + .HasColumnType("bit"); + + b.Property("CaptureId") + .HasColumnType("nvarchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("DateTimeValue") + .HasColumnType("datetime2"); + + b.Property("DecimalValue") + .HasColumnType("decimal(18,5)"); + + b.Property("DictionaryItemId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("IntegerValue") + .HasColumnType("int"); + + b.Property("LineItemId") + .HasColumnType("nvarchar(128)"); + + b.Property("Locale") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("LongTextValue") + .HasColumnType("nvarchar(max)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("ObjectId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ObjectType") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PaymentInId") + .HasColumnType("nvarchar(128)"); + + b.Property("PropertyId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("PropertyName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("RefundId") + .HasColumnType("nvarchar(128)"); + + b.Property("ShipmentId") + .HasColumnType("nvarchar(128)"); + + b.Property("ShortTextValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("ValueType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("CaptureId"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("RefundId"); + + b.HasIndex("ShipmentId"); + + b.HasIndex("ObjectType", "CustomerOrderId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_CustomerOrderId"); + + b.HasIndex("ObjectType", "LineItemId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_LineItemId"); + + b.HasIndex("ObjectType", "ObjectId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_ObjectId"); + + b.HasIndex("ObjectType", "PaymentInId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_PaymentInId"); + + b.HasIndex("ObjectType", "RefundId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_RefundId"); + + b.HasIndex("ObjectType", "ShipmentId") + .HasDatabaseName("IX_OrderDynamicProperty_ObjectType_ShipmentId"); + + b.ToTable("OrderDynamicPropertyObjectValue", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentGatewayTransactionEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Currency") + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("GatewayIpAddress") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("IsProcessed") + .HasColumnType("bit"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Note") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("PaymentInId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("ProcessAttemptCount") + .HasColumnType("int"); + + b.Property("ProcessError") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("ProcessedDate") + .HasColumnType("datetime2"); + + b.Property("RequestData") + .HasColumnType("nvarchar(max)"); + + b.Property("ResponseCode") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ResponseData") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Type") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("PaymentInId"); + + b.ToTable("OrderPaymentGatewayTransaction", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("AuthorizedDate") + .HasColumnType("datetime2"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime2"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("CapturedDate") + .HasColumnType("datetime2"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CustomerId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CustomerName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("GatewayCode") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("IncomingDate") + .HasColumnType("datetime2"); + + b.Property("IsApproved") + .HasColumnType("bit"); + + b.Property("IsCancelled") + .HasColumnType("bit"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Price") + .HasColumnType("Money"); + + b.Property("PriceWithTax") + .HasColumnType("Money"); + + b.Property("Purpose") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("ShipmentId") + .HasColumnType("nvarchar(128)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Total") + .HasColumnType("Money"); + + b.Property("TotalWithTax") + .HasColumnType("Money"); + + b.Property("VendorId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("VoidedDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderPaymentIn", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime2"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("IsApproved") + .HasColumnType("bit"); + + b.Property("IsCancelled") + .HasColumnType("bit"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("PaymentId") + .HasColumnType("nvarchar(128)"); + + b.Property("ReasonCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ReasonMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("RejectReasonMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TransactionId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("VendorId") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("PaymentId"); + + b.HasIndex("TransactionId", "CustomerOrderId") + .IsUnique() + .HasFilter("[CustomerOrderId] IS NOT NULL"); + + b.ToTable("OrderRefund", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("RefundId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.HasIndex("RefundId"); + + b.ToTable("OrderRefundItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CancelReason") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CancelledDate") + .HasColumnType("datetime2"); + + b.Property("CancelledState") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("Comment") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CustomerOrderId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("DeliveryDate") + .HasColumnType("datetime2"); + + b.Property("DiscountAmount") + .HasColumnType("Money"); + + b.Property("DiscountAmountWithTax") + .HasColumnType("Money"); + + b.Property("EmployeeId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EmployeeName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Fee") + .HasColumnType("Money"); + + b.Property("FeeWithTax") + .HasColumnType("Money"); + + b.Property("FulfillmentCenterId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("FulfillmentCenterName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("IsApproved") + .HasColumnType("bit"); + + b.Property("IsCancelled") + .HasColumnType("bit"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OrganizationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("OrganizationName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ParentOperationId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Price") + .HasColumnType("Money"); + + b.Property("PriceWithTax") + .HasColumnType("Money"); + + b.Property("ShipmentMethodCode") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ShipmentMethodOption") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Status") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Sum") + .HasColumnType("Money"); + + b.Property("TaxPercentRate") + .HasColumnType("decimal(18,4)"); + + b.Property("TaxTotal") + .HasColumnType("Money"); + + b.Property("TaxType") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Total") + .HasColumnType("Money"); + + b.Property("TotalWithTax") + .HasColumnType("Money"); + + b.Property("TrackingNumber") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TrackingUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("VendorId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("VolumetricWeight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.ToTable("OrderShipment", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("BarCode") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("LineItemId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("OuterId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("ShipmentId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("ShipmentPackageId") + .HasColumnType("nvarchar(128)"); + + b.Property("Status") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.HasIndex("ShipmentId"); + + b.HasIndex("ShipmentPackageId"); + + b.ToTable("OrderShipmentItem", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("BarCode") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("Height") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("Length") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("MeasureUnit") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("PackageType") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ShipmentId") + .IsRequired() + .HasColumnType("nvarchar(128)"); + + b.Property("Weight") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.Property("WeightUnit") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("Width") + .HasPrecision(18, 4) + .HasColumnType("decimal(18,4)"); + + b.HasKey("Id"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderShipmentPackage", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.TaxDetailEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Amount") + .HasColumnType("Money"); + + b.Property("CustomerOrderId") + .HasColumnType("nvarchar(128)"); + + b.Property("LineItemId") + .HasColumnType("nvarchar(128)"); + + b.Property("Name") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("PaymentInId") + .HasColumnType("nvarchar(128)"); + + b.Property("Rate") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.Property("ShipmentId") + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerOrderId"); + + b.HasIndex("LineItemId"); + + b.HasIndex("PaymentInId"); + + b.HasIndex("ShipmentId"); + + b.ToTable("OrderTaxDetail", (string)null); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.AddressEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Addresses") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Addresses") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Addresses") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany() + .HasForeignKey("CustomerOrderId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "Payment") + .WithMany("Captures") + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", "Capture") + .WithMany("Items") + .HasForeignKey("CaptureId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("CaptureItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Capture"); + + b.Navigation("LineItem"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ConfigurationItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("ConfigurationItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.ClientCascade) + .IsRequired(); + + b.Navigation("LineItem"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.DiscountEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Discounts") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("Discounts") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Discounts") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Discounts") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.FeeDetailEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("FeeDetails") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("FeeDetails") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("FeeDetails") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("FeeDetails") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Items") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.OrderDynamicPropertyObjectValueEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", "Capture") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("CaptureId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", "Refund") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("RefundId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("DynamicPropertyObjectValues") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Capture"); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Refund"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentGatewayTransactionEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("Transactions") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PaymentIn"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("InPayments") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("InPayments") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("CustomerOrder"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany() + .HasForeignKey("CustomerOrderId"); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "Payment") + .WithMany("Refunds") + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("RefundItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", "Refund") + .WithMany("Items") + .HasForeignKey("RefundId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("LineItem"); + + b.Navigation("Refund"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("Shipments") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CustomerOrder"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("ShipmentItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Items") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", "ShipmentPackage") + .WithMany("Items") + .HasForeignKey("ShipmentPackageId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("LineItem"); + + b.Navigation("Shipment"); + + b.Navigation("ShipmentPackage"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("Packages") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.TaxDetailEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") + .WithMany("TaxDetails") + .HasForeignKey("CustomerOrderId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("TaxDetails") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", "PaymentIn") + .WithMany("TaxDetails") + .HasForeignKey("PaymentInId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", "Shipment") + .WithMany("TaxDetails") + .HasForeignKey("ShipmentId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("CustomerOrder"); + + b.Navigation("LineItem"); + + b.Navigation("PaymentIn"); + + b.Navigation("Shipment"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CaptureEntity", b => + { + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("InPayments"); + + b.Navigation("Items"); + + b.Navigation("Shipments"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", b => + { + b.Navigation("CaptureItems"); + + b.Navigation("ConfigurationItems"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("RefundItems"); + + b.Navigation("ShipmentItems"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.PaymentInEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Captures"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("Refunds"); + + b.Navigation("TaxDetails"); + + b.Navigation("Transactions"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.RefundEntity", b => + { + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("Items"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentEntity", b => + { + b.Navigation("Addresses"); + + b.Navigation("Discounts"); + + b.Navigation("DynamicPropertyObjectValues"); + + b.Navigation("FeeDetails"); + + b.Navigation("InPayments"); + + b.Navigation("Items"); + + b.Navigation("Packages"); + + b.Navigation("TaxDetails"); + }); + + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ShipmentPackageEntity", b => + { + b.Navigation("Items"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20241121082404_AddConfigurationItems.cs b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20241121082404_AddConfigurationItems.cs new file mode 100644 index 00000000..c71f89fe --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20241121082404_AddConfigurationItems.cs @@ -0,0 +1,66 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations +{ + /// + public partial class AddConfigurationItems : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "IsConfigured", + table: "OrderLineItem", + type: "bit", + nullable: false, + defaultValue: false); + + migrationBuilder.CreateTable( + name: "OrderConfigurationItem", + columns: table => new + { + Id = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + LineItemId = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + ProductId = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + Name = table.Column(type: "nvarchar(1024)", maxLength: 1024, nullable: true), + Sku = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + Quantity = table.Column(type: "int", nullable: false), + ImageUrl = table.Column(type: "nvarchar(1028)", maxLength: 1028, nullable: true), + CatalogId = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + CategoryId = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + CreatedDate = table.Column(type: "datetime2", nullable: false), + ModifiedDate = table.Column(type: "datetime2", nullable: true), + CreatedBy = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + ModifiedBy = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_OrderConfigurationItem", x => x.Id); + table.ForeignKey( + name: "FK_OrderConfigurationItem_OrderLineItem_LineItemId", + column: x => x.LineItemId, + principalTable: "OrderLineItem", + principalColumn: "Id"); + }); + + migrationBuilder.CreateIndex( + name: "IX_OrderConfigurationItem_LineItemId", + table: "OrderConfigurationItem", + column: "LineItemId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "OrderConfigurationItem"); + + migrationBuilder.DropColumn( + name: "IsConfigured", + table: "OrderLineItem"); + } + } +} diff --git a/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/OrderDbContextModelSnapshot.cs b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/OrderDbContextModelSnapshot.cs index db9bdc29..db9db2a5 100644 --- a/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/OrderDbContextModelSnapshot.cs +++ b/src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/OrderDbContextModelSnapshot.cs @@ -265,6 +265,66 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("OrderCaptureItem", (string)null); }); + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ConfigurationItemEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CatalogId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CategoryId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("CreatedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreatedDate") + .HasColumnType("datetime2"); + + b.Property("ImageUrl") + .HasMaxLength(1028) + .HasColumnType("nvarchar(1028)"); + + b.Property("LineItemId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ModifiedBy") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime2"); + + b.Property("Name") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("ProductId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("Sku") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("LineItemId"); + + b.ToTable("OrderConfigurationItem", (string)null); + }); + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", b => { b.Property("Id") @@ -646,6 +706,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("IsCancelled") .HasColumnType("bit"); + b.Property("IsConfigured") + .HasColumnType("bit"); + b.Property("IsGift") .HasColumnType("bit"); @@ -1661,6 +1724,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("LineItem"); }); + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.ConfigurationItemEntity", b => + { + b.HasOne("VirtoCommerce.OrdersModule.Data.Model.LineItemEntity", "LineItem") + .WithMany("ConfigurationItems") + .HasForeignKey("LineItemId") + .OnDelete(DeleteBehavior.ClientCascade) + .IsRequired(); + + b.Navigation("LineItem"); + }); + modelBuilder.Entity("VirtoCommerce.OrdersModule.Data.Model.DiscountEntity", b => { b.HasOne("VirtoCommerce.OrdersModule.Data.Model.CustomerOrderEntity", "CustomerOrder") @@ -1949,6 +2023,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.Navigation("CaptureItems"); + b.Navigation("ConfigurationItems"); + b.Navigation("Discounts"); b.Navigation("DynamicPropertyObjectValues"); diff --git a/src/VirtoCommerce.OrdersModule.Data.SqlServer/VirtoCommerce.OrdersModule.Data.SqlServer.csproj b/src/VirtoCommerce.OrdersModule.Data.SqlServer/VirtoCommerce.OrdersModule.Data.SqlServer.csproj index 49f14335..80a15929 100644 --- a/src/VirtoCommerce.OrdersModule.Data.SqlServer/VirtoCommerce.OrdersModule.Data.SqlServer.csproj +++ b/src/VirtoCommerce.OrdersModule.Data.SqlServer/VirtoCommerce.OrdersModule.Data.SqlServer.csproj @@ -5,7 +5,7 @@ enable - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -13,7 +13,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/VirtoCommerce.OrdersModule.Data/Model/ConfigurationItemEntity.cs b/src/VirtoCommerce.OrdersModule.Data/Model/ConfigurationItemEntity.cs new file mode 100644 index 00000000..3cf8804d --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Data/Model/ConfigurationItemEntity.cs @@ -0,0 +1,90 @@ +using System.ComponentModel.DataAnnotations; +using VirtoCommerce.OrdersModule.Core.Model; +using VirtoCommerce.Platform.Core.Common; + +namespace VirtoCommerce.OrdersModule.Data.Model; + +public class ConfigurationItemEntity : AuditableEntity +{ + [StringLength(128)] + public string LineItemId { get; set; } + public LineItemEntity LineItem { get; set; } + + [StringLength(128)] + public string ProductId { get; set; } + + [StringLength(1024)] + public string Name { get; set; } + + [StringLength(128)] + public string Sku { get; set; } + + public int Quantity { get; set; } + + [StringLength(1028)] + public string ImageUrl { get; set; } + + [StringLength(128)] + public string CatalogId { get; set; } + + [StringLength(128)] + public string CategoryId { get; set; } + + public virtual ConfigurationItem ToModel(ConfigurationItem configurationItem) + { + System.ArgumentNullException.ThrowIfNull(configurationItem); + + configurationItem.Id = Id; + configurationItem.CreatedBy = CreatedBy; + configurationItem.CreatedDate = CreatedDate; + configurationItem.ModifiedBy = ModifiedBy; + configurationItem.ModifiedDate = ModifiedDate; + + configurationItem.LineItemId = LineItemId; + configurationItem.ProductId = ProductId; + configurationItem.Name = Name; + configurationItem.Sku = Sku; + configurationItem.Quantity = Quantity; + configurationItem.ImageUrl = ImageUrl; + configurationItem.CatalogId = CatalogId; + configurationItem.CategoryId = CategoryId; + + return configurationItem; + } + + public virtual ConfigurationItemEntity FromModel(ConfigurationItem configurationItem, PrimaryKeyResolvingMap pkMap) + { + System.ArgumentNullException.ThrowIfNull(configurationItem); + + pkMap.AddPair(configurationItem, this); + + Id = configurationItem.Id; + CreatedBy = configurationItem.CreatedBy; + CreatedDate = configurationItem.CreatedDate; + ModifiedBy = configurationItem.ModifiedBy; + ModifiedDate = configurationItem.ModifiedDate; + + LineItemId = configurationItem.LineItemId; + ProductId = configurationItem.ProductId; + Name = configurationItem.Name; + Sku = configurationItem.Sku; + Quantity = configurationItem.Quantity; + ImageUrl = configurationItem.ImageUrl; + CatalogId = configurationItem.CatalogId; + CategoryId = configurationItem.CategoryId; + + return this; + } + + public virtual void Patch(ConfigurationItemEntity target) + { + target.LineItemId = LineItemId; + target.ProductId = ProductId; + target.Name = Name; + target.Sku = Sku; + target.Quantity = Quantity; + target.ImageUrl = ImageUrl; + target.CatalogId = CatalogId; + target.CategoryId = CategoryId; + } +} diff --git a/src/VirtoCommerce.OrdersModule.Data/Model/LineItemEntity.cs b/src/VirtoCommerce.OrdersModule.Data/Model/LineItemEntity.cs index 21012f7d..b4fad3c3 100644 --- a/src/VirtoCommerce.OrdersModule.Data/Model/LineItemEntity.cs +++ b/src/VirtoCommerce.OrdersModule.Data/Model/LineItemEntity.cs @@ -106,6 +106,8 @@ public class LineItemEntity : AuditableEntity, IHasOuterId [StringLength(128)] public string VendorId { get; set; } + public bool IsConfigured { get; set; } + #region NavigationProperties public string CustomerOrderId { get; set; } @@ -126,6 +128,8 @@ public class LineItemEntity : AuditableEntity, IHasOuterId public virtual ObservableCollection CaptureItems { get; set; } = new NullCollection(); + public virtual ObservableCollection ConfigurationItems { get; set; } = new NullCollection(); + #endregion public virtual LineItem ToModel(LineItem lineItem) @@ -178,10 +182,12 @@ public virtual LineItem ToModel(LineItem lineItem) lineItem.FulfillmentCenterId = FulfillmentCenterId; lineItem.FulfillmentCenterName = FulfillmentCenterName; lineItem.VendorId = VendorId; + lineItem.IsConfigured = IsConfigured; lineItem.Discounts = Discounts.Select(x => x.ToModel(AbstractTypeFactory.TryCreateInstance())).ToList(); lineItem.TaxDetails = TaxDetails.Select(x => x.ToModel(AbstractTypeFactory.TryCreateInstance())).ToList(); lineItem.FeeDetails = FeeDetails.Select(x => x.ToModel(AbstractTypeFactory.TryCreateInstance())).ToList(); + lineItem.ConfigurationItems = ConfigurationItems.Select(x => x.ToModel(AbstractTypeFactory.TryCreateInstance())).ToList(); lineItem.DynamicProperties = DynamicPropertyObjectValues.GroupBy(g => g.PropertyId).Select(x => { @@ -253,6 +259,8 @@ public virtual LineItemEntity FromModel(LineItem lineItem, PrimaryKeyResolvingMa FulfillmentCenterName = lineItem.FulfillmentCenterName; VendorId = lineItem.VendorId; + IsConfigured = lineItem.IsConfigured; + if (lineItem.Discounts != null) { Discounts = new ObservableCollection(); @@ -271,6 +279,11 @@ public virtual LineItemEntity FromModel(LineItem lineItem, PrimaryKeyResolvingMa FeeDetails.AddRange(lineItem.FeeDetails.Select(x => AbstractTypeFactory.TryCreateInstance().FromModel(x))); } + if (lineItem.ConfigurationItems != null) + { + ConfigurationItems = new ObservableCollection(lineItem.ConfigurationItems.Select(x => AbstractTypeFactory.TryCreateInstance().FromModel(x, pkMap))); + } + if (lineItem.DynamicProperties != null) { DynamicPropertyObjectValues = new ObservableCollection(lineItem.DynamicProperties.SelectMany(p => p.Values @@ -304,6 +317,7 @@ public virtual void Patch(LineItemEntity target) target.FulfillmentCenterId = FulfillmentCenterId; target.FulfillmentCenterName = FulfillmentCenterName; target.VendorId = VendorId; + target.IsConfigured = IsConfigured; // Patch prices if there are non 0 prices in the patching entity, or all patched entity prices are 0 var isNeedPatch = GetNonCalculatablePrices().Any(x => x != 0m) || target.GetNonCalculatablePrices().All(x => x == 0m); @@ -338,6 +352,11 @@ public virtual void Patch(LineItemEntity target) FeeDetails.Patch(target.FeeDetails, feeDetailComparer, (sourceFeeDetail, targetFeeDetail) => sourceFeeDetail.Patch(targetFeeDetail)); } + if (!ConfigurationItems.IsNullCollection()) + { + ConfigurationItems.Patch(target.ConfigurationItems, (sourceConfigurationItem, targetConfigurationItem) => sourceConfigurationItem.Patch(targetConfigurationItem)); + } + if (!DynamicPropertyObjectValues.IsNullCollection()) { DynamicPropertyObjectValues.Patch(target.DynamicPropertyObjectValues, (sourceDynamicPropertyObjectValues, targetDynamicPropertyObjectValues) => sourceDynamicPropertyObjectValues.Patch(targetDynamicPropertyObjectValues)); diff --git a/src/VirtoCommerce.OrdersModule.Data/Repositories/OrderDbContext.cs b/src/VirtoCommerce.OrdersModule.Data/Repositories/OrderDbContext.cs index 2f015f29..bd2d5903 100644 --- a/src/VirtoCommerce.OrdersModule.Data/Repositories/OrderDbContext.cs +++ b/src/VirtoCommerce.OrdersModule.Data/Repositories/OrderDbContext.cs @@ -320,6 +320,15 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) #endregion + #region ConfigurationItem + + modelBuilder.Entity().ToTable("OrderConfigurationItem").HasKey(x => x.Id); + modelBuilder.Entity().Property(x => x.Id).HasMaxLength(128).ValueGeneratedOnAdd(); + modelBuilder.Entity().HasOne(x => x.LineItem).WithMany(x => x.ConfigurationItems) + .HasForeignKey(x => x.LineItemId).IsRequired().OnDelete(DeleteBehavior.ClientCascade); + + #endregion + base.OnModelCreating(modelBuilder); // Allows configuration for an entity type for different database types. diff --git a/src/VirtoCommerce.OrdersModule.Data/Repositories/OrderRepository.cs b/src/VirtoCommerce.OrdersModule.Data/Repositories/OrderRepository.cs index bd66b2a4..0be3dd5a 100644 --- a/src/VirtoCommerce.OrdersModule.Data/Repositories/OrderRepository.cs +++ b/src/VirtoCommerce.OrdersModule.Data/Repositories/OrderRepository.cs @@ -34,6 +34,7 @@ public OrderRepository(OrderDbContext dbContext, IUnitOfWork unitOfWork = null) public IQueryable RefundItems => DbContext.Set(); public IQueryable Captures => DbContext.Set(); public IQueryable CaptureItems => DbContext.Set(); + public IQueryable ConfigurationItems => DbContext.Set(); public IQueryable OrderDynamicPropertyObjectValues => DbContext.Set(); @@ -106,6 +107,14 @@ public virtual async Task> GetCustomerOrdersByIdsAsyn { await OrderDynamicPropertyObjectValues.Where(x => lineItemIds.Contains(x.LineItemId)).LoadAsync(); } + + var configurationItemIds = lineItems.Where(x => x.IsConfigured).Select(x => x.Id).ToArray(); + if (configurationItemIds.Any()) + { + await ConfigurationItems + .Where(x => configurationItemIds.Contains(x.LineItemId)) + .LoadAsync(); + } } } diff --git a/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs b/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs index 8a878337..607c56cc 100644 --- a/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs +++ b/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs @@ -14,6 +14,7 @@ using VirtoCommerce.Platform.Core.DynamicProperties; using VirtoCommerce.Platform.Core.Settings; using Address = VirtoCommerce.OrdersModule.Core.Model.Address; +using ConfigurationItem = VirtoCommerce.OrdersModule.Core.Model.ConfigurationItem; using LineItem = VirtoCommerce.OrdersModule.Core.Model.LineItem; using OrderSettings = VirtoCommerce.OrdersModule.Core.ModuleConstants.Settings.General; using Shipment = VirtoCommerce.OrdersModule.Core.Model.Shipment; @@ -274,6 +275,8 @@ protected virtual LineItem ToOrderModel(CartModule.Core.Model.LineItem lineItem) retVal.VendorId = lineItem.VendorId; + retVal.IsConfigured = lineItem.IsConfigured; + if (lineItem.DynamicProperties != null) { retVal.DynamicProperties = lineItem.DynamicProperties.Select(ToOrderModel).ToList(); @@ -284,12 +287,34 @@ protected virtual LineItem ToOrderModel(CartModule.Core.Model.LineItem lineItem) retVal.Discounts = lineItem.Discounts.Select(ToOrderModel).ToList(); } + if (lineItem.ConfigurationItems != null) + { + retVal.ConfigurationItems = lineItem.ConfigurationItems.Select(ToOrderModel).ToList(); + } + retVal.TaxDetails = lineItem.TaxDetails; retVal.Status = GetDefaultLineItemStatus(); return retVal; } + protected virtual ConfigurationItem ToOrderModel(CartModule.Core.Model.ConfigurationItem configurationItem) + { + ArgumentNullException.ThrowIfNull(configurationItem); + + var retVal = AbstractTypeFactory.TryCreateInstance(); + + retVal.ProductId = configurationItem.ProductId; + retVal.Name = configurationItem.Name; + retVal.Sku = configurationItem.Sku; + retVal.Quantity = configurationItem.Quantity; + retVal.ImageUrl = configurationItem.ImageUrl; + retVal.CatalogId = configurationItem.CatalogId; + retVal.CategoryId = configurationItem.CategoryId; + + return retVal; + } + protected virtual Discount ToOrderModel(Discount discount) { if (discount == null) diff --git a/src/VirtoCommerce.OrdersModule.Data/VirtoCommerce.OrdersModule.Data.csproj b/src/VirtoCommerce.OrdersModule.Data/VirtoCommerce.OrdersModule.Data.csproj index 15d32e65..984c8088 100644 --- a/src/VirtoCommerce.OrdersModule.Data/VirtoCommerce.OrdersModule.Data.csproj +++ b/src/VirtoCommerce.OrdersModule.Data/VirtoCommerce.OrdersModule.Data.csproj @@ -18,9 +18,9 @@ - - - + + + diff --git a/src/VirtoCommerce.OrdersModule.Web/module.manifest b/src/VirtoCommerce.OrdersModule.Web/module.manifest index ac63e044..32fb52e7 100644 --- a/src/VirtoCommerce.OrdersModule.Web/module.manifest +++ b/src/VirtoCommerce.OrdersModule.Web/module.manifest @@ -4,11 +4,11 @@ 3.836.0 - 3.861.0 + 3.867.0 - + - + diff --git a/tests/VirtoCommerce.OrdersModule.Tests/VirtoCommerce.OrdersModule.Tests.csproj b/tests/VirtoCommerce.OrdersModule.Tests/VirtoCommerce.OrdersModule.Tests.csproj index 77ab988d..5ea0c970 100644 --- a/tests/VirtoCommerce.OrdersModule.Tests/VirtoCommerce.OrdersModule.Tests.csproj +++ b/tests/VirtoCommerce.OrdersModule.Tests/VirtoCommerce.OrdersModule.Tests.csproj @@ -10,10 +10,10 @@ all - + - - + + all