From 53dc2eac0c39efef8a74f8f95a83faaeb5bfe576 Mon Sep 17 00:00:00 2001 From: "Amir.H Khademi" Date: Fri, 6 Dec 2024 17:37:41 +0330 Subject: [PATCH] Refactor and enhance product and order handling - Updated `DiscountActionDialogBoxViewModel` and `FastProductCreateDialogBoxViewModel` to create command objects directly from properties and improved error handling. - Added meta tag management UI and logic in `ProductActionDialogBox.razor` and `ProductActionDialogBoxViewModel`. - Increased max file read stream size to 8 MB in `StorageDialogBoxViewModel`. - Incremented `AssemblyVersion` and `FileVersion` to `1.7.20.34` in `Netina.AdminPanel.PWA.csproj`. - Updated `BrandsPage.razor` and `BrandsPageViewModel` for pagination and service injection. - Updated `CategoriesPageViewModel` to create command objects directly from properties. - Updated `ProductsPage.razor` for service injection and added a button for product details. - Updated `ICrudApiRest` and `ICrudDtoApiRest` interfaces to use generic `Create` methods. - Updated `appsettings.Development.json` for `StorageBaseUrl` and commented out `IsShop`. - Added new project `AppHost.csproj` targeting .NET 8.0 with Aspire hosting. - Added new `appsettings.Development.json` and `appsettings.json` for logging. - Added new `Program.cs` to create and run a distributed application. - Added new `launchSettings.json` for application launch settings. - Added `Extensions.cs` for common .NET Aspire services. - Added new project `ServiceDefaults.csproj` for shared service defaults. - Introduced `ProductMetaTag` class and related migration for meta tag handling. - Updated `OrderController.cs` for additional authorization requirements. - Updated target frameworks to `net8.0` in various projects. - Enhanced `SiteMapService.cs` to include brand site maps. - Added new properties to DTOs for customer and meta tag handling. - Enhanced `Product` class with meta tag management methods. - Refactored `OrderMapper.g.cs` and `ProductMapper.g.cs` for improved mapping logic. - Enhanced command handlers to manage meta tags. - Added `ICurrentUserService` for user permissions in query handlers. - Refactored `StorageService.cs` for paginated storage file fetching. --- .version | 2 +- Netina.Api/Controllers/OrderController.cs | 5 +- Netina.Api/Netina.Api.csproj | 4 +- Netina.Common/Netina.Common.csproj | 8 +- Netina.Core/BaseServices/SiteMapService.cs | 2 +- Netina.Domain/Dtos/LargDtos/OrderLDto.cs | 1 + Netina.Domain/Dtos/LargDtos/ProductLDto.cs | 1 + Netina.Domain/Dtos/SmallDtos/OrderSDto.cs | 1 + .../ProductCategoryMetaTag.cs | 1 + .../Entities/Products/Product.Aggregate.cs | 8 + Netina.Domain/Entities/Products/Product.cs | 2 + .../Entities/Products/ProductMetaTag.cs | 17 + Netina.Domain/Mappers/OrderMapper.g.cs | 891 +++---- Netina.Domain/Mappers/ProductMapper.g.cs | 942 ++++--- .../Mappers/ProductMetaTagMapper.g.cs | 6 + Netina.Domain/MapsterRegister.cs | 1 + Netina.Domain/Netina.Domain.csproj | 8 +- .../Services/StorageService.cs | 39 +- .../Orders/GetOrderLDtoQueryHandler.cs | 18 +- .../Handlers/Orders/GetOrderQueryHandler.cs | 12 +- .../Products/CreateProductCommandHandler.cs | 3 + .../Products/UpdateProductCommandHandler.cs | 15 + .../Migrations/20240905093846_AddAuthor.cs | 4 +- ...241206081338_AddProductMetaTag.Designer.cs | 2219 +++++++++++++++++ .../20241206081338_AddProductMetaTag.cs | 57 + .../ApplicationContextModelSnapshot.cs | 24 + 26 files changed, 3401 insertions(+), 890 deletions(-) create mode 100644 Netina.Domain/Entities/Products/ProductMetaTag.cs create mode 100644 Netina.Domain/Mappers/ProductMetaTagMapper.g.cs create mode 100644 Netina.Repository/Migrations/20241206081338_AddProductMetaTag.Designer.cs create mode 100644 Netina.Repository/Migrations/20241206081338_AddProductMetaTag.cs diff --git a/.version b/.version index f6cabaf..c77629a 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -1.6.18.28 \ No newline at end of file +1.7.20.34 \ No newline at end of file diff --git a/Netina.Api/Controllers/OrderController.cs b/Netina.Api/Controllers/OrderController.cs index 0816fd5..908347e 100644 --- a/Netina.Api/Controllers/OrderController.cs +++ b/Netina.Api/Controllers/OrderController.cs @@ -16,7 +16,10 @@ public class OrderController : ICarterModule group.MapGet("{id}", GetAsync) .WithDisplayName("Get Order") - .RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewAllOrders, ApplicationPermission.ManageOrders)) + .RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, + ApplicationPermission.ViewAllOrders, + ApplicationPermission.ManageOrders, + ApplicationPermission.ViewMineOrders)) .HasApiVersion(1.0); group.MapPost("{id}/confirm", ConfirmOrderStepAsync) diff --git a/Netina.Api/Netina.Api.csproj b/Netina.Api/Netina.Api.csproj index 8983fe1..e39775b 100644 --- a/Netina.Api/Netina.Api.csproj +++ b/Netina.Api/Netina.Api.csproj @@ -6,8 +6,8 @@ enable true Linux - 1.6.18.28 - 1.6.18.28 + 1.7.20.34 + 1.7.20.34 diff --git a/Netina.Common/Netina.Common.csproj b/Netina.Common/Netina.Common.csproj index 486e5a7..a3069aa 100644 --- a/Netina.Common/Netina.Common.csproj +++ b/Netina.Common/Netina.Common.csproj @@ -1,6 +1,6 @@  - + - + diff --git a/Netina.Core/BaseServices/SiteMapService.cs b/Netina.Core/BaseServices/SiteMapService.cs index 3d8981a..d12b1f5 100644 --- a/Netina.Core/BaseServices/SiteMapService.cs +++ b/Netina.Core/BaseServices/SiteMapService.cs @@ -99,7 +99,7 @@ public class SiteMapService( await CreateCategoriesSiteMapsAsync(); await CreateProductsSiteMapsAsync(); await CreateBlogsSiteMapsAsync(); - //await CreateBrandsSiteMapsAsync(); + await CreateBrandsSiteMapsAsync(); await CreateBlogCategoriesSiteMapsAsync(); await CreatePagesSiteMapsAsync(); diff --git a/Netina.Domain/Dtos/LargDtos/OrderLDto.cs b/Netina.Domain/Dtos/LargDtos/OrderLDto.cs index b894e78..cdf4e1e 100644 --- a/Netina.Domain/Dtos/LargDtos/OrderLDto.cs +++ b/Netina.Domain/Dtos/LargDtos/OrderLDto.cs @@ -19,6 +19,7 @@ public class OrderLDto : BaseDto public string DiscountCode { get; set; } = string.Empty; public long TotalPriceWithoutDiscount => TotalPrice + DiscountPrice; + public Guid CustomerId { get; set; } public string CustomerFullName { get; set; } = string.Empty; public string CustomerPhoneNumber { get; set; } = string.Empty; diff --git a/Netina.Domain/Dtos/LargDtos/ProductLDto.cs b/Netina.Domain/Dtos/LargDtos/ProductLDto.cs index c57f5fb..d27538e 100644 --- a/Netina.Domain/Dtos/LargDtos/ProductLDto.cs +++ b/Netina.Domain/Dtos/LargDtos/ProductLDto.cs @@ -30,6 +30,7 @@ public class ProductLDto : BaseDto public List Specifications { get; set; } = new(); public List Files { get; set; } = new(); + public List MetaTags { get; set; } = new(); public DiscountSDto? SpecialOffer { get; set; } public Guid AuthorId { get; set; } diff --git a/Netina.Domain/Dtos/SmallDtos/OrderSDto.cs b/Netina.Domain/Dtos/SmallDtos/OrderSDto.cs index 9481f11..25c9fad 100644 --- a/Netina.Domain/Dtos/SmallDtos/OrderSDto.cs +++ b/Netina.Domain/Dtos/SmallDtos/OrderSDto.cs @@ -21,4 +21,5 @@ public class OrderSDto : BaseDto public string CustomerFullName { get; set; } = string.Empty; public string CustomerPhoneNumber { get; set; } = string.Empty; public Guid CustomerId { get; set; } + public string DeliveryTrackingCode { get; set; } = string.Empty; } diff --git a/Netina.Domain/Entities/ProductCategories/ProductCategoryMetaTag.cs b/Netina.Domain/Entities/ProductCategories/ProductCategoryMetaTag.cs index 323c5e9..125dbc9 100644 --- a/Netina.Domain/Entities/ProductCategories/ProductCategoryMetaTag.cs +++ b/Netina.Domain/Entities/ProductCategories/ProductCategoryMetaTag.cs @@ -6,6 +6,7 @@ public partial class ProductCategoryMetaTag : MetaTag { } + public ProductCategoryMetaTag(string type, string value, Guid productCategoryId) : base(type, value) { ProductCategoryId = productCategoryId; diff --git a/Netina.Domain/Entities/Products/Product.Aggregate.cs b/Netina.Domain/Entities/Products/Product.Aggregate.cs index 8d4b557..96bf0ae 100644 --- a/Netina.Domain/Entities/Products/Product.Aggregate.cs +++ b/Netina.Domain/Entities/Products/Product.Aggregate.cs @@ -60,6 +60,9 @@ public partial class Product Specifications.Add(ent); return ent; } + + public void AddMetaTag(string key, string value) + => MetaTags.Add(ProductMetaTag.Create(key, value, Id)); } public partial class ProductComment @@ -67,6 +70,11 @@ public partial class ProductComment public static ProductComment Create(string title, string content, float rate, bool isBuyer, bool isAdmin, Guid userId, Guid productId) => new(title, content, rate, isBuyer, isAdmin, userId, productId); } +public partial class ProductMetaTag +{ + public static ProductMetaTag Create(string key, string value, Guid productId) + => new ProductMetaTag(key, value, productId); +} public partial class ProductStorageFile { diff --git a/Netina.Domain/Entities/Products/Product.cs b/Netina.Domain/Entities/Products/Product.cs index 62e4d3f..6275eb8 100644 --- a/Netina.Domain/Entities/Products/Product.cs +++ b/Netina.Domain/Entities/Products/Product.cs @@ -85,5 +85,7 @@ public partial class Product : ApiEntity public List Comments { get; internal set; } = new(); public List Files { get; internal set; } = new(); + public List MetaTags { get; internal set; } = new(); + public List OrderProducts { get; internal set; } = new(); } \ No newline at end of file diff --git a/Netina.Domain/Entities/Products/ProductMetaTag.cs b/Netina.Domain/Entities/Products/ProductMetaTag.cs new file mode 100644 index 0000000..5bb2853 --- /dev/null +++ b/Netina.Domain/Entities/Products/ProductMetaTag.cs @@ -0,0 +1,17 @@ +namespace Netina.Domain.Entities.Products; + +public partial class ProductMetaTag : MetaTag +{ + public ProductMetaTag() + { + + } + + public ProductMetaTag(string type, string value, Guid productId) : base(type, value) + { + ProductId = productId; + } + + public Guid ProductId { get; set; } + public Product? Product { get; set; } +} \ No newline at end of file diff --git a/Netina.Domain/Mappers/OrderMapper.g.cs b/Netina.Domain/Mappers/OrderMapper.g.cs index d3234ac..3e2f14f 100644 --- a/Netina.Domain/Mappers/OrderMapper.g.cs +++ b/Netina.Domain/Mappers/OrderMapper.g.cs @@ -35,6 +35,8 @@ namespace Netina.Domain.Mappers OrderAt = p1.OrderAt, PreparingMinute = p1.PreparingMinute, DiscountCode = p1.DiscountCode, + CustomerId = p1.CustomerId, + Customer = new Customer() {Id = p1.CustomerId}, OrderDelivery = p1.OrderDelivery == null ? null : new OrderDelivery() { AddressId = p1.OrderDelivery.AddressId, @@ -78,388 +80,398 @@ namespace Netina.Domain.Mappers result.OrderAt = p4.OrderAt; result.PreparingMinute = p4.PreparingMinute; result.DiscountCode = p4.DiscountCode; - result.OrderDelivery = funcMain3(p4.OrderDelivery, result.OrderDelivery); - result.OrderProducts = funcMain6(p4.OrderProducts, result.OrderProducts); - result.Payments = funcMain7(p4.Payments, result.Payments); + result.CustomerId = p4.CustomerId; + result.Customer = funcMain3(new Never(), result.Customer, p4); + result.OrderDelivery = funcMain4(p4.OrderDelivery, result.OrderDelivery); + result.OrderProducts = funcMain7(p4.OrderProducts, result.OrderProducts); + result.Payments = funcMain8(p4.Payments, result.Payments); result.Id = p4.Id; result.CreatedAt = p4.CreatedAt; return result; } - public static Expression> ProjectToOrder => p16 => new Order() + public static Expression> ProjectToOrder => p18 => new Order() { - FactorCode = p16.FactorCode, - TotalProductsPrice = (double)p16.TotalProductsPrice, - PackingPrice = (double)p16.PackingPrice, - ServicePrice = (double)p16.ServicePrice, - DeliveryPrice = (double)p16.DeliveryPrice, - DiscountPrice = (double)p16.DiscountPrice, - DiscountCodePrice = p16.DiscountCodePrice, - ProductDiscountPrice = p16.ProductDiscountPrice, - TaxesPrice = (double)p16.TaxesPrice, - TotalPrice = (double)p16.TotalPrice, - IsPayed = p16.IsPayed, - OrderStatus = p16.OrderStatus, - DoneAt = p16.DoneAt, - OrderAt = p16.OrderAt, - PreparingMinute = p16.PreparingMinute, - DiscountCode = p16.DiscountCode, - OrderDelivery = p16.OrderDelivery == null ? null : new OrderDelivery() + FactorCode = p18.FactorCode, + TotalProductsPrice = (double)p18.TotalProductsPrice, + PackingPrice = (double)p18.PackingPrice, + 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, + OrderStatus = p18.OrderStatus, + DoneAt = p18.DoneAt, + OrderAt = p18.OrderAt, + PreparingMinute = p18.PreparingMinute, + DiscountCode = p18.DiscountCode, + CustomerId = p18.CustomerId, + Customer = new Customer() {Id = p18.CustomerId}, + OrderDelivery = p18.OrderDelivery == null ? null : new OrderDelivery() { - AddressId = p16.OrderDelivery.AddressId, - Address = p16.OrderDelivery.Address == null ? null : (UserAddress)Convert.ChangeType((object)p16.OrderDelivery.Address, typeof(UserAddress)), - DeliveryCost = p16.OrderDelivery.DeliveryCost, - TrackingCode = p16.OrderDelivery.TrackingCode, - ShippingId = p16.OrderDelivery.ShippingId, - Shipping = new Shipping() {Id = p16.OrderDelivery.ShippingId}, - OrderId = p16.OrderDelivery.OrderId, - Order = new Order() {Id = p16.OrderDelivery.OrderId}, - Id = p16.OrderDelivery.Id, - CreatedAt = p16.OrderDelivery.CreatedAt + AddressId = p18.OrderDelivery.AddressId, + Address = p18.OrderDelivery.Address == null ? null : (UserAddress)Convert.ChangeType((object)p18.OrderDelivery.Address, typeof(UserAddress)), + DeliveryCost = p18.OrderDelivery.DeliveryCost, + TrackingCode = p18.OrderDelivery.TrackingCode, + ShippingId = p18.OrderDelivery.ShippingId, + Shipping = new Shipping() {Id = p18.OrderDelivery.ShippingId}, + OrderId = p18.OrderDelivery.OrderId, + Order = new Order() {Id = p18.OrderDelivery.OrderId}, + Id = p18.OrderDelivery.Id, + CreatedAt = p18.OrderDelivery.CreatedAt }, - OrderProducts = p16.OrderProducts.Select(p17 => new OrderProduct() + OrderProducts = p18.OrderProducts.Select(p19 => new OrderProduct() { - Count = p17.Count, - ProductFee = p17.ProductFee, - ProductFeeWithDiscount = p17.ProductFeeWithDiscount, - HasDiscount = p17.HasDiscount, - ProductCost = p17.ProductCost, - PackingFee = p17.PackingFee, - PackingCost = p17.PackingCost, - OrderProductStatus = p17.OrderProductStatus, - ProductId = p17.ProductId, + Count = p19.Count, + ProductFee = p19.ProductFee, + ProductFeeWithDiscount = p19.ProductFeeWithDiscount, + HasDiscount = p19.HasDiscount, + ProductCost = p19.ProductCost, + PackingFee = p19.PackingFee, + PackingCost = p19.PackingCost, + OrderProductStatus = p19.OrderProductStatus, + ProductId = p19.ProductId, Product = new Product() { - Cost = p17.ProductCost, - Id = p17.ProductId - }, - OrderId = p17.OrderId, - Order = new Order() {Id = p17.OrderId}, - Id = p17.Id, - CreatedAt = p17.CreatedAt - }).ToList(), - Payments = p16.Payments.Select(p18 => new Payment() - { - FactorNumber = p18.FactorNumber, - Amount = p18.Amount, - Description = p18.Description, - TransactionCode = p18.TransactionCode, - CardPan = p18.CardPan, - Authority = p18.Authority, - Type = p18.Type, - Status = p18.Status, - OrderId = p18.OrderId, - Order = new Order() {Id = p18.OrderId}, - CustomerId = p18.CustomerId, - Customer = new Customer() {Id = p18.CustomerId}, - Id = p18.Id, - CreatedAt = p18.CreatedAt - }).ToList(), - Id = p16.Id, - CreatedAt = p16.CreatedAt - }; - public static OrderLDto AdaptToLDto(this Order p19) - { - return p19 == null ? null : new OrderLDto() - { - FactorCode = p19.FactorCode, - TotalPrice = (long)p19.TotalPrice, - DeliveryPrice = (long)p19.DeliveryPrice, - TaxesPrice = (long)p19.TaxesPrice, - ServicePrice = (long)p19.ServicePrice, - PackingPrice = (long)p19.PackingPrice, - TotalProductsPrice = (long)p19.TotalProductsPrice, - DiscountCodePrice = p19.DiscountCodePrice, - ProductDiscountPrice = p19.ProductDiscountPrice, - DiscountPrice = (long)p19.DiscountPrice, - IsPayed = p19.IsPayed, - OrderStatus = p19.OrderStatus, - DoneAt = p19.DoneAt, - OrderAt = p19.OrderAt, - PreparingMinute = p19.PreparingMinute, - DiscountCode = p19.DiscountCode, - CustomerFullName = p19.Customer != null && p19.Customer.User != null ? p19.Customer.User.FirstName + " " + p19.Customer.User.LastName : string.Empty, - CustomerPhoneNumber = p19.Customer != null && p19.Customer.User != null ? p19.Customer.User.PhoneNumber : string.Empty, - OrderProducts = funcMain8(p19.OrderProducts), - Payments = funcMain9(p19.Payments), - OrderDelivery = p19.OrderDelivery == null ? null : new OrderDeliverySDto() - { - Province = p19.OrderDelivery.Address != null ? p19.OrderDelivery.Address.Province : string.Empty, - City = p19.OrderDelivery.Address != null ? p19.OrderDelivery.Address.City : string.Empty, - Plaque = p19.OrderDelivery.Address != null ? p19.OrderDelivery.Address.Plaque : string.Empty, - LocationLat = p19.OrderDelivery.Address != null ? p19.OrderDelivery.Address.LocationLat : 0f, - LocationLong = p19.OrderDelivery.Address != null ? p19.OrderDelivery.Address.LocationLong : 0f, - Address = p19.OrderDelivery.Address != null ? p19.OrderDelivery.Address.Address : string.Empty, - PostalCode = p19.OrderDelivery.Address != null ? p19.OrderDelivery.Address.PostalCode : string.Empty, - TrackingCode = p19.OrderDelivery.TrackingCode, - ReceiverPhoneNumber = p19.OrderDelivery.Address != null ? p19.OrderDelivery.Address.ReceiverPhoneNumber : string.Empty, - ReceiverFullName = p19.OrderDelivery.Address != null ? p19.OrderDelivery.Address.ReceiverFullName : string.Empty, - ShippingMethod = p19.OrderDelivery.Shipping != null ? p19.OrderDelivery.Shipping.Name : string.Empty, - DeliveryCost = p19.OrderDelivery.DeliveryCost, - AddressId = p19.OrderDelivery.AddressId, - OrderId = p19.OrderDelivery.OrderId, - ShippingId = p19.OrderDelivery.ShippingId, - Id = p19.OrderDelivery.Id, - CreatedAt = p19.OrderDelivery.CreatedAt + Cost = p19.ProductCost, + Id = p19.ProductId }, + OrderId = p19.OrderId, + Order = new Order() {Id = p19.OrderId}, Id = p19.Id, CreatedAt = p19.CreatedAt + }).ToList(), + Payments = p18.Payments.Select(p20 => new Payment() + { + FactorNumber = p20.FactorNumber, + Amount = p20.Amount, + Description = p20.Description, + TransactionCode = p20.TransactionCode, + CardPan = p20.CardPan, + Authority = p20.Authority, + Type = p20.Type, + Status = p20.Status, + OrderId = p20.OrderId, + Order = new Order() {Id = p20.OrderId}, + CustomerId = p20.CustomerId, + Customer = new Customer() {Id = p20.CustomerId}, + Id = p20.Id, + CreatedAt = p20.CreatedAt + }).ToList(), + Id = p18.Id, + CreatedAt = p18.CreatedAt + }; + public static OrderLDto AdaptToLDto(this Order p21) + { + return p21 == null ? null : new OrderLDto() + { + FactorCode = p21.FactorCode, + TotalPrice = (long)p21.TotalPrice, + DeliveryPrice = (long)p21.DeliveryPrice, + TaxesPrice = (long)p21.TaxesPrice, + 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, + DoneAt = p21.DoneAt, + OrderAt = p21.OrderAt, + PreparingMinute = p21.PreparingMinute, + DiscountCode = p21.DiscountCode, + CustomerId = p21.CustomerId, + CustomerFullName = p21.Customer != null && p21.Customer.User != null ? p21.Customer.User.FirstName + " " + p21.Customer.User.LastName : string.Empty, + CustomerPhoneNumber = p21.Customer != null && p21.Customer.User != null ? p21.Customer.User.PhoneNumber : string.Empty, + OrderProducts = funcMain9(p21.OrderProducts), + Payments = funcMain10(p21.Payments), + OrderDelivery = p21.OrderDelivery == null ? null : new OrderDeliverySDto() + { + Province = p21.OrderDelivery.Address != null ? p21.OrderDelivery.Address.Province : string.Empty, + City = p21.OrderDelivery.Address != null ? p21.OrderDelivery.Address.City : string.Empty, + Plaque = p21.OrderDelivery.Address != null ? p21.OrderDelivery.Address.Plaque : string.Empty, + LocationLat = p21.OrderDelivery.Address != null ? p21.OrderDelivery.Address.LocationLat : 0f, + LocationLong = p21.OrderDelivery.Address != null ? p21.OrderDelivery.Address.LocationLong : 0f, + Address = p21.OrderDelivery.Address != null ? p21.OrderDelivery.Address.Address : string.Empty, + PostalCode = p21.OrderDelivery.Address != null ? p21.OrderDelivery.Address.PostalCode : string.Empty, + TrackingCode = p21.OrderDelivery.TrackingCode, + ReceiverPhoneNumber = p21.OrderDelivery.Address != null ? p21.OrderDelivery.Address.ReceiverPhoneNumber : string.Empty, + ReceiverFullName = p21.OrderDelivery.Address != null ? p21.OrderDelivery.Address.ReceiverFullName : string.Empty, + ShippingMethod = p21.OrderDelivery.Shipping != null ? p21.OrderDelivery.Shipping.Name : string.Empty, + DeliveryCost = p21.OrderDelivery.DeliveryCost, + AddressId = p21.OrderDelivery.AddressId, + OrderId = p21.OrderDelivery.OrderId, + ShippingId = p21.OrderDelivery.ShippingId, + Id = p21.OrderDelivery.Id, + CreatedAt = p21.OrderDelivery.CreatedAt + }, + Id = p21.Id, + CreatedAt = p21.CreatedAt }; } - public static OrderLDto AdaptTo(this Order p22, OrderLDto p23) + public static OrderLDto AdaptTo(this Order p24, OrderLDto p25) { - if (p22 == null) + if (p24 == null) { return null; } - OrderLDto result = p23 ?? new OrderLDto(); + OrderLDto result = p25 ?? new OrderLDto(); - result.FactorCode = p22.FactorCode; - result.TotalPrice = (long)p22.TotalPrice; - result.DeliveryPrice = (long)p22.DeliveryPrice; - result.TaxesPrice = (long)p22.TaxesPrice; - result.ServicePrice = (long)p22.ServicePrice; - result.PackingPrice = (long)p22.PackingPrice; - result.TotalProductsPrice = (long)p22.TotalProductsPrice; - result.DiscountCodePrice = p22.DiscountCodePrice; - result.ProductDiscountPrice = p22.ProductDiscountPrice; - result.DiscountPrice = (long)p22.DiscountPrice; - result.IsPayed = p22.IsPayed; - result.OrderStatus = p22.OrderStatus; - result.DoneAt = p22.DoneAt; - result.OrderAt = p22.OrderAt; - result.PreparingMinute = p22.PreparingMinute; - result.DiscountCode = p22.DiscountCode; - result.CustomerFullName = p22.Customer != null && p22.Customer.User != null ? p22.Customer.User.FirstName + " " + p22.Customer.User.LastName : string.Empty; - result.CustomerPhoneNumber = p22.Customer != null && p22.Customer.User != null ? p22.Customer.User.PhoneNumber : string.Empty; - result.OrderProducts = funcMain10(p22.OrderProducts, result.OrderProducts); - result.Payments = funcMain11(p22.Payments, result.Payments); - result.OrderDelivery = funcMain12(p22.OrderDelivery, result.OrderDelivery); - result.Id = p22.Id; - result.CreatedAt = p22.CreatedAt; + result.FactorCode = p24.FactorCode; + result.TotalPrice = (long)p24.TotalPrice; + result.DeliveryPrice = (long)p24.DeliveryPrice; + result.TaxesPrice = (long)p24.TaxesPrice; + 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; + result.DoneAt = p24.DoneAt; + result.OrderAt = p24.OrderAt; + result.PreparingMinute = p24.PreparingMinute; + result.DiscountCode = p24.DiscountCode; + result.CustomerId = p24.CustomerId; + result.CustomerFullName = p24.Customer != null && p24.Customer.User != null ? p24.Customer.User.FirstName + " " + p24.Customer.User.LastName : string.Empty; + result.CustomerPhoneNumber = p24.Customer != null && p24.Customer.User != null ? p24.Customer.User.PhoneNumber : string.Empty; + result.OrderProducts = funcMain11(p24.OrderProducts, result.OrderProducts); + result.Payments = funcMain12(p24.Payments, result.Payments); + result.OrderDelivery = funcMain13(p24.OrderDelivery, result.OrderDelivery); + result.Id = p24.Id; + result.CreatedAt = p24.CreatedAt; return result; } - public static Expression> ProjectToLDto => p30 => new OrderLDto() + public static Expression> ProjectToLDto => p32 => new OrderLDto() { - FactorCode = p30.FactorCode, - TotalPrice = (long)p30.TotalPrice, - DeliveryPrice = (long)p30.DeliveryPrice, - TaxesPrice = (long)p30.TaxesPrice, - ServicePrice = (long)p30.ServicePrice, - PackingPrice = (long)p30.PackingPrice, - TotalProductsPrice = (long)p30.TotalProductsPrice, - DiscountCodePrice = p30.DiscountCodePrice, - ProductDiscountPrice = p30.ProductDiscountPrice, - DiscountPrice = (long)p30.DiscountPrice, - IsPayed = p30.IsPayed, - OrderStatus = p30.OrderStatus, - DoneAt = p30.DoneAt, - OrderAt = p30.OrderAt, - PreparingMinute = p30.PreparingMinute, - DiscountCode = p30.DiscountCode, - CustomerFullName = p30.Customer != null && p30.Customer.User != null ? p30.Customer.User.FirstName + " " + p30.Customer.User.LastName : string.Empty, - CustomerPhoneNumber = p30.Customer != null && p30.Customer.User != null ? p30.Customer.User.PhoneNumber : string.Empty, - OrderProducts = p30.OrderProducts.Select(p31 => new OrderProductSDto() + FactorCode = p32.FactorCode, + TotalPrice = (long)p32.TotalPrice, + DeliveryPrice = (long)p32.DeliveryPrice, + TaxesPrice = (long)p32.TaxesPrice, + 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, + DoneAt = p32.DoneAt, + OrderAt = p32.OrderAt, + PreparingMinute = p32.PreparingMinute, + DiscountCode = p32.DiscountCode, + CustomerId = p32.CustomerId, + CustomerFullName = p32.Customer != null && p32.Customer.User != null ? p32.Customer.User.FirstName + " " + p32.Customer.User.LastName : string.Empty, + CustomerPhoneNumber = p32.Customer != null && p32.Customer.User != null ? p32.Customer.User.PhoneNumber : string.Empty, + OrderProducts = p32.OrderProducts.Select(p33 => new OrderProductSDto() { - Count = p31.Count, - ProductFee = p31.ProductFee, - ProductFeeWithDiscount = p31.ProductFeeWithDiscount, - HasDiscount = p31.HasDiscount, - ProductCost = p31.ProductCost, - PackingFee = p31.PackingFee, - PackingCost = p31.PackingCost, - OrderProductStatus = p31.OrderProductStatus, - ProductId = p31.ProductId, - ProductName = p31.Product != null ? p31.Product.PersianName : string.Empty, - OrderId = p31.OrderId, - Id = p31.Id, - CreatedAt = p31.CreatedAt - }).ToList(), - Payments = p30.Payments.Select(p32 => new PaymentSDto() - { - FactorNumber = p32.FactorNumber, - Amount = p32.Amount, - Description = p32.Description, - TransactionCode = p32.TransactionCode, - CardPan = p32.CardPan, - Authority = p32.Authority, - Type = p32.Type, - Status = p32.Status, - OrderId = p32.OrderId, - CustomerId = p32.CustomerId, - CustomerFullName = p32.Customer != null && p32.Customer.User != null ? p32.Customer.User.FirstName + " " + p32.Customer.User.LastName : string.Empty, - CustomerPhoneNumber = p32.Customer != null && p32.Customer.User != null ? p32.Customer.User.PhoneNumber : string.Empty, - Id = p32.Id, - CreatedAt = p32.CreatedAt - }).ToList(), - OrderDelivery = p30.OrderDelivery == null ? null : new OrderDeliverySDto() - { - Province = p30.OrderDelivery.Address != null ? p30.OrderDelivery.Address.Province : string.Empty, - City = p30.OrderDelivery.Address != null ? p30.OrderDelivery.Address.City : string.Empty, - Plaque = p30.OrderDelivery.Address != null ? p30.OrderDelivery.Address.Plaque : string.Empty, - LocationLat = p30.OrderDelivery.Address != null ? p30.OrderDelivery.Address.LocationLat : 0f, - LocationLong = p30.OrderDelivery.Address != null ? p30.OrderDelivery.Address.LocationLong : 0f, - Address = p30.OrderDelivery.Address != null ? p30.OrderDelivery.Address.Address : string.Empty, - PostalCode = p30.OrderDelivery.Address != null ? p30.OrderDelivery.Address.PostalCode : string.Empty, - TrackingCode = p30.OrderDelivery.TrackingCode, - ReceiverPhoneNumber = p30.OrderDelivery.Address != null ? p30.OrderDelivery.Address.ReceiverPhoneNumber : string.Empty, - ReceiverFullName = p30.OrderDelivery.Address != null ? p30.OrderDelivery.Address.ReceiverFullName : string.Empty, - ShippingMethod = p30.OrderDelivery.Shipping != null ? p30.OrderDelivery.Shipping.Name : string.Empty, - DeliveryCost = p30.OrderDelivery.DeliveryCost, - AddressId = p30.OrderDelivery.AddressId, - OrderId = p30.OrderDelivery.OrderId, - ShippingId = p30.OrderDelivery.ShippingId, - Id = p30.OrderDelivery.Id, - CreatedAt = p30.OrderDelivery.CreatedAt - }, - Id = p30.Id, - CreatedAt = p30.CreatedAt - }; - public static Order AdaptToOrder(this OrderSDto p33) - { - return p33 == null ? null : new Order() - { - FactorCode = p33.FactorCode, - TotalProductsPrice = p33.TotalProductsPrice, - PackingPrice = p33.PackingPrice, - ServicePrice = p33.ServicePrice, - DeliveryPrice = p33.DeliveryPrice, - DiscountPrice = p33.DiscountPrice, - DiscountCodePrice = p33.DiscountCodePrice, - ProductDiscountPrice = p33.ProductDiscountPrice, - TaxesPrice = p33.TaxesPrice, - TotalPrice = p33.TotalPrice, - IsPayed = p33.IsPayed, - OrderStatus = p33.OrderStatus, - DoneAt = p33.DoneAt, - OrderAt = p33.OrderAt, - PayedAt = p33.PayedAt, - PreparingMinute = p33.PreparingMinute, - DiscountCode = p33.DiscountCode, - CustomerId = p33.CustomerId, - Customer = new Customer() {Id = p33.CustomerId}, + Count = p33.Count, + ProductFee = p33.ProductFee, + ProductFeeWithDiscount = p33.ProductFeeWithDiscount, + HasDiscount = p33.HasDiscount, + ProductCost = p33.ProductCost, + PackingFee = p33.PackingFee, + PackingCost = p33.PackingCost, + OrderProductStatus = p33.OrderProductStatus, + ProductId = p33.ProductId, + ProductName = p33.Product != null ? p33.Product.PersianName : string.Empty, + OrderId = p33.OrderId, Id = p33.Id, CreatedAt = p33.CreatedAt + }).ToList(), + Payments = p32.Payments.Select(p34 => new PaymentSDto() + { + FactorNumber = p34.FactorNumber, + Amount = p34.Amount, + Description = p34.Description, + TransactionCode = p34.TransactionCode, + CardPan = p34.CardPan, + Authority = p34.Authority, + Type = p34.Type, + Status = p34.Status, + OrderId = p34.OrderId, + CustomerId = p34.CustomerId, + CustomerFullName = p34.Customer != null && p34.Customer.User != null ? p34.Customer.User.FirstName + " " + p34.Customer.User.LastName : string.Empty, + CustomerPhoneNumber = p34.Customer != null && p34.Customer.User != null ? p34.Customer.User.PhoneNumber : string.Empty, + Id = p34.Id, + CreatedAt = p34.CreatedAt + }).ToList(), + OrderDelivery = p32.OrderDelivery == null ? null : new OrderDeliverySDto() + { + Province = p32.OrderDelivery.Address != null ? p32.OrderDelivery.Address.Province : string.Empty, + City = p32.OrderDelivery.Address != null ? p32.OrderDelivery.Address.City : string.Empty, + Plaque = p32.OrderDelivery.Address != null ? p32.OrderDelivery.Address.Plaque : string.Empty, + LocationLat = p32.OrderDelivery.Address != null ? p32.OrderDelivery.Address.LocationLat : 0f, + LocationLong = p32.OrderDelivery.Address != null ? p32.OrderDelivery.Address.LocationLong : 0f, + Address = p32.OrderDelivery.Address != null ? p32.OrderDelivery.Address.Address : string.Empty, + PostalCode = p32.OrderDelivery.Address != null ? p32.OrderDelivery.Address.PostalCode : string.Empty, + TrackingCode = p32.OrderDelivery.TrackingCode, + ReceiverPhoneNumber = p32.OrderDelivery.Address != null ? p32.OrderDelivery.Address.ReceiverPhoneNumber : string.Empty, + ReceiverFullName = p32.OrderDelivery.Address != null ? p32.OrderDelivery.Address.ReceiverFullName : string.Empty, + ShippingMethod = p32.OrderDelivery.Shipping != null ? p32.OrderDelivery.Shipping.Name : string.Empty, + DeliveryCost = p32.OrderDelivery.DeliveryCost, + AddressId = p32.OrderDelivery.AddressId, + OrderId = p32.OrderDelivery.OrderId, + ShippingId = p32.OrderDelivery.ShippingId, + Id = p32.OrderDelivery.Id, + CreatedAt = p32.OrderDelivery.CreatedAt + }, + Id = p32.Id, + CreatedAt = p32.CreatedAt + }; + public static Order AdaptToOrder(this OrderSDto p35) + { + return p35 == null ? null : new Order() + { + FactorCode = p35.FactorCode, + TotalProductsPrice = p35.TotalProductsPrice, + PackingPrice = p35.PackingPrice, + ServicePrice = p35.ServicePrice, + DeliveryPrice = p35.DeliveryPrice, + DiscountPrice = p35.DiscountPrice, + DiscountCodePrice = p35.DiscountCodePrice, + ProductDiscountPrice = p35.ProductDiscountPrice, + TaxesPrice = p35.TaxesPrice, + TotalPrice = p35.TotalPrice, + IsPayed = p35.IsPayed, + OrderStatus = p35.OrderStatus, + DoneAt = p35.DoneAt, + OrderAt = p35.OrderAt, + PayedAt = p35.PayedAt, + PreparingMinute = p35.PreparingMinute, + DiscountCode = p35.DiscountCode, + CustomerId = p35.CustomerId, + Customer = new Customer() {Id = p35.CustomerId}, + Id = p35.Id, + CreatedAt = p35.CreatedAt }; } - public static Order AdaptTo(this OrderSDto p34, Order p35) + public static Order AdaptTo(this OrderSDto p36, Order p37) { - if (p34 == null) + if (p36 == null) { return null; } - Order result = p35 ?? new Order(); + Order result = p37 ?? new Order(); - result.FactorCode = p34.FactorCode; - result.TotalProductsPrice = p34.TotalProductsPrice; - result.PackingPrice = p34.PackingPrice; - result.ServicePrice = p34.ServicePrice; - result.DeliveryPrice = p34.DeliveryPrice; - result.DiscountPrice = p34.DiscountPrice; - result.DiscountCodePrice = p34.DiscountCodePrice; - result.ProductDiscountPrice = p34.ProductDiscountPrice; - result.TaxesPrice = p34.TaxesPrice; - result.TotalPrice = p34.TotalPrice; - result.IsPayed = p34.IsPayed; - result.OrderStatus = p34.OrderStatus; - result.DoneAt = p34.DoneAt; - result.OrderAt = p34.OrderAt; - result.PayedAt = p34.PayedAt; - result.PreparingMinute = p34.PreparingMinute; - result.DiscountCode = p34.DiscountCode; - result.CustomerId = p34.CustomerId; - result.Customer = funcMain13(new Never(), result.Customer, p34); - result.Id = p34.Id; - result.CreatedAt = p34.CreatedAt; + result.FactorCode = p36.FactorCode; + result.TotalProductsPrice = p36.TotalProductsPrice; + result.PackingPrice = p36.PackingPrice; + 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; + result.OrderStatus = p36.OrderStatus; + result.DoneAt = p36.DoneAt; + result.OrderAt = p36.OrderAt; + result.PayedAt = p36.PayedAt; + result.PreparingMinute = p36.PreparingMinute; + result.DiscountCode = p36.DiscountCode; + result.CustomerId = p36.CustomerId; + result.Customer = funcMain14(new Never(), result.Customer, p36); + result.Id = p36.Id; + result.CreatedAt = p36.CreatedAt; return result; } - public static OrderSDto AdaptToSDto(this Order p38) + public static OrderSDto AdaptToSDto(this Order p40) { - return p38 == null ? null : new OrderSDto() + return p40 == null ? null : new OrderSDto() { - TotalPrice = p38.TotalPrice, - FactorCode = p38.FactorCode, - DeliveryPrice = p38.DeliveryPrice, - TaxesPrice = p38.TaxesPrice, - ServicePrice = p38.ServicePrice, - PackingPrice = p38.PackingPrice, - TotalProductsPrice = p38.TotalProductsPrice, - DiscountPrice = p38.DiscountPrice, - DiscountCodePrice = p38.DiscountCodePrice, - ProductDiscountPrice = p38.ProductDiscountPrice, - IsPayed = p38.IsPayed, - OrderStatus = p38.OrderStatus, - PayedAt = p38.PayedAt, - DoneAt = p38.DoneAt, - OrderAt = p38.OrderAt, - PreparingMinute = p38.PreparingMinute, - DiscountCode = p38.DiscountCode, - CustomerFullName = p38.Customer != null && p38.Customer.User != null ? p38.Customer.User.FirstName + " " + p38.Customer.User.LastName : string.Empty, - CustomerPhoneNumber = p38.Customer != null && p38.Customer.User != null ? p38.Customer.User.PhoneNumber : string.Empty, - CustomerId = p38.CustomerId, - Id = p38.Id, - CreatedAt = p38.CreatedAt + TotalPrice = p40.TotalPrice, + FactorCode = p40.FactorCode, + DeliveryPrice = p40.DeliveryPrice, + TaxesPrice = p40.TaxesPrice, + ServicePrice = p40.ServicePrice, + PackingPrice = p40.PackingPrice, + TotalProductsPrice = p40.TotalProductsPrice, + DiscountPrice = p40.DiscountPrice, + DiscountCodePrice = p40.DiscountCodePrice, + ProductDiscountPrice = p40.ProductDiscountPrice, + IsPayed = p40.IsPayed, + OrderStatus = p40.OrderStatus, + PayedAt = p40.PayedAt, + DoneAt = p40.DoneAt, + OrderAt = p40.OrderAt, + PreparingMinute = p40.PreparingMinute, + DiscountCode = p40.DiscountCode, + CustomerFullName = p40.Customer != null && p40.Customer.User != null ? p40.Customer.User.FirstName + " " + p40.Customer.User.LastName : string.Empty, + CustomerPhoneNumber = p40.Customer != null && p40.Customer.User != null ? p40.Customer.User.PhoneNumber : string.Empty, + CustomerId = p40.CustomerId, + DeliveryTrackingCode = p40.OrderDelivery != null ? p40.OrderDelivery.TrackingCode : string.Empty, + Id = p40.Id, + CreatedAt = p40.CreatedAt }; } - public static OrderSDto AdaptTo(this Order p39, OrderSDto p40) + public static OrderSDto AdaptTo(this Order p41, OrderSDto p42) { - if (p39 == null) + if (p41 == null) { return null; } - OrderSDto result = p40 ?? new OrderSDto(); + OrderSDto result = p42 ?? new OrderSDto(); - result.TotalPrice = p39.TotalPrice; - result.FactorCode = p39.FactorCode; - result.DeliveryPrice = p39.DeliveryPrice; - result.TaxesPrice = p39.TaxesPrice; - result.ServicePrice = p39.ServicePrice; - result.PackingPrice = p39.PackingPrice; - result.TotalProductsPrice = p39.TotalProductsPrice; - result.DiscountPrice = p39.DiscountPrice; - result.DiscountCodePrice = p39.DiscountCodePrice; - result.ProductDiscountPrice = p39.ProductDiscountPrice; - result.IsPayed = p39.IsPayed; - result.OrderStatus = p39.OrderStatus; - result.PayedAt = p39.PayedAt; - result.DoneAt = p39.DoneAt; - result.OrderAt = p39.OrderAt; - result.PreparingMinute = p39.PreparingMinute; - result.DiscountCode = p39.DiscountCode; - result.CustomerFullName = p39.Customer != null && p39.Customer.User != null ? p39.Customer.User.FirstName + " " + p39.Customer.User.LastName : string.Empty; - result.CustomerPhoneNumber = p39.Customer != null && p39.Customer.User != null ? p39.Customer.User.PhoneNumber : string.Empty; - result.CustomerId = p39.CustomerId; - result.Id = p39.Id; - result.CreatedAt = p39.CreatedAt; + result.TotalPrice = p41.TotalPrice; + result.FactorCode = p41.FactorCode; + result.DeliveryPrice = p41.DeliveryPrice; + result.TaxesPrice = p41.TaxesPrice; + result.ServicePrice = p41.ServicePrice; + 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; + result.DoneAt = p41.DoneAt; + result.OrderAt = p41.OrderAt; + result.PreparingMinute = p41.PreparingMinute; + result.DiscountCode = p41.DiscountCode; + result.CustomerFullName = p41.Customer != null && p41.Customer.User != null ? p41.Customer.User.FirstName + " " + p41.Customer.User.LastName : string.Empty; + result.CustomerPhoneNumber = p41.Customer != null && p41.Customer.User != null ? p41.Customer.User.PhoneNumber : string.Empty; + result.CustomerId = p41.CustomerId; + result.DeliveryTrackingCode = p41.OrderDelivery != null ? p41.OrderDelivery.TrackingCode : string.Empty; + result.Id = p41.Id; + result.CreatedAt = p41.CreatedAt; return result; } - public static Expression> ProjectToSDto => p41 => new OrderSDto() + public static Expression> ProjectToSDto => p43 => new OrderSDto() { - TotalPrice = p41.TotalPrice, - FactorCode = p41.FactorCode, - DeliveryPrice = p41.DeliveryPrice, - TaxesPrice = p41.TaxesPrice, - ServicePrice = p41.ServicePrice, - PackingPrice = p41.PackingPrice, - TotalProductsPrice = p41.TotalProductsPrice, - DiscountPrice = p41.DiscountPrice, - DiscountCodePrice = p41.DiscountCodePrice, - ProductDiscountPrice = p41.ProductDiscountPrice, - IsPayed = p41.IsPayed, - OrderStatus = p41.OrderStatus, - PayedAt = p41.PayedAt, - DoneAt = p41.DoneAt, - OrderAt = p41.OrderAt, - PreparingMinute = p41.PreparingMinute, - DiscountCode = p41.DiscountCode, - CustomerFullName = p41.Customer != null && p41.Customer.User != null ? p41.Customer.User.FirstName + " " + p41.Customer.User.LastName : string.Empty, - CustomerPhoneNumber = p41.Customer != null && p41.Customer.User != null ? p41.Customer.User.PhoneNumber : string.Empty, - CustomerId = p41.CustomerId, - Id = p41.Id, - CreatedAt = p41.CreatedAt + TotalPrice = p43.TotalPrice, + FactorCode = p43.FactorCode, + DeliveryPrice = p43.DeliveryPrice, + TaxesPrice = p43.TaxesPrice, + ServicePrice = p43.ServicePrice, + PackingPrice = p43.PackingPrice, + TotalProductsPrice = p43.TotalProductsPrice, + DiscountPrice = p43.DiscountPrice, + DiscountCodePrice = p43.DiscountCodePrice, + ProductDiscountPrice = p43.ProductDiscountPrice, + IsPayed = p43.IsPayed, + OrderStatus = p43.OrderStatus, + PayedAt = p43.PayedAt, + DoneAt = p43.DoneAt, + OrderAt = p43.OrderAt, + PreparingMinute = p43.PreparingMinute, + DiscountCode = p43.DiscountCode, + CustomerFullName = p43.Customer != null && p43.Customer.User != null ? p43.Customer.User.FirstName + " " + p43.Customer.User.LastName : string.Empty, + CustomerPhoneNumber = p43.Customer != null && p43.Customer.User != null ? p43.Customer.User.PhoneNumber : string.Empty, + CustomerId = p43.CustomerId, + DeliveryTrackingCode = p43.OrderDelivery != null ? p43.OrderDelivery.TrackingCode : string.Empty, + Id = p43.Id, + CreatedAt = p43.CreatedAt }; private static List funcMain1(List p2) @@ -540,42 +552,51 @@ namespace Netina.Domain.Mappers } - private static OrderDelivery funcMain3(OrderDeliverySDto p6, OrderDelivery p7) + private static Customer funcMain3(Never p6, Customer p7, OrderLDto p4) { - if (p6 == null) - { - return null; - } - OrderDelivery result = p7 ?? new OrderDelivery(); + Customer result = p7 ?? new Customer(); - result.AddressId = p6.AddressId; - result.Address = p6.Address == null ? null : (UserAddress)Convert.ChangeType((object)p6.Address, typeof(UserAddress)); - result.DeliveryCost = p6.DeliveryCost; - result.TrackingCode = p6.TrackingCode; - result.ShippingId = p6.ShippingId; - result.Shipping = funcMain4(new Never(), result.Shipping, p6); - result.OrderId = p6.OrderId; - result.Order = funcMain5(new Never(), result.Order, p6); - result.Id = p6.Id; - result.CreatedAt = p6.CreatedAt; + result.Id = p4.CustomerId; return result; } - private static List funcMain6(List p12, List p13) + private static OrderDelivery funcMain4(OrderDeliverySDto p8, OrderDelivery p9) { - if (p12 == null) + if (p8 == null) { return null; } - List result = new List(p12.Count); + OrderDelivery result = p9 ?? new OrderDelivery(); + + result.AddressId = p8.AddressId; + result.Address = p8.Address == null ? null : (UserAddress)Convert.ChangeType((object)p8.Address, typeof(UserAddress)); + result.DeliveryCost = p8.DeliveryCost; + result.TrackingCode = p8.TrackingCode; + result.ShippingId = p8.ShippingId; + result.Shipping = funcMain5(new Never(), result.Shipping, p8); + result.OrderId = p8.OrderId; + result.Order = funcMain6(new Never(), result.Order, p8); + result.Id = p8.Id; + result.CreatedAt = p8.CreatedAt; + return result; + + } + + private static List funcMain7(List p14, List p15) + { + if (p14 == null) + { + return null; + } + List result = new List(p14.Count); int i = 0; - int len = p12.Count; + int len = p14.Count; while (i < len) { - OrderProductSDto item = p12[i]; + OrderProductSDto item = p14[i]; result.Add(item == null ? null : new OrderProduct() { Count = item.Count, @@ -603,20 +624,20 @@ namespace Netina.Domain.Mappers } - private static List funcMain7(List p14, List p15) + private static List funcMain8(List p16, List p17) { - if (p14 == null) + if (p16 == null) { return null; } - List result = new List(p14.Count); + List result = new List(p16.Count); int i = 0; - int len = p14.Count; + int len = p16.Count; while (i < len) { - PaymentSDto item = p14[i]; + PaymentSDto item = p16[i]; result.Add(item == null ? null : new Payment() { FactorNumber = item.FactorNumber, @@ -640,20 +661,20 @@ namespace Netina.Domain.Mappers } - private static List funcMain8(List p20) + private static List funcMain9(List p22) { - if (p20 == null) + if (p22 == null) { return null; } - List result = new List(p20.Count); + List result = new List(p22.Count); int i = 0; - int len = p20.Count; + int len = p22.Count; while (i < len) { - OrderProduct item = p20[i]; + OrderProduct item = p22[i]; result.Add(item == null ? null : new OrderProductSDto() { Count = item.Count, @@ -676,20 +697,20 @@ namespace Netina.Domain.Mappers } - private static List funcMain9(List p21) + private static List funcMain10(List p23) { - if (p21 == null) + if (p23 == null) { return null; } - List result = new List(p21.Count); + List result = new List(p23.Count); int i = 0; - int len = p21.Count; + int len = p23.Count; while (i < len) { - Payment item = p21[i]; + Payment item = p23[i]; result.Add(item == null ? null : new PaymentSDto() { FactorNumber = item.FactorNumber, @@ -713,56 +734,56 @@ namespace Netina.Domain.Mappers } - private static List funcMain10(List p24, List p25) - { - if (p24 == null) - { - return null; - } - List result = new List(p24.Count); - - int i = 0; - int len = p24.Count; - - while (i < len) - { - OrderProduct item = p24[i]; - result.Add(item == null ? null : new OrderProductSDto() - { - Count = item.Count, - ProductFee = item.ProductFee, - ProductFeeWithDiscount = item.ProductFeeWithDiscount, - HasDiscount = item.HasDiscount, - ProductCost = item.ProductCost, - PackingFee = item.PackingFee, - PackingCost = item.PackingCost, - OrderProductStatus = item.OrderProductStatus, - ProductId = item.ProductId, - ProductName = item.Product != null ? item.Product.PersianName : string.Empty, - OrderId = item.OrderId, - Id = item.Id, - CreatedAt = item.CreatedAt - }); - i++; - } - return result; - - } - - private static List funcMain11(List p26, List p27) + private static List funcMain11(List p26, List p27) { if (p26 == null) { return null; } - List result = new List(p26.Count); + List result = new List(p26.Count); int i = 0; int len = p26.Count; while (i < len) { - Payment item = p26[i]; + OrderProduct item = p26[i]; + result.Add(item == null ? null : new OrderProductSDto() + { + Count = item.Count, + ProductFee = item.ProductFee, + ProductFeeWithDiscount = item.ProductFeeWithDiscount, + HasDiscount = item.HasDiscount, + ProductCost = item.ProductCost, + PackingFee = item.PackingFee, + PackingCost = item.PackingCost, + OrderProductStatus = item.OrderProductStatus, + ProductId = item.ProductId, + ProductName = item.Product != null ? item.Product.PersianName : string.Empty, + OrderId = item.OrderId, + Id = item.Id, + CreatedAt = item.CreatedAt + }); + i++; + } + return result; + + } + + private static List funcMain12(List p28, List p29) + { + if (p28 == null) + { + return null; + } + List result = new List(p28.Count); + + int i = 0; + int len = p28.Count; + + while (i < len) + { + Payment item = p28[i]; result.Add(item == null ? null : new PaymentSDto() { FactorNumber = item.FactorNumber, @@ -786,58 +807,58 @@ namespace Netina.Domain.Mappers } - private static OrderDeliverySDto funcMain12(OrderDelivery p28, OrderDeliverySDto p29) + private static OrderDeliverySDto funcMain13(OrderDelivery p30, OrderDeliverySDto p31) { - if (p28 == null) + if (p30 == null) { return null; } - OrderDeliverySDto result = p29 ?? new OrderDeliverySDto(); + OrderDeliverySDto result = p31 ?? new OrderDeliverySDto(); - result.Province = p28.Address != null ? p28.Address.Province : string.Empty; - result.City = p28.Address != null ? p28.Address.City : string.Empty; - result.Plaque = p28.Address != null ? p28.Address.Plaque : string.Empty; - result.LocationLat = p28.Address != null ? p28.Address.LocationLat : 0f; - result.LocationLong = p28.Address != null ? p28.Address.LocationLong : 0f; - result.Address = p28.Address != null ? p28.Address.Address : string.Empty; - result.PostalCode = p28.Address != null ? p28.Address.PostalCode : string.Empty; - result.TrackingCode = p28.TrackingCode; - result.ReceiverPhoneNumber = p28.Address != null ? p28.Address.ReceiverPhoneNumber : string.Empty; - result.ReceiverFullName = p28.Address != null ? p28.Address.ReceiverFullName : string.Empty; - result.ShippingMethod = p28.Shipping != null ? p28.Shipping.Name : string.Empty; - result.DeliveryCost = p28.DeliveryCost; - result.AddressId = p28.AddressId; - result.OrderId = p28.OrderId; - result.ShippingId = p28.ShippingId; - result.Id = p28.Id; - result.CreatedAt = p28.CreatedAt; + result.Province = p30.Address != null ? p30.Address.Province : string.Empty; + result.City = p30.Address != null ? p30.Address.City : string.Empty; + result.Plaque = p30.Address != null ? p30.Address.Plaque : string.Empty; + result.LocationLat = p30.Address != null ? p30.Address.LocationLat : 0f; + result.LocationLong = p30.Address != null ? p30.Address.LocationLong : 0f; + result.Address = p30.Address != null ? p30.Address.Address : string.Empty; + result.PostalCode = p30.Address != null ? p30.Address.PostalCode : string.Empty; + result.TrackingCode = p30.TrackingCode; + result.ReceiverPhoneNumber = p30.Address != null ? p30.Address.ReceiverPhoneNumber : string.Empty; + result.ReceiverFullName = p30.Address != null ? p30.Address.ReceiverFullName : string.Empty; + result.ShippingMethod = p30.Shipping != null ? p30.Shipping.Name : string.Empty; + result.DeliveryCost = p30.DeliveryCost; + result.AddressId = p30.AddressId; + result.OrderId = p30.OrderId; + result.ShippingId = p30.ShippingId; + result.Id = p30.Id; + result.CreatedAt = p30.CreatedAt; return result; } - private static Customer funcMain13(Never p36, Customer p37, OrderSDto p34) + private static Customer funcMain14(Never p38, Customer p39, OrderSDto p36) { - Customer result = p37 ?? new Customer(); + Customer result = p39 ?? new Customer(); - result.Id = p34.CustomerId; + result.Id = p36.CustomerId; return result; } - private static Shipping funcMain4(Never p8, Shipping p9, OrderDeliverySDto p6) + private static Shipping funcMain5(Never p10, Shipping p11, OrderDeliverySDto p8) { - Shipping result = p9 ?? new Shipping(); + Shipping result = p11 ?? new Shipping(); - result.Id = p6.ShippingId; + result.Id = p8.ShippingId; return result; } - private static Order funcMain5(Never p10, Order p11, OrderDeliverySDto p6) + private static Order funcMain6(Never p12, Order p13, OrderDeliverySDto p8) { - Order result = p11 ?? new Order(); + Order result = p13 ?? new Order(); - result.Id = p6.OrderId; + result.Id = p8.OrderId; return result; } diff --git a/Netina.Domain/Mappers/ProductMapper.g.cs b/Netina.Domain/Mappers/ProductMapper.g.cs index 82fa224..1f21a0a 100644 --- a/Netina.Domain/Mappers/ProductMapper.g.cs +++ b/Netina.Domain/Mappers/ProductMapper.g.cs @@ -45,382 +45,400 @@ namespace Netina.Domain.Mappers }, Specifications = funcMain1(p1.Specifications), Files = funcMain2(p1.Files), + MetaTags = funcMain3(p1.MetaTags), Id = p1.Id, CreatedAt = p1.CreatedAt }; } - public static Product AdaptTo(this ProductLDto p4, Product p5) + public static Product AdaptTo(this ProductLDto p5, Product p6) { - if (p4 == null) + if (p5 == null) { return null; } - Product result = p5 ?? new Product(); + Product result = p6 ?? new Product(); - result.PersianName = p4.PersianName; - result.EnglishName = p4.EnglishName; - result.Slug = p4.Slug; - result.Summery = p4.Summery; - result.ExpertCheck = p4.ExpertCheck; - result.Tags = p4.Tags; - result.Warranty = p4.Warranty; - result.Cost = p4.Cost; - result.BeDisplayed = p4.BeDisplayed; - result.PackingCost = p4.PackingCost; - result.Stock = p4.Stock; - result.Rate = p4.Rate; - result.HasExpressDelivery = p4.HasExpressDelivery; - result.MaxOrderCount = p4.MaxOrderCount; - result.BrandId = p4.BrandId; - result.Brand = funcMain3(new Never(), result.Brand, p4); - result.CategoryId = p4.CategoryId; - result.AuthorId = p4.AuthorId; - result.Author = funcMain4(new Never(), result.Author, p4); - result.Category = funcMain5(new Never(), result.Category, p4); - result.Specifications = funcMain6(p4.Specifications, result.Specifications); - result.Files = funcMain7(p4.Files, result.Files); - result.Id = p4.Id; - result.CreatedAt = p4.CreatedAt; + result.PersianName = p5.PersianName; + result.EnglishName = p5.EnglishName; + result.Slug = p5.Slug; + result.Summery = p5.Summery; + result.ExpertCheck = p5.ExpertCheck; + result.Tags = p5.Tags; + result.Warranty = p5.Warranty; + result.Cost = p5.Cost; + result.BeDisplayed = p5.BeDisplayed; + result.PackingCost = p5.PackingCost; + result.Stock = p5.Stock; + result.Rate = p5.Rate; + result.HasExpressDelivery = p5.HasExpressDelivery; + result.MaxOrderCount = p5.MaxOrderCount; + result.BrandId = p5.BrandId; + result.Brand = funcMain4(new Never(), result.Brand, p5); + result.CategoryId = p5.CategoryId; + result.AuthorId = p5.AuthorId; + result.Author = funcMain5(new Never(), result.Author, p5); + result.Category = funcMain6(new Never(), result.Category, p5); + result.Specifications = funcMain7(p5.Specifications, result.Specifications); + result.Files = funcMain8(p5.Files, result.Files); + result.MetaTags = funcMain9(p5.MetaTags, result.MetaTags); + result.Id = p5.Id; + result.CreatedAt = p5.CreatedAt; return result; } - public static Expression> ProjectToProduct => p16 => new Product() + public static Expression> ProjectToProduct => p19 => new Product() { - PersianName = p16.PersianName, - EnglishName = p16.EnglishName, - Slug = p16.Slug, - Summery = p16.Summery, - ExpertCheck = p16.ExpertCheck, - Tags = p16.Tags, - Warranty = p16.Warranty, - Cost = p16.Cost, - BeDisplayed = p16.BeDisplayed, - PackingCost = p16.PackingCost, - Stock = p16.Stock, - Rate = p16.Rate, - HasExpressDelivery = p16.HasExpressDelivery, - MaxOrderCount = p16.MaxOrderCount, - BrandId = p16.BrandId, - Brand = new Brand() {Id = p16.BrandId}, - CategoryId = p16.CategoryId, - AuthorId = p16.AuthorId, - Author = new ApplicationUser() {Id = p16.AuthorId}, + PersianName = p19.PersianName, + EnglishName = p19.EnglishName, + Slug = p19.Slug, + Summery = p19.Summery, + ExpertCheck = p19.ExpertCheck, + Tags = p19.Tags, + Warranty = p19.Warranty, + Cost = p19.Cost, + BeDisplayed = p19.BeDisplayed, + PackingCost = p19.PackingCost, + Stock = p19.Stock, + Rate = p19.Rate, + HasExpressDelivery = p19.HasExpressDelivery, + MaxOrderCount = p19.MaxOrderCount, + BrandId = p19.BrandId, + Brand = new Brand() {Id = p19.BrandId}, + CategoryId = p19.CategoryId, + AuthorId = p19.AuthorId, + Author = new ApplicationUser() {Id = p19.AuthorId}, Category = new ProductCategory() { - Name = p16.CategoryName, - Id = p16.CategoryId + Name = p19.CategoryName, + Id = p19.CategoryId }, - Specifications = p16.Specifications.Select(p17 => new Specification() + Specifications = p19.Specifications.Select(p20 => new Specification() { - Title = p17.Title, - Detail = p17.Detail, - Value = p17.Value, - IsFeature = p17.IsFeature, - ProductId = p17.ProductId, - ParentId = (Guid?)p17.ParentId, - Id = p17.Id, - CreatedAt = p17.CreatedAt + Title = p20.Title, + Detail = p20.Detail, + Value = p20.Value, + IsFeature = p20.IsFeature, + ProductId = p20.ProductId, + ParentId = (Guid?)p20.ParentId, + Id = p20.Id, + CreatedAt = p20.CreatedAt }).ToList(), - Files = p16.Files.Select(p18 => new ProductStorageFile() + Files = p19.Files.Select(p21 => new ProductStorageFile() { - Name = p18.Name, - FileLocation = p18.FileLocation, - FileName = p18.FileName, - IsHeader = p18.IsHeader, - IsPrimary = p18.IsPrimary, - FileType = p18.FileType, - Id = p18.Id, - CreatedAt = p18.CreatedAt + Name = p21.Name, + FileLocation = p21.FileLocation, + FileName = p21.FileName, + IsHeader = p21.IsHeader, + IsPrimary = p21.IsPrimary, + FileType = p21.FileType, + Id = p21.Id, + CreatedAt = p21.CreatedAt }).ToList(), - Id = p16.Id, - CreatedAt = p16.CreatedAt - }; - public static ProductLDto AdaptToLDto(this Product p19) - { - return p19 == null ? null : new ProductLDto() + MetaTags = p19.MetaTags.Select(p22 => new ProductMetaTag() { - PersianName = p19.PersianName, - EnglishName = p19.EnglishName, - Summery = p19.Summery, - ExpertCheck = p19.ExpertCheck, - Tags = p19.Tags, - Slug = p19.Slug, - Warranty = p19.Warranty, - BeDisplayed = p19.BeDisplayed, - HasExpressDelivery = p19.HasExpressDelivery, - Cost = p19.Cost, - PackingCost = p19.PackingCost, - MaxOrderCount = p19.MaxOrderCount, - Stock = p19.Stock, - Rate = (float)(p19.Rate == 0f ? 4.5d : (double)p19.Rate), - CommentCount = p19.ReviewCount, - BrandId = p19.BrandId, - BrandName = p19.Brand == null ? null : p19.Brand.PersianName, - CategoryId = p19.CategoryId, - CategoryName = p19.Category == null ? null : p19.Category.Name, - Specifications = funcMain8(p19.Specifications), - Files = funcMain9(p19.Files), - AuthorId = p19.AuthorId, - AuthorFullName = p19.Author != null ? p19.Author.FirstName + " " + p19.Author.LastName : string.Empty, - Id = p19.Id, - CreatedAt = p19.CreatedAt + Type = p22.Type, + Value = p22.Value, + Id = p22.Id, + CreatedAt = p22.CreatedAt + }).ToList(), + Id = p19.Id, + CreatedAt = p19.CreatedAt + }; + public static ProductLDto AdaptToLDto(this Product p23) + { + return p23 == null ? null : new ProductLDto() + { + PersianName = p23.PersianName, + EnglishName = p23.EnglishName, + Summery = p23.Summery, + ExpertCheck = p23.ExpertCheck, + Tags = p23.Tags, + Slug = p23.Slug, + Warranty = p23.Warranty, + BeDisplayed = p23.BeDisplayed, + HasExpressDelivery = p23.HasExpressDelivery, + Cost = p23.Cost, + PackingCost = p23.PackingCost, + MaxOrderCount = p23.MaxOrderCount, + Stock = p23.Stock, + Rate = (float)(p23.Rate == 0f ? 4.5d : (double)p23.Rate), + CommentCount = p23.ReviewCount, + BrandId = p23.BrandId, + BrandName = p23.Brand == null ? null : p23.Brand.PersianName, + CategoryId = p23.CategoryId, + CategoryName = p23.Category == null ? null : p23.Category.Name, + Specifications = funcMain10(p23.Specifications), + Files = funcMain11(p23.Files), + MetaTags = funcMain12(p23.MetaTags), + AuthorId = p23.AuthorId, + AuthorFullName = p23.Author != null ? p23.Author.FirstName + " " + p23.Author.LastName : string.Empty, + Id = p23.Id, + CreatedAt = p23.CreatedAt }; } - public static ProductLDto AdaptTo(this Product p22, ProductLDto p23) + public static ProductLDto AdaptTo(this Product p27, ProductLDto p28) { - if (p22 == null) + if (p27 == null) { return null; } - ProductLDto result = p23 ?? new ProductLDto(); + ProductLDto result = p28 ?? new ProductLDto(); - result.PersianName = p22.PersianName; - result.EnglishName = p22.EnglishName; - result.Summery = p22.Summery; - result.ExpertCheck = p22.ExpertCheck; - result.Tags = p22.Tags; - result.Slug = p22.Slug; - result.Warranty = p22.Warranty; - result.BeDisplayed = p22.BeDisplayed; - result.HasExpressDelivery = p22.HasExpressDelivery; - result.Cost = p22.Cost; - result.PackingCost = p22.PackingCost; - result.MaxOrderCount = p22.MaxOrderCount; - result.Stock = p22.Stock; - result.Rate = (float)(p22.Rate == 0f ? 4.5d : (double)p22.Rate); - result.CommentCount = p22.ReviewCount; - result.BrandId = p22.BrandId; - result.BrandName = p22.Brand == null ? null : p22.Brand.PersianName; - result.CategoryId = p22.CategoryId; - result.CategoryName = p22.Category == null ? null : p22.Category.Name; - result.Specifications = funcMain10(p22.Specifications, result.Specifications); - result.Files = funcMain11(p22.Files, result.Files); - result.AuthorId = p22.AuthorId; - result.AuthorFullName = p22.Author != null ? p22.Author.FirstName + " " + p22.Author.LastName : string.Empty; - result.Id = p22.Id; - result.CreatedAt = p22.CreatedAt; + result.PersianName = p27.PersianName; + result.EnglishName = p27.EnglishName; + result.Summery = p27.Summery; + result.ExpertCheck = p27.ExpertCheck; + result.Tags = p27.Tags; + result.Slug = p27.Slug; + result.Warranty = p27.Warranty; + result.BeDisplayed = p27.BeDisplayed; + result.HasExpressDelivery = p27.HasExpressDelivery; + result.Cost = p27.Cost; + result.PackingCost = p27.PackingCost; + result.MaxOrderCount = p27.MaxOrderCount; + result.Stock = p27.Stock; + result.Rate = (float)(p27.Rate == 0f ? 4.5d : (double)p27.Rate); + result.CommentCount = p27.ReviewCount; + result.BrandId = p27.BrandId; + result.BrandName = p27.Brand == null ? null : p27.Brand.PersianName; + result.CategoryId = p27.CategoryId; + result.CategoryName = p27.Category == null ? null : p27.Category.Name; + result.Specifications = funcMain13(p27.Specifications, result.Specifications); + result.Files = funcMain14(p27.Files, result.Files); + result.MetaTags = funcMain15(p27.MetaTags, result.MetaTags); + result.AuthorId = p27.AuthorId; + result.AuthorFullName = p27.Author != null ? p27.Author.FirstName + " " + p27.Author.LastName : string.Empty; + result.Id = p27.Id; + result.CreatedAt = p27.CreatedAt; return result; } - public static Expression> ProjectToLDto => p28 => new ProductLDto() + public static Expression> ProjectToLDto => p35 => new ProductLDto() { - PersianName = p28.PersianName, - EnglishName = p28.EnglishName, - Summery = p28.Summery, - ExpertCheck = p28.ExpertCheck, - Tags = p28.Tags, - Slug = p28.Slug, - Warranty = p28.Warranty, - BeDisplayed = p28.BeDisplayed, - HasExpressDelivery = p28.HasExpressDelivery, - Cost = p28.Cost, - PackingCost = p28.PackingCost, - MaxOrderCount = p28.MaxOrderCount, - Stock = p28.Stock, - Rate = (float)(p28.Rate == 0f ? 4.5d : (double)p28.Rate), - CommentCount = p28.ReviewCount, - BrandId = p28.BrandId, - BrandName = p28.Brand == null ? null : p28.Brand.PersianName, - CategoryId = p28.CategoryId, - CategoryName = p28.Category == null ? null : p28.Category.Name, - Specifications = p28.Specifications.Select(p29 => new SpecificationSDto() + PersianName = p35.PersianName, + EnglishName = p35.EnglishName, + Summery = p35.Summery, + ExpertCheck = p35.ExpertCheck, + Tags = p35.Tags, + Slug = p35.Slug, + Warranty = p35.Warranty, + BeDisplayed = p35.BeDisplayed, + HasExpressDelivery = p35.HasExpressDelivery, + Cost = p35.Cost, + PackingCost = p35.PackingCost, + MaxOrderCount = p35.MaxOrderCount, + Stock = p35.Stock, + Rate = (float)(p35.Rate == 0f ? 4.5d : (double)p35.Rate), + CommentCount = p35.ReviewCount, + BrandId = p35.BrandId, + BrandName = p35.Brand == null ? null : p35.Brand.PersianName, + CategoryId = p35.CategoryId, + CategoryName = p35.Category == null ? null : p35.Category.Name, + Specifications = p35.Specifications.Select(p36 => new SpecificationSDto() { - Title = p29.Title, - Detail = p29.Detail, - Value = p29.Value, - IsFeature = p29.IsFeature, - ProductId = p29.ProductId, - ParentId = p29.ParentId == null ? default(Guid) : (Guid)p29.ParentId, - Id = p29.Id, - CreatedAt = p29.CreatedAt + Title = p36.Title, + Detail = p36.Detail, + Value = p36.Value, + IsFeature = p36.IsFeature, + ProductId = p36.ProductId, + ParentId = p36.ParentId == null ? default(Guid) : (Guid)p36.ParentId, + Id = p36.Id, + CreatedAt = p36.CreatedAt }).ToList(), - Files = p28.Files.Select(p30 => new StorageFileSDto() + Files = p35.Files.Select(p37 => new StorageFileSDto() { - Name = p30.Name, - FileLocation = p30.FileLocation, - FileName = p30.FileName, - IsHeader = p30.IsHeader, - IsPrimary = p30.IsPrimary, - FileType = p30.FileType, - Id = p30.Id + Name = p37.Name, + FileLocation = p37.FileLocation, + FileName = p37.FileName, + IsHeader = p37.IsHeader, + IsPrimary = p37.IsPrimary, + FileType = p37.FileType, + Id = p37.Id }).ToList(), - AuthorId = p28.AuthorId, - AuthorFullName = p28.Author != null ? p28.Author.FirstName + " " + p28.Author.LastName : string.Empty, - Id = p28.Id, - CreatedAt = p28.CreatedAt - }; - public static Product AdaptToProduct(this ProductSDto p31) - { - return p31 == null ? null : new Product() + MetaTags = p35.MetaTags.Select(p38 => new MetaTagSDto() { - PersianName = p31.PersianName, - EnglishName = p31.EnglishName, - Slug = p31.Slug, - Summery = p31.Summery, - ExpertCheck = p31.ExpertCheck, - Tags = p31.Tags, - Warranty = p31.Warranty, - Cost = p31.Cost, - IsEnable = p31.IsEnable, - BeDisplayed = p31.BeDisplayed, - PackingCost = p31.PackingCost, - Stock = p31.Stock, - Rate = p31.Rate, - Viewed = p31.Viewed, - MaxOrderCount = p31.MaxOrderCount, - BrandId = p31.BrandId, - Brand = new Brand() {Id = p31.BrandId}, - CategoryId = p31.CategoryId, - AuthorId = p31.AuthorId, - Author = new ApplicationUser() {Id = p31.AuthorId}, + Type = p38.Type, + Value = p38.Value, + Id = p38.Id, + CreatedAt = p38.CreatedAt + }).ToList(), + AuthorId = p35.AuthorId, + AuthorFullName = p35.Author != null ? p35.Author.FirstName + " " + p35.Author.LastName : string.Empty, + Id = p35.Id, + CreatedAt = p35.CreatedAt + }; + public static Product AdaptToProduct(this ProductSDto p39) + { + return p39 == null ? null : new Product() + { + PersianName = p39.PersianName, + EnglishName = p39.EnglishName, + Slug = p39.Slug, + Summery = p39.Summery, + ExpertCheck = p39.ExpertCheck, + Tags = p39.Tags, + Warranty = p39.Warranty, + Cost = p39.Cost, + IsEnable = p39.IsEnable, + BeDisplayed = p39.BeDisplayed, + PackingCost = p39.PackingCost, + Stock = p39.Stock, + Rate = p39.Rate, + Viewed = p39.Viewed, + MaxOrderCount = p39.MaxOrderCount, + BrandId = p39.BrandId, + Brand = new Brand() {Id = p39.BrandId}, + CategoryId = p39.CategoryId, + AuthorId = p39.AuthorId, + Author = new ApplicationUser() {Id = p39.AuthorId}, Category = new ProductCategory() { - Name = p31.CategoryName, - Id = p31.CategoryId + Name = p39.CategoryName, + Id = p39.CategoryId }, - Id = p31.Id, - CreatedAt = p31.CreatedAt, - ModifiedAt = p31.ModifiedAt + Id = p39.Id, + CreatedAt = p39.CreatedAt, + ModifiedAt = p39.ModifiedAt }; } - public static Product AdaptTo(this ProductSDto p32, Product p33) + public static Product AdaptTo(this ProductSDto p40, Product p41) { - if (p32 == null) + if (p40 == null) { return null; } - Product result = p33 ?? new Product(); + Product result = p41 ?? new Product(); - result.PersianName = p32.PersianName; - result.EnglishName = p32.EnglishName; - result.Slug = p32.Slug; - result.Summery = p32.Summery; - result.ExpertCheck = p32.ExpertCheck; - result.Tags = p32.Tags; - result.Warranty = p32.Warranty; - result.Cost = p32.Cost; - result.IsEnable = p32.IsEnable; - result.BeDisplayed = p32.BeDisplayed; - result.PackingCost = p32.PackingCost; - result.Stock = p32.Stock; - result.Rate = p32.Rate; - result.Viewed = p32.Viewed; - result.MaxOrderCount = p32.MaxOrderCount; - result.BrandId = p32.BrandId; - result.Brand = funcMain12(new Never(), result.Brand, p32); - result.CategoryId = p32.CategoryId; - result.AuthorId = p32.AuthorId; - result.Author = funcMain13(new Never(), result.Author, p32); - result.Category = funcMain14(new Never(), result.Category, p32); - result.Id = p32.Id; - result.CreatedAt = p32.CreatedAt; - result.ModifiedAt = p32.ModifiedAt; + result.PersianName = p40.PersianName; + result.EnglishName = p40.EnglishName; + result.Slug = p40.Slug; + result.Summery = p40.Summery; + result.ExpertCheck = p40.ExpertCheck; + result.Tags = p40.Tags; + result.Warranty = p40.Warranty; + result.Cost = p40.Cost; + result.IsEnable = p40.IsEnable; + result.BeDisplayed = p40.BeDisplayed; + result.PackingCost = p40.PackingCost; + result.Stock = p40.Stock; + result.Rate = p40.Rate; + result.Viewed = p40.Viewed; + result.MaxOrderCount = p40.MaxOrderCount; + result.BrandId = p40.BrandId; + result.Brand = funcMain16(new Never(), result.Brand, p40); + result.CategoryId = p40.CategoryId; + result.AuthorId = p40.AuthorId; + result.Author = funcMain17(new Never(), result.Author, p40); + result.Category = funcMain18(new Never(), result.Category, p40); + result.Id = p40.Id; + result.CreatedAt = p40.CreatedAt; + result.ModifiedAt = p40.ModifiedAt; return result; } - public static ProductSDto AdaptToSDto(this Product p40) + public static ProductSDto AdaptToSDto(this Product p48) { - return p40 == null ? null : new ProductSDto() + return p48 == null ? null : new ProductSDto() { - PersianName = p40.PersianName, - Slug = p40.Slug, - EnglishName = p40.EnglishName, - Summery = p40.Summery, - ExpertCheck = p40.ExpertCheck, - Tags = p40.Tags, - Warranty = p40.Warranty, - Cost = p40.Cost, - IsEnable = p40.IsEnable, - Stock = p40.Stock, - MaxOrderCount = p40.MaxOrderCount, - BeDisplayed = p40.BeDisplayed, - PackingCost = p40.PackingCost, - Rate = (float)(p40.Rate == 0f ? 4.5d : (double)p40.Rate), - CommentCount = p40.ReviewCount, - Viewed = p40.Viewed, - MainImage = p40.Files.FirstOrDefault(funcMain15) != null ? p40.Files.FirstOrDefault(funcMain16).FileLocation : (p40.Files.Count > 0 ? p40.Files.FirstOrDefault().FileLocation : string.Empty), - CategoryId = p40.CategoryId, - BrandId = p40.BrandId, - BrandName = p40.Brand == null ? null : p40.Brand.PersianName, - CategoryName = p40.Category == null ? null : p40.Category.Name, - ModifiedAt = p40.ModifiedAt, - AuthorId = p40.AuthorId, - AuthorFullName = p40.Author != null ? p40.Author.FirstName + " " + p40.Author.LastName : string.Empty, - Id = p40.Id, - CreatedAt = p40.CreatedAt + PersianName = p48.PersianName, + Slug = p48.Slug, + EnglishName = p48.EnglishName, + Summery = p48.Summery, + ExpertCheck = p48.ExpertCheck, + Tags = p48.Tags, + Warranty = p48.Warranty, + Cost = p48.Cost, + IsEnable = p48.IsEnable, + Stock = p48.Stock, + MaxOrderCount = p48.MaxOrderCount, + BeDisplayed = p48.BeDisplayed, + PackingCost = p48.PackingCost, + Rate = (float)(p48.Rate == 0f ? 4.5d : (double)p48.Rate), + CommentCount = p48.ReviewCount, + Viewed = p48.Viewed, + MainImage = p48.Files.FirstOrDefault(funcMain19) != null ? p48.Files.FirstOrDefault(funcMain20).FileLocation : (p48.Files.Count > 0 ? p48.Files.FirstOrDefault().FileLocation : string.Empty), + CategoryId = p48.CategoryId, + BrandId = p48.BrandId, + BrandName = p48.Brand == null ? null : p48.Brand.PersianName, + CategoryName = p48.Category == null ? null : p48.Category.Name, + ModifiedAt = p48.ModifiedAt, + AuthorId = p48.AuthorId, + AuthorFullName = p48.Author != null ? p48.Author.FirstName + " " + p48.Author.LastName : string.Empty, + Id = p48.Id, + CreatedAt = p48.CreatedAt }; } - public static ProductSDto AdaptTo(this Product p41, ProductSDto p42) + public static ProductSDto AdaptTo(this Product p49, ProductSDto p50) { - if (p41 == null) + if (p49 == null) { return null; } - ProductSDto result = p42 ?? new ProductSDto(); + ProductSDto result = p50 ?? new ProductSDto(); - result.PersianName = p41.PersianName; - result.Slug = p41.Slug; - result.EnglishName = p41.EnglishName; - result.Summery = p41.Summery; - result.ExpertCheck = p41.ExpertCheck; - result.Tags = p41.Tags; - result.Warranty = p41.Warranty; - result.Cost = p41.Cost; - result.IsEnable = p41.IsEnable; - result.Stock = p41.Stock; - result.MaxOrderCount = p41.MaxOrderCount; - result.BeDisplayed = p41.BeDisplayed; - result.PackingCost = p41.PackingCost; - result.Rate = (float)(p41.Rate == 0f ? 4.5d : (double)p41.Rate); - result.CommentCount = p41.ReviewCount; - result.Viewed = p41.Viewed; - result.MainImage = p41.Files.FirstOrDefault(funcMain15) != null ? p41.Files.FirstOrDefault(funcMain16).FileLocation : (p41.Files.Count > 0 ? p41.Files.FirstOrDefault().FileLocation : string.Empty); - result.CategoryId = p41.CategoryId; - result.BrandId = p41.BrandId; - result.BrandName = p41.Brand == null ? null : p41.Brand.PersianName; - result.CategoryName = p41.Category == null ? null : p41.Category.Name; - result.ModifiedAt = p41.ModifiedAt; - result.AuthorId = p41.AuthorId; - result.AuthorFullName = p41.Author != null ? p41.Author.FirstName + " " + p41.Author.LastName : string.Empty; - result.Id = p41.Id; - result.CreatedAt = p41.CreatedAt; + result.PersianName = p49.PersianName; + result.Slug = p49.Slug; + result.EnglishName = p49.EnglishName; + result.Summery = p49.Summery; + result.ExpertCheck = p49.ExpertCheck; + result.Tags = p49.Tags; + result.Warranty = p49.Warranty; + result.Cost = p49.Cost; + result.IsEnable = p49.IsEnable; + result.Stock = p49.Stock; + result.MaxOrderCount = p49.MaxOrderCount; + result.BeDisplayed = p49.BeDisplayed; + result.PackingCost = p49.PackingCost; + result.Rate = (float)(p49.Rate == 0f ? 4.5d : (double)p49.Rate); + result.CommentCount = p49.ReviewCount; + result.Viewed = p49.Viewed; + result.MainImage = p49.Files.FirstOrDefault(funcMain19) != null ? p49.Files.FirstOrDefault(funcMain20).FileLocation : (p49.Files.Count > 0 ? p49.Files.FirstOrDefault().FileLocation : string.Empty); + result.CategoryId = p49.CategoryId; + result.BrandId = p49.BrandId; + result.BrandName = p49.Brand == null ? null : p49.Brand.PersianName; + result.CategoryName = p49.Category == null ? null : p49.Category.Name; + result.ModifiedAt = p49.ModifiedAt; + result.AuthorId = p49.AuthorId; + result.AuthorFullName = p49.Author != null ? p49.Author.FirstName + " " + p49.Author.LastName : string.Empty; + result.Id = p49.Id; + result.CreatedAt = p49.CreatedAt; return result; } - public static Expression> ProjectToSDto => p43 => new ProductSDto() + public static Expression> ProjectToSDto => p51 => new ProductSDto() { - PersianName = p43.PersianName, - Slug = p43.Slug, - EnglishName = p43.EnglishName, - Summery = p43.Summery, - ExpertCheck = p43.ExpertCheck, - Tags = p43.Tags, - Warranty = p43.Warranty, - Cost = p43.Cost, - IsEnable = p43.IsEnable, - Stock = p43.Stock, - MaxOrderCount = p43.MaxOrderCount, - BeDisplayed = p43.BeDisplayed, - PackingCost = p43.PackingCost, - Rate = (float)(p43.Rate == 0f ? 4.5d : (double)p43.Rate), - CommentCount = p43.ReviewCount, - Viewed = p43.Viewed, - MainImage = p43.Files.FirstOrDefault(f => f.IsPrimary) != null ? p43.Files.FirstOrDefault(f => f.IsPrimary).FileLocation : (p43.Files.Count > 0 ? p43.Files.FirstOrDefault().FileLocation : string.Empty), - CategoryId = p43.CategoryId, - BrandId = p43.BrandId, - BrandName = p43.Brand == null ? null : p43.Brand.PersianName, - CategoryName = p43.Category == null ? null : p43.Category.Name, - ModifiedAt = p43.ModifiedAt, - AuthorId = p43.AuthorId, - AuthorFullName = p43.Author != null ? p43.Author.FirstName + " " + p43.Author.LastName : string.Empty, - Id = p43.Id, - CreatedAt = p43.CreatedAt + PersianName = p51.PersianName, + Slug = p51.Slug, + EnglishName = p51.EnglishName, + Summery = p51.Summery, + ExpertCheck = p51.ExpertCheck, + Tags = p51.Tags, + Warranty = p51.Warranty, + Cost = p51.Cost, + IsEnable = p51.IsEnable, + Stock = p51.Stock, + MaxOrderCount = p51.MaxOrderCount, + BeDisplayed = p51.BeDisplayed, + PackingCost = p51.PackingCost, + Rate = (float)(p51.Rate == 0f ? 4.5d : (double)p51.Rate), + CommentCount = p51.ReviewCount, + Viewed = p51.Viewed, + MainImage = p51.Files.FirstOrDefault(f => f.IsPrimary) != null ? p51.Files.FirstOrDefault(f => f.IsPrimary).FileLocation : (p51.Files.Count > 0 ? p51.Files.FirstOrDefault().FileLocation : string.Empty), + CategoryId = p51.CategoryId, + BrandId = p51.BrandId, + BrandName = p51.Brand == null ? null : p51.Brand.PersianName, + CategoryName = p51.Category == null ? null : p51.Category.Name, + ModifiedAt = p51.ModifiedAt, + AuthorId = p51.AuthorId, + AuthorFullName = p51.Author != null ? p51.Author.FirstName + " " + p51.Author.LastName : string.Empty, + Id = p51.Id, + CreatedAt = p51.CreatedAt }; - public static Expression> ProjectToTorobResponseDto => p44 => new TorobProductResponseDto() + public static Expression> ProjectToTorobResponseDto => p52 => new TorobProductResponseDto() { - product_id = p44.Id.ToString(), - price = p44.Cost, - availibility = p44.IsEnable + product_id = p52.Id.ToString(), + price = p52.Cost, + availibility = p52.IsEnable }; private static List funcMain1(List p2) @@ -485,48 +503,75 @@ namespace Netina.Domain.Mappers } - private static Brand funcMain3(Never p6, Brand p7, ProductLDto p4) + private static List funcMain3(List p4) { - Brand result = p7 ?? new Brand(); - - result.Id = p4.BrandId; - return result; - - } - - private static ApplicationUser funcMain4(Never p8, ApplicationUser p9, ProductLDto p4) - { - ApplicationUser result = p9 ?? new ApplicationUser(); - - result.Id = p4.AuthorId; - return result; - - } - - private static ProductCategory funcMain5(Never p10, ProductCategory p11, ProductLDto p4) - { - ProductCategory result = p11 ?? new ProductCategory(); - - result.Name = p4.CategoryName; - result.Id = p4.CategoryId; - return result; - - } - - private static List funcMain6(List p12, List p13) - { - if (p12 == null) + if (p4 == null) { return null; } - List result = new List(p12.Count); + List result = new List(p4.Count); int i = 0; - int len = p12.Count; + int len = p4.Count; while (i < len) { - SpecificationSDto item = p12[i]; + MetaTagSDto item = p4[i]; + result.Add(item == null ? null : new ProductMetaTag() + { + Type = item.Type, + Value = item.Value, + Id = item.Id, + CreatedAt = item.CreatedAt + }); + i++; + } + return result; + + } + + private static Brand funcMain4(Never p7, Brand p8, ProductLDto p5) + { + Brand result = p8 ?? new Brand(); + + result.Id = p5.BrandId; + return result; + + } + + private static ApplicationUser funcMain5(Never p9, ApplicationUser p10, ProductLDto p5) + { + ApplicationUser result = p10 ?? new ApplicationUser(); + + result.Id = p5.AuthorId; + return result; + + } + + private static ProductCategory funcMain6(Never p11, ProductCategory p12, ProductLDto p5) + { + ProductCategory result = p12 ?? new ProductCategory(); + + result.Name = p5.CategoryName; + result.Id = p5.CategoryId; + return result; + + } + + private static List funcMain7(List p13, List p14) + { + if (p13 == null) + { + return null; + } + List result = new List(p13.Count); + + int i = 0; + int len = p13.Count; + + while (i < len) + { + SpecificationSDto item = p13[i]; result.Add(item == null ? null : new Specification() { Title = item.Title, @@ -544,20 +589,20 @@ namespace Netina.Domain.Mappers } - private static List funcMain7(List p14, List p15) + private static List funcMain8(List p15, List p16) { - if (p14 == null) + if (p15 == null) { return null; } - List result = new List(p14.Count); + List result = new List(p15.Count); int i = 0; - int len = p14.Count; + int len = p15.Count; while (i < len) { - StorageFileSDto item = p14[i]; + StorageFileSDto item = p15[i]; result.Add(item == null ? null : new ProductStorageFile() { Name = item.Name, @@ -575,28 +620,24 @@ namespace Netina.Domain.Mappers } - private static List funcMain8(List p20) + private static List funcMain9(List p17, List p18) { - if (p20 == null) + if (p17 == null) { return null; } - List result = new List(p20.Count); + List result = new List(p17.Count); int i = 0; - int len = p20.Count; + int len = p17.Count; while (i < len) { - Specification item = p20[i]; - result.Add(item == null ? null : new SpecificationSDto() + MetaTagSDto item = p17[i]; + result.Add(item == null ? null : new ProductMetaTag() { - Title = item.Title, - Detail = item.Detail, + Type = item.Type, Value = item.Value, - IsFeature = item.IsFeature, - ProductId = item.ProductId, - ParentId = item.ParentId == null ? default(Guid) : (Guid)item.ParentId, Id = item.Id, CreatedAt = item.CreatedAt }); @@ -606,37 +647,7 @@ namespace Netina.Domain.Mappers } - private static List funcMain9(List p21) - { - if (p21 == null) - { - return null; - } - List result = new List(p21.Count); - - int i = 0; - int len = p21.Count; - - while (i < len) - { - ProductStorageFile item = p21[i]; - result.Add(item == null ? null : new StorageFileSDto() - { - Name = item.Name, - FileLocation = item.FileLocation, - FileName = item.FileName, - IsHeader = item.IsHeader, - IsPrimary = item.IsPrimary, - FileType = item.FileType, - Id = item.Id - }); - i++; - } - return result; - - } - - private static List funcMain10(List p24, List p25) + private static List funcMain10(List p24) { if (p24 == null) { @@ -667,20 +678,20 @@ namespace Netina.Domain.Mappers } - private static List funcMain11(List p26, List p27) + private static List funcMain11(List p25) { - if (p26 == null) + if (p25 == null) { return null; } - List result = new List(p26.Count); + List result = new List(p25.Count); int i = 0; - int len = p26.Count; + int len = p25.Count; while (i < len) { - ProductStorageFile item = p26[i]; + ProductStorageFile item = p25[i]; result.Add(item == null ? null : new StorageFileSDto() { Name = item.Name, @@ -697,40 +708,155 @@ namespace Netina.Domain.Mappers } - private static Brand funcMain12(Never p34, Brand p35, ProductSDto p32) + private static List funcMain12(List p26) { - Brand result = p35 ?? new Brand(); + if (p26 == null) + { + return null; + } + List result = new List(p26.Count); - result.Id = p32.BrandId; + int i = 0; + int len = p26.Count; + + while (i < len) + { + ProductMetaTag item = p26[i]; + result.Add(item == null ? null : new MetaTagSDto() + { + Type = item.Type, + Value = item.Value, + Id = item.Id, + CreatedAt = item.CreatedAt + }); + i++; + } return result; } - private static ApplicationUser funcMain13(Never p36, ApplicationUser p37, ProductSDto p32) + private static List funcMain13(List p29, List p30) { - ApplicationUser result = p37 ?? new ApplicationUser(); + if (p29 == null) + { + return null; + } + List result = new List(p29.Count); - result.Id = p32.AuthorId; + int i = 0; + int len = p29.Count; + + while (i < len) + { + Specification item = p29[i]; + result.Add(item == null ? null : new SpecificationSDto() + { + Title = item.Title, + Detail = item.Detail, + Value = item.Value, + IsFeature = item.IsFeature, + ProductId = item.ProductId, + ParentId = item.ParentId == null ? default(Guid) : (Guid)item.ParentId, + Id = item.Id, + CreatedAt = item.CreatedAt + }); + i++; + } return result; } - private static ProductCategory funcMain14(Never p38, ProductCategory p39, ProductSDto p32) + private static List funcMain14(List p31, List p32) { - ProductCategory result = p39 ?? new ProductCategory(); + if (p31 == null) + { + return null; + } + List result = new List(p31.Count); - result.Name = p32.CategoryName; - result.Id = p32.CategoryId; + int i = 0; + int len = p31.Count; + + while (i < len) + { + ProductStorageFile item = p31[i]; + result.Add(item == null ? null : new StorageFileSDto() + { + Name = item.Name, + FileLocation = item.FileLocation, + FileName = item.FileName, + IsHeader = item.IsHeader, + IsPrimary = item.IsPrimary, + FileType = item.FileType, + Id = item.Id + }); + i++; + } return result; } - private static bool funcMain15(ProductStorageFile f) + private static List funcMain15(List p33, List p34) + { + if (p33 == null) + { + return null; + } + List result = new List(p33.Count); + + int i = 0; + int len = p33.Count; + + while (i < len) + { + ProductMetaTag item = p33[i]; + result.Add(item == null ? null : new MetaTagSDto() + { + Type = item.Type, + Value = item.Value, + Id = item.Id, + CreatedAt = item.CreatedAt + }); + i++; + } + return result; + + } + + private static Brand funcMain16(Never p42, Brand p43, ProductSDto p40) + { + Brand result = p43 ?? new Brand(); + + result.Id = p40.BrandId; + return result; + + } + + private static ApplicationUser funcMain17(Never p44, ApplicationUser p45, ProductSDto p40) + { + ApplicationUser result = p45 ?? new ApplicationUser(); + + result.Id = p40.AuthorId; + return result; + + } + + private static ProductCategory funcMain18(Never p46, ProductCategory p47, ProductSDto p40) + { + ProductCategory result = p47 ?? new ProductCategory(); + + result.Name = p40.CategoryName; + result.Id = p40.CategoryId; + return result; + + } + + private static bool funcMain19(ProductStorageFile f) { return f.IsPrimary; } - private static bool funcMain16(ProductStorageFile f) + private static bool funcMain20(ProductStorageFile f) { return f.IsPrimary; } diff --git a/Netina.Domain/Mappers/ProductMetaTagMapper.g.cs b/Netina.Domain/Mappers/ProductMetaTagMapper.g.cs new file mode 100644 index 0000000..9c28986 --- /dev/null +++ b/Netina.Domain/Mappers/ProductMetaTagMapper.g.cs @@ -0,0 +1,6 @@ +namespace Netina.Domain.Mappers +{ + public static partial class ProductMetaTagMapper + { + } +} \ No newline at end of file diff --git a/Netina.Domain/MapsterRegister.cs b/Netina.Domain/MapsterRegister.cs index 80ebcd1..353223d 100644 --- a/Netina.Domain/MapsterRegister.cs +++ b/Netina.Domain/MapsterRegister.cs @@ -100,6 +100,7 @@ public class MapsterRegister : IRegister config.NewConfig() .Map("CustomerFullName", o => o.Customer != null && o.Customer.User != null ? o.Customer.User.FirstName + " " + o.Customer.User.LastName : string.Empty) .Map("CustomerPhoneNumber", o => o.Customer != null && o.Customer.User != null ? o.Customer.User.PhoneNumber : string.Empty) + .Map(d=>d.DeliveryTrackingCode,o=>o.OrderDelivery!=null ? o.OrderDelivery.TrackingCode : string.Empty) .IgnoreNullValues(false) .TwoWays(); diff --git a/Netina.Domain/Netina.Domain.csproj b/Netina.Domain/Netina.Domain.csproj index e8f885c..e70fb2c 100644 --- a/Netina.Domain/Netina.Domain.csproj +++ b/Netina.Domain/Netina.Domain.csproj @@ -1,6 +1,6 @@  - + - + diff --git a/Netina.Infrastructure/Services/StorageService.cs b/Netina.Infrastructure/Services/StorageService.cs index debf187..d62f183 100644 --- a/Netina.Infrastructure/Services/StorageService.cs +++ b/Netina.Infrastructure/Services/StorageService.cs @@ -81,7 +81,7 @@ public class StorageService(IOptionsSnapshot snapshot) : IStorageS public async Task> GetStorageFiles(StorageFileType fileType) { var client = GetClientAsync(); - ListObjectsRequest request = new() { BucketName = _bucketName}; + ListObjectsV2Request request = new() { BucketName = _bucketName, MaxKeys = 3000 }; switch (fileType) { case StorageFileType.Image: @@ -93,33 +93,22 @@ public class StorageService(IOptionsSnapshot snapshot) : IStorageS default: break; } - var files = new List(); - do + var pagination = client.Paginators.ListObjectsV2(request); + var s3Files = new List(); + await foreach (var listObjectsV2Response in pagination.Responses) { - ListObjectsResponse response = await client.ListObjectsAsync(request); + s3Files.AddRange(listObjectsV2Response.S3Objects); + } - // Process the response. - foreach (var s3Object in response.S3Objects.Where(s=>s.Size>0)) + var files = s3Files + .OrderByDescending(s => s.LastModified) + .Take(100) + .Select(s => new StorageFileSDto { - files.Add(new StorageFileSDto - { - FileLocation = s3Object.Key, - FileName = s3Object.Key.Split('/').Last() - }); - } + FileLocation = s.Key, + FileName = s.Key.Split('/').Last() + }).ToList(); - // If the response is truncated, set the marker to get the next - // set of keys. - if (response.IsTruncated) - { - request.Marker = response.NextMarker; - } - else - { - request = null; - } - } while (request != null); - - return files.OrderByDescending(o=>o.CreatedAt).ToList(); + return files.ToList(); } } \ No newline at end of file diff --git a/Netina.Repository/Handlers/Orders/GetOrderLDtoQueryHandler.cs b/Netina.Repository/Handlers/Orders/GetOrderLDtoQueryHandler.cs index e1f6f63..3145327 100644 --- a/Netina.Repository/Handlers/Orders/GetOrderLDtoQueryHandler.cs +++ b/Netina.Repository/Handlers/Orders/GetOrderLDtoQueryHandler.cs @@ -1,19 +1,35 @@ using Netina.Domain.Entities.Orders; +using Netina.Repository.Abstracts; namespace Netina.Repository.Handlers.Orders; -public class GetOrderLDtoQueryHandler(IRepositoryWrapper repositoryWrapper) +public class GetOrderLDtoQueryHandler(IRepositoryWrapper repositoryWrapper,ICurrentUserService currentUserService) : IRequestHandler { public async Task Handle(GetOrderLDtoQuery request, CancellationToken cancellationToken) { + if (currentUserService.Permissions == null) + throw new BaseApiException(ApiResultStatusCode.UnAuthorized); if (request.Id == default) throw new AppException("Order id is null"); + var order = await repositoryWrapper.SetRepository() .TableNoTracking .Where(o => o.Id == request.Id) .Select(OrderMapper.ProjectToLDto) .FirstOrDefaultAsync(cancellationToken); + if (currentUserService.Permissions.Contains(ApplicationPermission.ViewMineOrders) && !currentUserService.Permissions.Contains(ApplicationPermission.ViewAllOrders)) + { + if (currentUserService.UserId.IsNullOrEmpty() || !Guid.TryParse(currentUserService.UserId, out Guid userId)) + throw new BaseApiException(ApiResultStatusCode.UnAuthorized); + + var customer = await repositoryWrapper.SetRepository() + .TableNoTracking + .FirstOrDefaultAsync(c => c.UserId == userId, cancellationToken); + + if (customer == null || order.CustomerId != customer.Id) + throw new BaseApiException(ApiResultStatusCode.UnAuthorized); + } if (order == null) throw new AppException("Order not found", ApiResultStatusCode.NotFound); return order; diff --git a/Netina.Repository/Handlers/Orders/GetOrderQueryHandler.cs b/Netina.Repository/Handlers/Orders/GetOrderQueryHandler.cs index a3b938d..dc32d04 100644 --- a/Netina.Repository/Handlers/Orders/GetOrderQueryHandler.cs +++ b/Netina.Repository/Handlers/Orders/GetOrderQueryHandler.cs @@ -2,25 +2,25 @@ namespace Netina.Repository.Handlers.Orders; -public class GetOrderQueryHandler(IRepositoryWrapper repositoryWrapper) : IRequestHandler +public class GetOrderQueryHandler(IRepositoryWrapper repositoryWrapper, ICurrentUserService currentUserService) : IRequestHandler { public async Task Handle(GetOrderQuery request, CancellationToken cancellationToken) { + var order = await repositoryWrapper.SetRepository() .TableNoTracking .FirstOrDefaultAsync(o => o.Id == request.Id, cancellationToken); if (order == null) throw new AppException("Order not found", ApiResultStatusCode.NotFound); - var orderProducts = await repositoryWrapper.SetRepository() - .TableNoTracking - .Where(op => op.OrderId == order.Id) - .ToListAsync(cancellationToken); + .TableNoTracking + .Where(op => op.OrderId == order.Id) + .ToListAsync(cancellationToken); orderProducts.ForEach(op => order.AddOrderProduct(op)); - var orderDelivery= await repositoryWrapper.SetRepository() + var orderDelivery = await repositoryWrapper.SetRepository() .TableNoTracking .FirstOrDefaultAsync(od => od.OrderId == request.Id, cancellationToken); if (orderDelivery != null) diff --git a/Netina.Repository/Handlers/Products/CreateProductCommandHandler.cs b/Netina.Repository/Handlers/Products/CreateProductCommandHandler.cs index fd48efd..e70a0c7 100644 --- a/Netina.Repository/Handlers/Products/CreateProductCommandHandler.cs +++ b/Netina.Repository/Handlers/Products/CreateProductCommandHandler.cs @@ -56,6 +56,9 @@ public class CreateProductCommandHandler(IRepositoryWrapper repositoryWrapper,IM await UpdateFaqAsync(ent, request.Faqs, cancellationToken); + foreach (var (key, value) in request.MetaTags) + ent.AddMetaTag(key, value); + return ent.AdaptToLDto(); } diff --git a/Netina.Repository/Handlers/Products/UpdateProductCommandHandler.cs b/Netina.Repository/Handlers/Products/UpdateProductCommandHandler.cs index 90e2240..dedfb97 100644 --- a/Netina.Repository/Handlers/Products/UpdateProductCommandHandler.cs +++ b/Netina.Repository/Handlers/Products/UpdateProductCommandHandler.cs @@ -29,6 +29,7 @@ public class UpdateProductCommandHandler(IRepositoryWrapper repositoryWrapper,IM newEnt.CreatedAt = ent.CreatedAt; newEnt.CreatedBy = ent.CreatedBy; + //Check Specifications var dbSpecifications = await repositoryWrapper.SetRepository().TableNoTracking .Where(s => s.ProductId == ent.Id).ToListAsync(cancellationToken); foreach (var dbSpecification in dbSpecifications) @@ -44,8 +45,22 @@ public class UpdateProductCommandHandler(IRepositoryWrapper repositoryWrapper,IM newEnt.AddSpecification(specification.Title, specification.Detail, specification.Value, specification.IsFeature, specification.ParentId); } + //Check MetaTags + var dbMetaTags = await repositoryWrapper.SetRepository() + .TableNoTracking + .Where(f => f.ProductId == ent.Id) + .ToListAsync(cancellationToken); + foreach (var feature in dbMetaTags.Where(feature => request.MetaTags.Any(f => f.Key == feature.Type) == false)) + { + repositoryWrapper.SetRepository() + .Delete(feature); + await repositoryWrapper.SaveChangesAsync(cancellationToken); + } + foreach (var (key, value) in request.MetaTags.Where(f => dbMetaTags.Any(dbf => dbf.Type == f.Key) == false)) + newEnt.AddMetaTag(key, value); + //Check Files var dbFiles = await repositoryWrapper.SetRepository().TableNoTracking .Where(s => s.ProductId == ent.Id).ToListAsync(cancellationToken); foreach (var dbFile in dbFiles) diff --git a/Netina.Repository/Migrations/20240905093846_AddAuthor.cs b/Netina.Repository/Migrations/20240905093846_AddAuthor.cs index 0a423de..0155dc7 100644 --- a/Netina.Repository/Migrations/20240905093846_AddAuthor.cs +++ b/Netina.Repository/Migrations/20240905093846_AddAuthor.cs @@ -17,7 +17,7 @@ namespace NetinaShop.Repository.Migrations table: "Products", type: "uuid", nullable: false, - defaultValue: new Guid("8723f1d2-e091-4812-9110-5161c9e23586")); + defaultValue: new Guid("11c47231-4f8b-4a73-b848-d2edf3c2d9ab")); migrationBuilder.AddColumn( name: "AuthorId", @@ -25,7 +25,7 @@ namespace NetinaShop.Repository.Migrations table: "Blogs", type: "uuid", nullable: false, - defaultValue: new Guid("8723f1d2-e091-4812-9110-5161c9e23586")); + defaultValue: new Guid("11c47231-4f8b-4a73-b848-d2edf3c2d9ab")); migrationBuilder.CreateIndex( name: "IX_Products_AuthorId", diff --git a/Netina.Repository/Migrations/20241206081338_AddProductMetaTag.Designer.cs b/Netina.Repository/Migrations/20241206081338_AddProductMetaTag.Designer.cs new file mode 100644 index 0000000..30463b8 --- /dev/null +++ b/Netina.Repository/Migrations/20241206081338_AddProductMetaTag.Designer.cs @@ -0,0 +1,2219 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Netina.Repository.Models; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace NetinaShop.Repository.Migrations +{ + [DbContext(typeof(ApplicationContext))] + [Migration("20241206081338_AddProductMetaTag")] + partial class AddProductMetaTag + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("public") + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "fuzzystrmatch"); + NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "pg_trgm"); + 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("Netina.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") + .IsRequired() + .HasColumnType("text"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + 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") + .IsRequired() + .HasColumnType("text"); + + b.Property("OrderId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("TransactionCode") + .IsRequired() + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("OrderId"); + + b.ToTable("Payments", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Blogs.Blog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AuthorId") + .HasColumnType("uuid"); + + b.Property("CategoryId") + .HasColumnType("uuid"); + + b.Property("Content") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("IsSuggested") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ReadingTime") + .HasColumnType("integer"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Slug") + .IsRequired() + .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("AuthorId"); + + b.HasIndex("CategoryId"); + + b.ToTable("Blogs", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .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") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Slug") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.ToTable("BlogCategories", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Brands.Brand", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("EnglishName") + .IsRequired() + .HasColumnType("text"); + + b.Property("HasSpecialPage") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("PageUrl") + .IsRequired() + .HasColumnType("text"); + + b.Property("PersianName") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Slug") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Brands", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Comments.Comment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Content") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("character varying(21)"); + + b.Property("IsAdmin") + .HasColumnType("boolean"); + + b.Property("IsConfirmed") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("IsRoot") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("Rate") + .HasColumnType("real"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.HasIndex("UserId"); + + b.ToTable("Comments", "public"); + + b.HasDiscriminator().HasValue("Comment"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Netina.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") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .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("Immortal") + .HasColumnType("boolean"); + + b.Property("IsForFirstPurchase") + .HasColumnType("boolean"); + + b.Property("IsForInvitation") + .HasColumnType("boolean"); + + b.Property("IsForSaleCooperation") + .HasColumnType("boolean"); + + b.Property("IsInfinity") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("IsSpecialOffer") + .HasColumnType("boolean"); + + b.Property("MarketerId") + .HasColumnType("uuid"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("PriceCeiling") + .HasColumnType("bigint"); + + b.Property("PriceFloor") + .HasColumnType("bigint"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("UseCount") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("MarketerId") + .IsUnique(); + + b.ToTable("Discounts", "public"); + + b.HasDiscriminator().HasValue("Discount"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Orders.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + b.Property("DeliveredAt") + .HasColumnType("timestamp without time zone"); + + 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") + .IsRequired() + .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") + .IsRequired() + .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.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("DiscountId"); + + b.ToTable("Orders", "public"); + }); + + modelBuilder.Entity("Netina.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") + .IsRequired() + .HasColumnType("text"); + + b.Property("DeliveryCost") + .HasColumnType("double precision"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("OrderId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ShippingId") + .HasColumnType("uuid"); + + b.Property("TrackingCode") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AddressId"); + + b.HasIndex("OrderId") + .IsUnique(); + + b.HasIndex("ShippingId"); + + b.ToTable("OrderDeliveries", "public"); + }); + + modelBuilder.Entity("Netina.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") + .IsRequired() + .HasColumnType("text"); + + b.Property("HasDiscount") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .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") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("OrderId"); + + b.HasIndex("ProductId"); + + b.ToTable("OrderProducts", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.ProductCategories.ProductCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .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") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Slug") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.ToTable("ProductCategories", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AuthorId") + .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") + .IsRequired() + .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") + .IsRequired() + .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") + .IsRequired() + .HasColumnType("text"); + + b.Property("ReviewCount") + .HasColumnType("integer"); + + b.Property("Slug") + .IsRequired() + .HasColumnType("text"); + + 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("AuthorId"); + + b.HasIndex("BrandId"); + + b.HasIndex("CategoryId"); + + b.ToTable("Products", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.Specification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .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") + .IsRequired() + .HasColumnType("text"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .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("Netina.Domain.Entities.Seo.MetaTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(34) + .HasColumnType("character varying(34)"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Type") + .IsRequired() + .HasColumnType("text"); + + b.Property("Value") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("MetaTags", "public"); + + b.HasDiscriminator().HasValue("MetaTag"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Netina.Domain.Entities.StorageFiles.StorageFile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .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") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("StorageFiles", "public"); + + b.HasDiscriminator().HasValue("StorageFile"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Netina.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("Netina.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("Netina.Domain.Entities.Users.Customer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("Customers", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.Manager", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("LatestVersionUsed") + .HasColumnType("double precision"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("Managers", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.Marketer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("FatherName") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("LastSettlement") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Shaba") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("Marketers", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.NewsletterMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Email") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("NewsletterMembers", "public"); + }); + + modelBuilder.Entity("Netina.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") + .IsRequired() + .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") + .IsRequired() + .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") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserAddresses", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.UserFavoriteProduct", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ProductId"); + + b.HasIndex("UserId"); + + b.ToTable("UserFavoriteProducts", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Warehouses.Shipping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .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") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("WarehouseName") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkingDays") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("Shippings", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogComment", b => + { + b.HasBaseType("Netina.Domain.Entities.Comments.Comment"); + + b.Property("BlogId") + .HasColumnType("uuid"); + + b.HasIndex("BlogId"); + + b.HasDiscriminator().HasValue("BlogComment"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.ProductComment", b => + { + b.HasBaseType("Netina.Domain.Entities.Comments.Comment"); + + b.Property("IsBuyer") + .HasColumnType("boolean"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.HasIndex("ProductId"); + + b.HasDiscriminator().HasValue("ProductComment"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Discounts.CategoryDiscount", b => + { + b.HasBaseType("Netina.Domain.Entities.Discounts.Discount"); + + b.Property("CategoryId") + .HasColumnType("uuid"); + + b.HasIndex("CategoryId"); + + b.HasDiscriminator().HasValue("CategoryDiscount"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Discounts.ProductDiscount", b => + { + b.HasBaseType("Netina.Domain.Entities.Discounts.Discount"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.HasIndex("ProductId"); + + b.HasDiscriminator().HasValue("ProductDiscount"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.ProductCategories.ProductCategoryMetaTag", b => + { + b.HasBaseType("Netina.Domain.Entities.Seo.MetaTag"); + + b.Property("ProductCategoryId") + .HasColumnType("uuid"); + + b.HasIndex("ProductCategoryId"); + + b.HasDiscriminator().HasValue("ProductCategoryMetaTag"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.ProductMetaTag", b => + { + b.HasBaseType("Netina.Domain.Entities.Seo.MetaTag"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.HasIndex("ProductId"); + + b.HasDiscriminator().HasValue("ProductMetaTag"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogStorageFile", b => + { + b.HasBaseType("Netina.Domain.Entities.StorageFiles.StorageFile"); + + b.Property("BlogId") + .HasColumnType("uuid"); + + b.HasIndex("BlogId"); + + b.HasDiscriminator().HasValue("BlogStorageFile"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Brands.BrandStorageFile", b => + { + b.HasBaseType("Netina.Domain.Entities.StorageFiles.StorageFile"); + + b.Property("BrandId") + .HasColumnType("uuid"); + + b.HasIndex("BrandId"); + + b.HasDiscriminator().HasValue("BrandStorageFile"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.ProductCategories.ProductCategoryStorageFile", b => + { + b.HasBaseType("Netina.Domain.Entities.StorageFiles.StorageFile"); + + b.Property("CategoryId") + .HasColumnType("uuid"); + + b.HasIndex("CategoryId"); + + b.HasDiscriminator().HasValue("ProductCategoryStorageFile"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.ProductStorageFile", b => + { + b.HasBaseType("Netina.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("Netina.Domain.Entities.Users.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Netina.Domain.Entities.Users.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Accounting.Payment", b => + { + b.HasOne("Netina.Domain.Entities.Users.Customer", "Customer") + .WithMany() + .HasForeignKey("CustomerId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Netina.Domain.Entities.Orders.Order", "Order") + .WithMany("Payments") + .HasForeignKey("OrderId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Customer"); + + b.Navigation("Order"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Blogs.Blog", b => + { + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "Author") + .WithMany() + .HasForeignKey("AuthorId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Netina.Domain.Entities.Blogs.BlogCategory", "Category") + .WithMany("Blogs") + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Author"); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogCategory", b => + { + b.HasOne("Netina.Domain.Entities.Blogs.BlogCategory", "Parent") + .WithMany() + .HasForeignKey("ParentId"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Comments.Comment", b => + { + b.HasOne("Netina.Domain.Entities.Comments.Comment", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId"); + + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Parent"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Discounts.Discount", b => + { + b.HasOne("Netina.Domain.Entities.Users.Marketer", "Marketer") + .WithOne("Discount") + .HasForeignKey("Netina.Domain.Entities.Discounts.Discount", "MarketerId"); + + b.Navigation("Marketer"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Orders.Order", b => + { + b.HasOne("Netina.Domain.Entities.Users.Customer", "Customer") + .WithMany() + .HasForeignKey("CustomerId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Netina.Domain.Entities.Discounts.Discount", null) + .WithMany("Orders") + .HasForeignKey("DiscountId"); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Orders.OrderDelivery", b => + { + b.HasOne("Netina.Domain.Entities.Users.UserAddress", "Address") + .WithMany() + .HasForeignKey("AddressId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Netina.Domain.Entities.Orders.Order", "Order") + .WithOne("OrderDelivery") + .HasForeignKey("Netina.Domain.Entities.Orders.OrderDelivery", "OrderId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Netina.Domain.Entities.Warehouses.Shipping", "Shipping") + .WithMany() + .HasForeignKey("ShippingId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Address"); + + b.Navigation("Order"); + + b.Navigation("Shipping"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Orders.OrderProduct", b => + { + b.HasOne("Netina.Domain.Entities.Orders.Order", "Order") + .WithMany("OrderProducts") + .HasForeignKey("OrderId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Netina.Domain.Entities.Products.Product", "Product") + .WithMany("OrderProducts") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Order"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.ProductCategories.ProductCategory", b => + { + b.HasOne("Netina.Domain.Entities.ProductCategories.ProductCategory", "Parent") + .WithMany() + .HasForeignKey("ParentId"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.Product", b => + { + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "Author") + .WithMany() + .HasForeignKey("AuthorId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Netina.Domain.Entities.Brands.Brand", "Brand") + .WithMany("Products") + .HasForeignKey("BrandId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Netina.Domain.Entities.ProductCategories.ProductCategory", "Category") + .WithMany("Products") + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Author"); + + b.Navigation("Brand"); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.Specification", b => + { + b.HasOne("Netina.Domain.Entities.Products.Specification", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId"); + + b.HasOne("Netina.Domain.Entities.Products.Product", "Product") + .WithMany("Specifications") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Parent"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.Customer", b => + { + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") + .WithOne("Customer") + .HasForeignKey("Netina.Domain.Entities.Users.Customer", "UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.Manager", b => + { + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") + .WithOne("Manager") + .HasForeignKey("Netina.Domain.Entities.Users.Manager", "UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.Marketer", b => + { + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") + .WithOne("Marketer") + .HasForeignKey("Netina.Domain.Entities.Users.Marketer", "UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.UserAddress", b => + { + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") + .WithMany("Addresses") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.UserFavoriteProduct", b => + { + b.HasOne("Netina.Domain.Entities.Products.Product", "Product") + .WithMany() + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Product"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogComment", b => + { + b.HasOne("Netina.Domain.Entities.Blogs.Blog", "Blog") + .WithMany() + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.ProductComment", b => + { + b.HasOne("Netina.Domain.Entities.Products.Product", "Product") + .WithMany("Comments") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Discounts.CategoryDiscount", b => + { + b.HasOne("Netina.Domain.Entities.ProductCategories.ProductCategory", "Category") + .WithMany() + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Discounts.ProductDiscount", b => + { + b.HasOne("Netina.Domain.Entities.Products.Product", "Product") + .WithMany() + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.ProductCategories.ProductCategoryMetaTag", b => + { + b.HasOne("Netina.Domain.Entities.ProductCategories.ProductCategory", "ProductCategory") + .WithMany("MetaTags") + .HasForeignKey("ProductCategoryId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("ProductCategory"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.ProductMetaTag", b => + { + b.HasOne("Netina.Domain.Entities.Products.Product", "Product") + .WithMany("MetaTags") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogStorageFile", b => + { + b.HasOne("Netina.Domain.Entities.Blogs.Blog", "Blog") + .WithMany("Files") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Brands.BrandStorageFile", b => + { + b.HasOne("Netina.Domain.Entities.Brands.Brand", "Brand") + .WithMany("Files") + .HasForeignKey("BrandId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Brand"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.ProductCategories.ProductCategoryStorageFile", b => + { + b.HasOne("Netina.Domain.Entities.ProductCategories.ProductCategory", "Category") + .WithMany("Files") + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.ProductStorageFile", b => + { + b.HasOne("Netina.Domain.Entities.Products.Product", "Product") + .WithMany("Files") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Blogs.Blog", b => + { + b.Navigation("Files"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogCategory", b => + { + b.Navigation("Blogs"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Brands.Brand", b => + { + b.Navigation("Files"); + + b.Navigation("Products"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Comments.Comment", b => + { + b.Navigation("Children"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Discounts.Discount", b => + { + b.Navigation("Orders"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Orders.Order", b => + { + b.Navigation("OrderDelivery"); + + b.Navigation("OrderProducts"); + + b.Navigation("Payments"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.ProductCategories.ProductCategory", b => + { + b.Navigation("Files"); + + b.Navigation("MetaTags"); + + b.Navigation("Products"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.Product", b => + { + b.Navigation("Comments"); + + b.Navigation("Files"); + + b.Navigation("MetaTags"); + + b.Navigation("OrderProducts"); + + b.Navigation("Specifications"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.Specification", b => + { + b.Navigation("Children"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.ApplicationUser", b => + { + b.Navigation("Addresses"); + + b.Navigation("Customer"); + + b.Navigation("Manager"); + + b.Navigation("Marketer"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.Marketer", b => + { + b.Navigation("Discount"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Netina.Repository/Migrations/20241206081338_AddProductMetaTag.cs b/Netina.Repository/Migrations/20241206081338_AddProductMetaTag.cs new file mode 100644 index 0000000..a591bb3 --- /dev/null +++ b/Netina.Repository/Migrations/20241206081338_AddProductMetaTag.cs @@ -0,0 +1,57 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace NetinaShop.Repository.Migrations +{ + /// + public partial class AddProductMetaTag : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ProductId", + schema: "public", + table: "MetaTags", + type: "uuid", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_MetaTags_ProductId", + schema: "public", + table: "MetaTags", + column: "ProductId"); + + migrationBuilder.AddForeignKey( + name: "FK_MetaTags_Products_ProductId", + schema: "public", + table: "MetaTags", + column: "ProductId", + principalSchema: "public", + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_MetaTags_Products_ProductId", + schema: "public", + table: "MetaTags"); + + migrationBuilder.DropIndex( + name: "IX_MetaTags_ProductId", + schema: "public", + table: "MetaTags"); + + migrationBuilder.DropColumn( + name: "ProductId", + schema: "public", + table: "MetaTags"); + } + } +} diff --git a/Netina.Repository/Migrations/ApplicationContextModelSnapshot.cs b/Netina.Repository/Migrations/ApplicationContextModelSnapshot.cs index ee8ceea..19fefcf 100644 --- a/Netina.Repository/Migrations/ApplicationContextModelSnapshot.cs +++ b/Netina.Repository/Migrations/ApplicationContextModelSnapshot.cs @@ -1698,6 +1698,18 @@ namespace NetinaShop.Repository.Migrations b.HasDiscriminator().HasValue("ProductCategoryMetaTag"); }); + modelBuilder.Entity("Netina.Domain.Entities.Products.ProductMetaTag", b => + { + b.HasBaseType("Netina.Domain.Entities.Seo.MetaTag"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.HasIndex("ProductId"); + + b.HasDiscriminator().HasValue("ProductMetaTag"); + }); + modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogStorageFile", b => { b.HasBaseType("Netina.Domain.Entities.StorageFiles.StorageFile"); @@ -2070,6 +2082,16 @@ namespace NetinaShop.Repository.Migrations b.Navigation("ProductCategory"); }); + modelBuilder.Entity("Netina.Domain.Entities.Products.ProductMetaTag", b => + { + b.HasOne("Netina.Domain.Entities.Products.Product", "Product") + .WithMany("MetaTags") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Product"); + }); + modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogStorageFile", b => { b.HasOne("Netina.Domain.Entities.Blogs.Blog", "Blog") @@ -2161,6 +2183,8 @@ namespace NetinaShop.Repository.Migrations b.Navigation("Files"); + b.Navigation("MetaTags"); + b.Navigation("OrderProducts"); b.Navigation("Specifications");