From 83393e7146e559d054c3c32712ada4cbbb9ce585 Mon Sep 17 00:00:00 2001 From: "Amir.H Khademi" Date: Tue, 13 Feb 2024 14:56:55 +0330 Subject: [PATCH] add order new prices , ver 0.5.7.15 --- .version | 2 +- .../Production/appsettings.Production.json | 5 +- .../AppSettings/appsettings.Development.json | 3 +- .../Controller/OrderBagController.cs | 10 +- NetinaShop.Api/NetinaShop.Api.csproj | 4 +- .../Configurations/ServiceExtensions.cs | 2 +- .../CalculateOrderDiscountCommandHandler.cs | 22 +- .../CalculateOrderCommandHandler.cs | 12 +- NetinaShop.Domain/Dtos/LargDtos/OrderLDto.cs | 2 + NetinaShop.Domain/Dtos/SmallDtos/OrderSDto.cs | 2 + .../Entities/Orders/Order.Aggregate.cs | 9 +- NetinaShop.Domain/Entities/Orders/Order.cs | 2 + NetinaShop.Domain/Enums/OrderPaymentMethod.cs | 8 +- NetinaShop.Domain/Mappers/OrderMapper.g.cs | 22 + ...56_EditOrderAddProductDiscount.Designer.cs | 1685 +++++++++++++++++ ...40213103856_EditOrderAddProductDiscount.cs | 44 + .../ApplicationContextModelSnapshot.cs | 6 + 17 files changed, 1805 insertions(+), 35 deletions(-) create mode 100644 NetinaShop.Repository/Migrations/20240213103856_EditOrderAddProductDiscount.Designer.cs create mode 100644 NetinaShop.Repository/Migrations/20240213103856_EditOrderAddProductDiscount.cs diff --git a/.version b/.version index c249261..11ed043 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.5.6.14 \ No newline at end of file +0.5.7.15 \ No newline at end of file diff --git a/NetinaShop.Api/AppSettings/Production/appsettings.Production.json b/NetinaShop.Api/AppSettings/Production/appsettings.Production.json index 6d51f8e..0200ef8 100644 --- a/NetinaShop.Api/AppSettings/Production/appsettings.Production.json +++ b/NetinaShop.Api/AppSettings/Production/appsettings.Production.json @@ -1,7 +1,8 @@ { "ConnectionStrings": { "PostgresServer": "User ID=postgres;Password=root;Host=localhost;Port=5432;Database=iGarsonDB;", - "Postgres": "Host=pg-0;Username=vesmmehAgent;Password=g05CTjK358Vx3Eoc9satsWyVwo+15UmsA2dnCrZRUYh1pLTe;Database=NetinaShopDB;Application Name=NetinaShopApi" + "Postgres": "Host=pg-0;Username=vesmmehAgent;Password=g05CTjK358Vx3Eoc9satsWyVwo+15UmsA2dnCrZRUYh1pLTe;Database=NetinaShopDB;Application Name=NetinaShopApi", + "MartenDB": "Host=pg-0;Username=vesmmehAgent;Password=g05CTjK358Vx3Eoc9satsWyVwo+15UmsA2dnCrZRUYh1pLTe;Database=NetinaShopMartenDB;" }, "Logging": { "LogLevel": { @@ -16,7 +17,7 @@ "TaxesFee": 9 }, "SiteSettings": { - "BaseUrl": "https://apinetinashop.visabartar.com", + "BaseUrl": "https://api.vesmeh.com", "KaveNegarApiKey": "3735494B4143727A794346457461576A2B4B6668414973424E333561505A694B", "UserSetting": { "Username": "09214802813", diff --git a/NetinaShop.Api/AppSettings/appsettings.Development.json b/NetinaShop.Api/AppSettings/appsettings.Development.json index 417f3bb..b77ca2a 100644 --- a/NetinaShop.Api/AppSettings/appsettings.Development.json +++ b/NetinaShop.Api/AppSettings/appsettings.Development.json @@ -2,8 +2,7 @@ "ConnectionStrings": { "PostgresServer": "User ID=postgres;Password=root;Host=localhost;Port=5432;Database=iGarsonDB;", "Postgres": "Host=pg-0,pg-1;Username=igarsonAgent;Password=xHTpBf4wC+bBeNg2pL6Ga7VEWKFJx7VPEUpqxwPFfOc2YYTVwFQuHfsiqoVeT9+6;Database=NetinaShopDB;Load Balance Hosts=true;Target Session Attributes=primary;Application Name=iGLS", - "Marten": "Host=pg-0,pg-1;Username=igarsonAgent;Password=xHTpBf4wC+bBeNg2pL6Ga7VEWKFJx7VPEUpqxwPFfOc2YYTVwFQuHfsiqoVeT9+6;Database=NetinaShopSettingsDB;", - "SettingDB": "Host=pg-0,pg-1;Username=igarsonAgent;Password=xHTpBf4wC+bBeNg2pL6Ga7VEWKFJx7VPEUpqxwPFfOc2YYTVwFQuHfsiqoVeT9+6;Database=NetinaShopSettingDB;Load Balance Hosts=true;Target Session Attributes=primary;Application Name=iGLS" + "MartenDB": "Host=pg-0,pg-1;Username=igarsonAgent;Password=xHTpBf4wC+bBeNg2pL6Ga7VEWKFJx7VPEUpqxwPFfOc2YYTVwFQuHfsiqoVeT9+6;Database=NetinaShopMartenDB;" }, "Logging": { "LogLevel": { diff --git a/NetinaShop.Api/Controller/OrderBagController.cs b/NetinaShop.Api/Controller/OrderBagController.cs index ffa74e4..dde92e5 100644 --- a/NetinaShop.Api/Controller/OrderBagController.cs +++ b/NetinaShop.Api/Controller/OrderBagController.cs @@ -51,8 +51,14 @@ public class OrderBagController : ICarterModule => TypedResults.Ok(await mediator.Send(new SubmitDiscountCommand(orderId, discountCode), cancellationToken)); public async Task AddShippingToOrderBagAsync(Guid orderId, [FromBody] SubmitOrderDeliveryCommand request, IMediator mediator, CancellationToken cancellationToken) - => TypedResults.Ok( await mediator.Send(new SubmitOrderDeliveryCommand(request.AddressId, orderId, request.ShippingId), cancellationToken)); + => TypedResults.Ok(await mediator.Send(new SubmitOrderDeliveryCommand(request.AddressId, orderId, request.ShippingId), cancellationToken)); public async Task SubmitOrderPaymentAsync(Guid orderId, [FromQuery] OrderPaymentMethod paymentMethod, IMediator mediator, CancellationToken cancellationToken) - => TypedResults.Ok( await mediator.Send(new SubmitOrderPaymentCommand(orderId, paymentMethod), cancellationToken)); + { + var result = await mediator.Send(new SubmitOrderPaymentCommand(orderId, paymentMethod), cancellationToken); + if (result.NeedToPayOnline) + return TypedResults.Redirect(result.PaymentUrl,true); + else + return TypedResults.Ok(result); + } } \ No newline at end of file diff --git a/NetinaShop.Api/NetinaShop.Api.csproj b/NetinaShop.Api/NetinaShop.Api.csproj index 4123309..7399e45 100644 --- a/NetinaShop.Api/NetinaShop.Api.csproj +++ b/NetinaShop.Api/NetinaShop.Api.csproj @@ -6,8 +6,8 @@ enable true Linux - 0.5.4.13 - 0.5.4.13 + 0.5.7.15 + 0.5.7.15 diff --git a/NetinaShop.Api/WebFramework/Configurations/ServiceExtensions.cs b/NetinaShop.Api/WebFramework/Configurations/ServiceExtensions.cs index a46fe65..1c06520 100644 --- a/NetinaShop.Api/WebFramework/Configurations/ServiceExtensions.cs +++ b/NetinaShop.Api/WebFramework/Configurations/ServiceExtensions.cs @@ -66,7 +66,7 @@ public static class ServiceExtensions serviceCollection.AddMarten(options => { // Establish the connection string to your Marten database - options.Connection(configuration.GetConnectionString("Marten")!); + options.Connection(configuration.GetConnectionString("MartenDB")!); // If we're running in development mode, let Marten just take care // of all necessary schema building and patching behind the scenes diff --git a/NetinaShop.Core/EntityServices/DiscountHandlers/CalculateOrderDiscountCommandHandler.cs b/NetinaShop.Core/EntityServices/DiscountHandlers/CalculateOrderDiscountCommandHandler.cs index df746d9..cccb83a 100644 --- a/NetinaShop.Core/EntityServices/DiscountHandlers/CalculateOrderDiscountCommandHandler.cs +++ b/NetinaShop.Core/EntityServices/DiscountHandlers/CalculateOrderDiscountCommandHandler.cs @@ -21,15 +21,12 @@ public class CalculateOrderDiscountCommandHandler : IRequestHandler op.ProductCost); - discountPrice = discount.AmountType == DiscountAmountType.Amount - ? totalPrice - discount.DiscountAmount - : totalPrice - ((totalPrice / 100) * discount.DiscountAmount); + totalPrice = request.Order.OrderProducts.Sum(op => op.ProductCost); } } else if (discount.Type == DiscountType.Category) @@ -39,10 +36,8 @@ public class CalculateOrderDiscountCommandHandler : IRequestHandler d.Code == request.DiscountCode, cancellationToken); if ( categoryDiscount!=null && !categoryDiscount.IsExpired()) { - var totalPrice = request.Order.OrderProducts.Where(op => op.ProductCategoryId == categoryDiscount.CategoryId).Sum(op => op.ProductCost); - discountPrice = discount.AmountType == DiscountAmountType.Amount - ? totalPrice - discount.DiscountAmount - : totalPrice - ((totalPrice / 100) * discount.DiscountAmount); + totalPrice = request.Order.OrderProducts.Where(op => op.ProductCategoryId == categoryDiscount.CategoryId).Sum(op => op.ProductCost); + } } else if (discount.Type == DiscountType.Product) @@ -53,10 +48,8 @@ public class CalculateOrderDiscountCommandHandler : IRequestHandler op.ProductId == productDiscount!.ProductId).Sum(op => op.ProductCost); - discountPrice = discount.AmountType == DiscountAmountType.Amount - ? totalPrice - discount.DiscountAmount - : totalPrice - ((totalPrice / 100) * discount.DiscountAmount); + totalPrice = request.Order.OrderProducts.Where(op => op.ProductId == productDiscount!.ProductId).Sum(op => op.ProductCost); + } } else if (discount.Type == DiscountType.Subscriber) @@ -64,6 +57,9 @@ public class CalculateOrderDiscountCommandHandler : IRequestHandler op.ProductFee * op.Count); var totalPackingPrice = order.OrderProducts.Sum(op => op.PackingCost); + //var servicePrice = _shopSettings.ServiceIsPercent // ? (totalProductPrice / 100) * _shopSettings.ServiceFee // : _shopSettings.ServiceFee; + var servicePrice = 0; var deliveryPrice = order.OrderDelivery?.DeliveryCost ?? 0; - double discountPrice = order.OrderProducts.Sum(op=>(op.ProductFee - op.ProductFeeWithDiscount) * op.Count); + double productDiscountPrice = order.OrderProducts.Sum(op=>(op.ProductFee - op.ProductFeeWithDiscount) * op.Count); + double discountCodePrice = 0; if (!order.DiscountCode.IsNullOrEmpty()) - { - discountPrice += await _mediator.Send(new CalculateOrderDiscountCommand(order.DiscountCode, order),cancellationToken); - } + discountCodePrice += await _mediator.Send(new CalculateOrderDiscountCommand(order.DiscountCode, order),cancellationToken); //var taxesPrice = (((totalProductPrice - discountPrice) + totalPackingPrice + servicePrice) / 100) * _shopSettings.TaxesFee; + var taxesPrice = 0; - order.SetTotalPrice(totalProductPrice, totalPackingPrice, servicePrice, deliveryPrice, discountPrice, taxesPrice); + order.SetTotalPrice(totalProductPrice, totalPackingPrice, servicePrice, deliveryPrice, productDiscountPrice, discountCodePrice, taxesPrice); order.OrderProducts.Clear(); order.OrderDelivery = null; _repositoryWrapper.SetRepository().Update(order); diff --git a/NetinaShop.Domain/Dtos/LargDtos/OrderLDto.cs b/NetinaShop.Domain/Dtos/LargDtos/OrderLDto.cs index cda3e9a..461ef24 100644 --- a/NetinaShop.Domain/Dtos/LargDtos/OrderLDto.cs +++ b/NetinaShop.Domain/Dtos/LargDtos/OrderLDto.cs @@ -8,6 +8,8 @@ public class OrderLDto : BaseDto public long ServicePrice { get; set; } public long PackingPrice { get; set; } public long TotalProductsPrice { get; set; } + public double DiscountCodePrice { get; set; } + public double ProductDiscountPrice { get; set; } public long DiscountPrice { get; set; } public bool IsPayed { get; set; } public OrderStatus OrderStatus { get; set; } diff --git a/NetinaShop.Domain/Dtos/SmallDtos/OrderSDto.cs b/NetinaShop.Domain/Dtos/SmallDtos/OrderSDto.cs index 3d9465b..967a046 100644 --- a/NetinaShop.Domain/Dtos/SmallDtos/OrderSDto.cs +++ b/NetinaShop.Domain/Dtos/SmallDtos/OrderSDto.cs @@ -9,6 +9,8 @@ public class OrderSDto : BaseDto public double PackingPrice { get; set; } public double TotalProductsPrice { get; set; } public double DiscountPrice { get; set; } + public double DiscountCodePrice { get; set; } + public double ProductDiscountPrice { get; set; } public bool IsPayed { get; set; } public OrderStatus OrderStatus { get; set; } public DateTime PayedAt { get; set; } diff --git a/NetinaShop.Domain/Entities/Orders/Order.Aggregate.cs b/NetinaShop.Domain/Entities/Orders/Order.Aggregate.cs index d673f43..6696670 100644 --- a/NetinaShop.Domain/Entities/Orders/Order.Aggregate.cs +++ b/NetinaShop.Domain/Entities/Orders/Order.Aggregate.cs @@ -90,7 +90,8 @@ public partial class Order double packingPrice, double servicePrice, double deliveryPrice, - double discountPrice, + double productDiscountPrice, + double discountCodePrice, double taxesPrice) { TotalProductsPrice = totalProductPrice; @@ -98,8 +99,10 @@ public partial class Order ServicePrice = servicePrice; DeliveryPrice = deliveryPrice; TaxesPrice = taxesPrice; - DiscountPrice = discountPrice; - TotalPrice = (totalProductPrice + packingPrice + servicePrice + deliveryPrice + taxesPrice) - discountPrice; + DiscountCodePrice = discountCodePrice; + ProductDiscountPrice = productDiscountPrice; + DiscountPrice = productDiscountPrice+discountCodePrice; + TotalPrice = (totalProductPrice + packingPrice + servicePrice + deliveryPrice + taxesPrice) - DiscountPrice; } } diff --git a/NetinaShop.Domain/Entities/Orders/Order.cs b/NetinaShop.Domain/Entities/Orders/Order.cs index 29c0fc7..304a356 100644 --- a/NetinaShop.Domain/Entities/Orders/Order.cs +++ b/NetinaShop.Domain/Entities/Orders/Order.cs @@ -55,6 +55,8 @@ public partial class Order : ApiEntity public double ServicePrice { get; internal set; } public double DeliveryPrice { get; internal set; } public double DiscountPrice { get; internal set; } + public double DiscountCodePrice { get; internal set; } + public double ProductDiscountPrice { get; internal set; } public double TaxesPrice { get; internal set; } public double TotalPrice { get; internal set; } public bool IsPayed { get; internal set; } diff --git a/NetinaShop.Domain/Enums/OrderPaymentMethod.cs b/NetinaShop.Domain/Enums/OrderPaymentMethod.cs index cea6cbe..4c12646 100644 --- a/NetinaShop.Domain/Enums/OrderPaymentMethod.cs +++ b/NetinaShop.Domain/Enums/OrderPaymentMethod.cs @@ -3,11 +3,11 @@ public enum OrderPaymentMethod { [Display(Name = "پرداخت درب محل")] - PayOnDoor, + PayOnDoor = 0, [Display(Name = "پرداخت انلاین")] - OnlinePayment, + OnlinePayment = 1, [Display(Name = "پرداخت کارت به کارت")] - CardTransfer, + CardTransfer = 2, [Display(Name = "نقدی")] - Cash, + Cash = 3, } \ No newline at end of file diff --git a/NetinaShop.Domain/Mappers/OrderMapper.g.cs b/NetinaShop.Domain/Mappers/OrderMapper.g.cs index fedb7d7..e5a57b8 100644 --- a/NetinaShop.Domain/Mappers/OrderMapper.g.cs +++ b/NetinaShop.Domain/Mappers/OrderMapper.g.cs @@ -25,6 +25,8 @@ namespace NetinaShop.Domain.Mappers ServicePrice = (double)p1.ServicePrice, DeliveryPrice = (double)p1.DeliveryPrice, DiscountPrice = (double)p1.DiscountPrice, + DiscountCodePrice = p1.DiscountCodePrice, + ProductDiscountPrice = p1.ProductDiscountPrice, TaxesPrice = (double)p1.TaxesPrice, TotalPrice = (double)p1.TotalPrice, IsPayed = p1.IsPayed, @@ -66,6 +68,8 @@ namespace NetinaShop.Domain.Mappers result.ServicePrice = (double)p4.ServicePrice; result.DeliveryPrice = (double)p4.DeliveryPrice; result.DiscountPrice = (double)p4.DiscountPrice; + result.DiscountCodePrice = p4.DiscountCodePrice; + result.ProductDiscountPrice = p4.ProductDiscountPrice; result.TaxesPrice = (double)p4.TaxesPrice; result.TotalPrice = (double)p4.TotalPrice; result.IsPayed = p4.IsPayed; @@ -91,6 +95,8 @@ namespace NetinaShop.Domain.Mappers ServicePrice = (double)p18.ServicePrice, DeliveryPrice = (double)p18.DeliveryPrice, DiscountPrice = (double)p18.DiscountPrice, + DiscountCodePrice = p18.DiscountCodePrice, + ProductDiscountPrice = p18.ProductDiscountPrice, TaxesPrice = (double)p18.TaxesPrice, TotalPrice = (double)p18.TotalPrice, IsPayed = p18.IsPayed, @@ -168,6 +174,8 @@ namespace NetinaShop.Domain.Mappers ServicePrice = (long)p21.ServicePrice, PackingPrice = (long)p21.PackingPrice, TotalProductsPrice = (long)p21.TotalProductsPrice, + DiscountCodePrice = p21.DiscountCodePrice, + ProductDiscountPrice = p21.ProductDiscountPrice, DiscountPrice = (long)p21.DiscountPrice, IsPayed = p21.IsPayed, OrderStatus = p21.OrderStatus, @@ -209,6 +217,8 @@ namespace NetinaShop.Domain.Mappers result.ServicePrice = (long)p24.ServicePrice; result.PackingPrice = (long)p24.PackingPrice; result.TotalProductsPrice = (long)p24.TotalProductsPrice; + result.DiscountCodePrice = p24.DiscountCodePrice; + result.ProductDiscountPrice = p24.ProductDiscountPrice; result.DiscountPrice = (long)p24.DiscountPrice; result.IsPayed = p24.IsPayed; result.OrderStatus = p24.OrderStatus; @@ -235,6 +245,8 @@ namespace NetinaShop.Domain.Mappers ServicePrice = (long)p32.ServicePrice, PackingPrice = (long)p32.PackingPrice, TotalProductsPrice = (long)p32.TotalProductsPrice, + DiscountCodePrice = p32.DiscountCodePrice, + ProductDiscountPrice = p32.ProductDiscountPrice, DiscountPrice = (long)p32.DiscountPrice, IsPayed = p32.IsPayed, OrderStatus = p32.OrderStatus, @@ -301,6 +313,8 @@ namespace NetinaShop.Domain.Mappers ServicePrice = p35.ServicePrice, DeliveryPrice = p35.DeliveryPrice, DiscountPrice = p35.DiscountPrice, + DiscountCodePrice = p35.DiscountCodePrice, + ProductDiscountPrice = p35.ProductDiscountPrice, TaxesPrice = p35.TaxesPrice, TotalPrice = p35.TotalPrice, IsPayed = p35.IsPayed, @@ -334,6 +348,8 @@ namespace NetinaShop.Domain.Mappers result.ServicePrice = p36.ServicePrice; result.DeliveryPrice = p36.DeliveryPrice; result.DiscountPrice = p36.DiscountPrice; + result.DiscountCodePrice = p36.DiscountCodePrice; + result.ProductDiscountPrice = p36.ProductDiscountPrice; result.TaxesPrice = p36.TaxesPrice; result.TotalPrice = p36.TotalPrice; result.IsPayed = p36.IsPayed; @@ -362,6 +378,8 @@ namespace NetinaShop.Domain.Mappers PackingPrice = p40.PackingPrice, TotalProductsPrice = p40.TotalProductsPrice, DiscountPrice = p40.DiscountPrice, + DiscountCodePrice = p40.DiscountCodePrice, + ProductDiscountPrice = p40.ProductDiscountPrice, IsPayed = p40.IsPayed, OrderStatus = p40.OrderStatus, PayedAt = p40.PayedAt, @@ -392,6 +410,8 @@ namespace NetinaShop.Domain.Mappers result.PackingPrice = p41.PackingPrice; result.TotalProductsPrice = p41.TotalProductsPrice; result.DiscountPrice = p41.DiscountPrice; + result.DiscountCodePrice = p41.DiscountCodePrice; + result.ProductDiscountPrice = p41.ProductDiscountPrice; result.IsPayed = p41.IsPayed; result.OrderStatus = p41.OrderStatus; result.PayedAt = p41.PayedAt; @@ -417,6 +437,8 @@ namespace NetinaShop.Domain.Mappers PackingPrice = p43.PackingPrice, TotalProductsPrice = p43.TotalProductsPrice, DiscountPrice = p43.DiscountPrice, + DiscountCodePrice = p43.DiscountCodePrice, + ProductDiscountPrice = p43.ProductDiscountPrice, IsPayed = p43.IsPayed, OrderStatus = p43.OrderStatus, PayedAt = p43.PayedAt, diff --git a/NetinaShop.Repository/Migrations/20240213103856_EditOrderAddProductDiscount.Designer.cs b/NetinaShop.Repository/Migrations/20240213103856_EditOrderAddProductDiscount.Designer.cs new file mode 100644 index 0000000..71c0625 --- /dev/null +++ b/NetinaShop.Repository/Migrations/20240213103856_EditOrderAddProductDiscount.Designer.cs @@ -0,0 +1,1685 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NetinaShop.Repository.Models; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace NetinaShop.Repository.Migrations +{ + [DbContext(typeof(ApplicationContext))] + [Migration("20240213103856_EditOrderAddProductDiscount")] + partial class EditOrderAddProductDiscount + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("public") + .HasAnnotation("ProductVersion", "8.0.1") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleClaims", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Claims", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("ProviderKey") + .HasColumnType("text"); + + b.Property("ProviderDisplayName") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("Logins", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("UserRoles", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("Tokens", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Accounting.Payment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Amount") + .HasColumnType("double precision"); + + b.Property("Authority") + .IsRequired() + .HasColumnType("text"); + + b.Property("CardPan") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("FactorNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("OrderId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("TransactionCode") + .IsRequired() + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("OrderId"); + + b.HasIndex("UserId"); + + b.ToTable("Payments", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.Blog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CategoryId") + .HasColumnType("uuid"); + + b.Property("Content") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("IsSuggested") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("ReadingTime") + .HasColumnType("integer"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("Summery") + .IsRequired() + .HasColumnType("text"); + + b.Property("Tags") + .IsRequired() + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CategoryId"); + + b.ToTable("Blogs", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.BlogCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("BlogCategories", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Brands.Brand", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("HasSpecialPage") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("PageUrl") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Brands", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.Discount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AmountType") + .HasColumnType("integer"); + + b.Property("Code") + .IsRequired() + .HasColumnType("text"); + + b.Property("Count") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("DiscountAmount") + .HasColumnType("bigint"); + + b.Property("DiscountPercent") + .HasColumnType("integer"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("character varying(21)"); + + b.Property("ExpireDate") + .HasColumnType("timestamp without time zone"); + + b.Property("HasCode") + .HasColumnType("boolean"); + + b.Property("HasPriceCeiling") + .HasColumnType("boolean"); + + b.Property("HasPriceFloor") + .HasColumnType("boolean"); + + b.Property("IsForInvitation") + .HasColumnType("boolean"); + + b.Property("IsInfinity") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("IsSpecialOffer") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("PriceCeiling") + .HasColumnType("bigint"); + + b.Property("PriceFloor") + .HasColumnType("bigint"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("UseCount") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.ToTable("Discounts", "public"); + + b.HasDiscriminator("Discriminator").HasValue("Discount"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("DeliveryPrice") + .HasColumnType("double precision"); + + b.Property("DiscountCode") + .IsRequired() + .HasColumnType("text"); + + b.Property("DiscountCodePrice") + .HasColumnType("double precision"); + + b.Property("DiscountId") + .HasColumnType("uuid"); + + b.Property("DiscountPrice") + .HasColumnType("double precision"); + + b.Property("DoneAt") + .HasColumnType("timestamp without time zone"); + + b.Property("FactorCode") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsPayed") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("OrderAt") + .HasColumnType("timestamp without time zone"); + + b.Property("OrderStatus") + .HasColumnType("integer"); + + b.Property("PackingPrice") + .HasColumnType("double precision"); + + b.Property("PayedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("PaymentMethod") + .HasColumnType("integer"); + + b.Property("PreparingMinute") + .HasColumnType("integer"); + + b.Property("ProductDiscountPrice") + .HasColumnType("double precision"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("ServicePrice") + .HasColumnType("double precision"); + + b.Property("TaxesPrice") + .HasColumnType("double precision"); + + b.Property("TotalPrice") + .HasColumnType("double precision"); + + b.Property("TotalProductsPrice") + .HasColumnType("double precision"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("DiscountId"); + + b.HasIndex("UserId"); + + b.ToTable("Orders", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.OrderDelivery", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AddressId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("DeliveryCost") + .HasColumnType("double precision"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("OrderId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("ShippingId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("AddressId"); + + b.HasIndex("OrderId") + .IsUnique(); + + b.HasIndex("ShippingId"); + + b.ToTable("OrderDeliveries", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.OrderProduct", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Count") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("HasDiscount") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("OrderId") + .HasColumnType("uuid"); + + b.Property("OrderProductStatus") + .HasColumnType("integer"); + + b.Property("PackingCost") + .HasColumnType("double precision"); + + b.Property("PackingFee") + .HasColumnType("double precision"); + + b.Property("ProductCategoryId") + .HasColumnType("uuid"); + + b.Property("ProductCost") + .HasColumnType("double precision"); + + b.Property("ProductFee") + .HasColumnType("double precision"); + + b.Property("ProductFeeWithDiscount") + .HasColumnType("double precision"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("OrderId"); + + b.HasIndex("ProductId"); + + b.ToTable("OrderProducts", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsMain") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.ToTable("ProductCategories", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("BeDisplayed") + .HasColumnType("boolean"); + + b.Property("BrandId") + .HasColumnType("uuid"); + + b.Property("CategoryId") + .HasColumnType("uuid"); + + b.Property("Cost") + .HasColumnType("double precision"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("EnglishName") + .IsRequired() + .HasColumnType("text"); + + b.Property("ExpertCheck") + .IsRequired() + .HasColumnType("text"); + + b.Property("HasExpressDelivery") + .HasColumnType("boolean"); + + b.Property("IsEnable") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("MaxOrderCount") + .HasColumnType("integer"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("PackingCost") + .HasColumnType("double precision"); + + b.Property("PersianName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Rate") + .HasColumnType("real"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("ReviewCount") + .HasColumnType("integer"); + + b.Property("Stock") + .HasColumnType("integer"); + + b.Property("Summery") + .IsRequired() + .HasColumnType("text"); + + b.Property("Tags") + .IsRequired() + .HasColumnType("text"); + + b.Property("Viewed") + .HasColumnType("integer"); + + b.Property("Warranty") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("BrandId"); + + b.HasIndex("CategoryId"); + + b.ToTable("Products", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Review", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsBuyer") + .HasColumnType("boolean"); + + b.Property("IsConfirmed") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.Property("Rate") + .HasColumnType("real"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ProductId"); + + b.HasIndex("UserId"); + + b.ToTable("Reviews", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Specification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Detail") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsFeature") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.Property("Value") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.HasIndex("ProductId"); + + b.ToTable("Specifications", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.StorageFiles.StorageFile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(34) + .HasColumnType("character varying(34)"); + + b.Property("FileLocation") + .IsRequired() + .HasColumnType("text"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("text"); + + b.Property("FileType") + .HasColumnType("integer"); + + b.Property("IsHeader") + .HasColumnType("boolean"); + + b.Property("IsPrimary") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("StorageFiles", "public"); + + b.HasDiscriminator("Discriminator").HasValue("StorageFile"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Users.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("EnglishName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PersianName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("Roles", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Users.ApplicationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AccessFailedCount") + .HasColumnType("integer"); + + b.Property("BirthDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Gender") + .HasColumnType("integer"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("text"); + + b.Property("LockoutEnabled") + .HasColumnType("boolean"); + + b.Property("LockoutEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("NationalId") + .IsRequired() + .HasColumnType("text"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PasswordHash") + .HasColumnType("text"); + + b.Property("PhoneNumber") + .HasColumnType("text"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("boolean"); + + b.Property("SecurityStamp") + .HasColumnType("text"); + + b.Property("SignUpStatus") + .HasColumnType("integer"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("Users", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Users.UserAddress", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Address") + .IsRequired() + .HasColumnType("text"); + + b.Property("BuildingUnit") + .IsRequired() + .HasColumnType("text"); + + b.Property("City") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("LocationLat") + .HasColumnType("real"); + + b.Property("LocationLong") + .HasColumnType("real"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("Plaque") + .IsRequired() + .HasColumnType("text"); + + b.Property("PostalCode") + .IsRequired() + .HasColumnType("text"); + + b.Property("Province") + .IsRequired() + .HasColumnType("text"); + + b.Property("ReceiverFullName") + .IsRequired() + .HasColumnType("text"); + + b.Property("ReceiverPhoneNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserAddresses", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Users.UserFavoriteProduct", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ProductId"); + + b.HasIndex("UserId"); + + b.ToTable("UserFavoriteProducts", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Warehouses.Shipping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("DeliveryCost") + .HasColumnType("double precision"); + + b.Property("IsExpressShipping") + .HasColumnType("boolean"); + + b.Property("IsOriginalWarehouse") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("IsShipBySeller") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("WarehouseName") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkingDays") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("Shippings", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.CategoryDiscount", b => + { + b.HasBaseType("NetinaShop.Domain.Entities.Discounts.Discount"); + + b.Property("CategoryId") + .HasColumnType("uuid"); + + b.HasIndex("CategoryId"); + + b.HasDiscriminator().HasValue("CategoryDiscount"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.ProductDiscount", b => + { + b.HasBaseType("NetinaShop.Domain.Entities.Discounts.Discount"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.HasIndex("ProductId"); + + b.HasDiscriminator().HasValue("ProductDiscount"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.BlogStorageFile", b => + { + b.HasBaseType("NetinaShop.Domain.Entities.StorageFiles.StorageFile"); + + b.Property("BlogId") + .HasColumnType("uuid"); + + b.HasIndex("BlogId"); + + b.HasDiscriminator().HasValue("BlogStorageFile"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Brands.BrandStorageFile", b => + { + b.HasBaseType("NetinaShop.Domain.Entities.StorageFiles.StorageFile"); + + b.Property("BrandId") + .HasColumnType("uuid"); + + b.HasIndex("BrandId"); + + b.HasDiscriminator().HasValue("BrandStorageFile"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.ProductCategories.ProductCategoryStorageFile", b => + { + b.HasBaseType("NetinaShop.Domain.Entities.StorageFiles.StorageFile"); + + b.Property("CategoryId") + .HasColumnType("uuid"); + + b.HasIndex("CategoryId"); + + b.HasDiscriminator().HasValue("ProductCategoryStorageFile"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Products.ProductStorageFile", b => + { + b.HasBaseType("NetinaShop.Domain.Entities.StorageFiles.StorageFile"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.HasIndex("ProductId"); + + b.HasDiscriminator().HasValue("ProductStorageFile"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Accounting.Payment", b => + { + b.HasOne("NetinaShop.Domain.Entities.Orders.Order", "Order") + .WithMany("Payments") + .HasForeignKey("OrderId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Order"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.Blog", b => + { + b.HasOne("NetinaShop.Domain.Entities.Blogs.BlogCategory", "Category") + .WithMany("Blogs") + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.Order", b => + { + b.HasOne("NetinaShop.Domain.Entities.Discounts.Discount", null) + .WithMany("Orders") + .HasForeignKey("DiscountId"); + + b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("User"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.OrderDelivery", b => + { + b.HasOne("NetinaShop.Domain.Entities.Users.UserAddress", "Address") + .WithMany() + .HasForeignKey("AddressId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("NetinaShop.Domain.Entities.Orders.Order", "Order") + .WithOne("OrderDelivery") + .HasForeignKey("NetinaShop.Domain.Entities.Orders.OrderDelivery", "OrderId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("NetinaShop.Domain.Entities.Warehouses.Shipping", "Shipping") + .WithMany() + .HasForeignKey("ShippingId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Address"); + + b.Navigation("Order"); + + b.Navigation("Shipping"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.OrderProduct", b => + { + b.HasOne("NetinaShop.Domain.Entities.Orders.Order", "Order") + .WithMany("OrderProducts") + .HasForeignKey("OrderId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") + .WithMany("OrderProducts") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Order"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", b => + { + b.HasOne("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", "Parent") + .WithMany() + .HasForeignKey("ParentId"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Product", b => + { + b.HasOne("NetinaShop.Domain.Entities.Brands.Brand", "Brand") + .WithMany("Products") + .HasForeignKey("BrandId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", "Category") + .WithMany("Products") + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Brand"); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Review", b => + { + b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") + .WithMany("Reviews") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Product"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Specification", b => + { + b.HasOne("NetinaShop.Domain.Entities.Products.Specification", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId"); + + b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") + .WithMany("Specifications") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Parent"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Users.UserAddress", b => + { + b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") + .WithMany("Addresses") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("User"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Users.UserFavoriteProduct", b => + { + b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") + .WithMany() + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Product"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.CategoryDiscount", b => + { + b.HasOne("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", "Category") + .WithMany() + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.ProductDiscount", b => + { + b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") + .WithMany() + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.BlogStorageFile", b => + { + b.HasOne("NetinaShop.Domain.Entities.Blogs.Blog", "Blog") + .WithMany("Files") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Brands.BrandStorageFile", b => + { + b.HasOne("NetinaShop.Domain.Entities.Brands.Brand", "Brand") + .WithMany("Files") + .HasForeignKey("BrandId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Brand"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.ProductCategories.ProductCategoryStorageFile", b => + { + b.HasOne("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", "Category") + .WithMany("Files") + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Products.ProductStorageFile", b => + { + b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") + .WithMany("Files") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.Blog", b => + { + b.Navigation("Files"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.BlogCategory", b => + { + b.Navigation("Blogs"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Brands.Brand", b => + { + b.Navigation("Files"); + + b.Navigation("Products"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.Discount", b => + { + b.Navigation("Orders"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.Order", b => + { + b.Navigation("OrderDelivery"); + + b.Navigation("OrderProducts"); + + b.Navigation("Payments"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", b => + { + b.Navigation("Files"); + + b.Navigation("Products"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Product", b => + { + b.Navigation("Files"); + + b.Navigation("OrderProducts"); + + b.Navigation("Reviews"); + + b.Navigation("Specifications"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Specification", b => + { + b.Navigation("Children"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Users.ApplicationUser", b => + { + b.Navigation("Addresses"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/NetinaShop.Repository/Migrations/20240213103856_EditOrderAddProductDiscount.cs b/NetinaShop.Repository/Migrations/20240213103856_EditOrderAddProductDiscount.cs new file mode 100644 index 0000000..0192174 --- /dev/null +++ b/NetinaShop.Repository/Migrations/20240213103856_EditOrderAddProductDiscount.cs @@ -0,0 +1,44 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace NetinaShop.Repository.Migrations +{ + /// + public partial class EditOrderAddProductDiscount : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "DiscountCodePrice", + schema: "public", + table: "Orders", + type: "double precision", + nullable: false, + defaultValue: 0.0); + + migrationBuilder.AddColumn( + name: "ProductDiscountPrice", + schema: "public", + table: "Orders", + type: "double precision", + nullable: false, + defaultValue: 0.0); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "DiscountCodePrice", + schema: "public", + table: "Orders"); + + migrationBuilder.DropColumn( + name: "ProductDiscountPrice", + schema: "public", + table: "Orders"); + } + } +} diff --git a/NetinaShop.Repository/Migrations/ApplicationContextModelSnapshot.cs b/NetinaShop.Repository/Migrations/ApplicationContextModelSnapshot.cs index 8fc30ba..74e96f8 100644 --- a/NetinaShop.Repository/Migrations/ApplicationContextModelSnapshot.cs +++ b/NetinaShop.Repository/Migrations/ApplicationContextModelSnapshot.cs @@ -455,6 +455,9 @@ namespace NetinaShop.Repository.Migrations .IsRequired() .HasColumnType("text"); + b.Property("DiscountCodePrice") + .HasColumnType("double precision"); + b.Property("DiscountId") .HasColumnType("uuid"); @@ -498,6 +501,9 @@ namespace NetinaShop.Repository.Migrations b.Property("PreparingMinute") .HasColumnType("integer"); + b.Property("ProductDiscountPrice") + .HasColumnType("double precision"); + b.Property("RemovedAt") .HasColumnType("timestamp without time zone");