- @if (SignInManager.IsSignedIn(User))
+ @if (User.Identity.IsAuthenticated)
{
Subscribe and we'll notify you when the product is back in stock.
diff --git a/src/Modules/SimplCommerce.Module.Core/Extensions/WorkContext.cs b/src/Modules/SimplCommerce.Module.Core/Extensions/WorkContext.cs
index de2b71d59..9829e1788 100644
--- a/src/Modules/SimplCommerce.Module.Core/Extensions/WorkContext.cs
+++ b/src/Modules/SimplCommerce.Module.Core/Extensions/WorkContext.cs
@@ -33,10 +33,7 @@ public WorkContext(UserManager
userManager,
_configuration = configuration;
}
- public string GetCurrentHostName()
- {
- return _httpContext.Request.Host.Value;
- }
+ public string GetCurrentHostName() => _httpContext.Request.Host.Value;
public async Task GetCurrentUser()
{
diff --git a/src/Modules/SimplCommerce.Module.Inventory/Areas/Inventory/Controllers/StockApiController.cs b/src/Modules/SimplCommerce.Module.Inventory/Areas/Inventory/Controllers/StockApiController.cs
index 1d3e60b45..0370f9635 100644
--- a/src/Modules/SimplCommerce.Module.Inventory/Areas/Inventory/Controllers/StockApiController.cs
+++ b/src/Modules/SimplCommerce.Module.Inventory/Areas/Inventory/Controllers/StockApiController.cs
@@ -24,9 +24,9 @@ public class StockApiController : Controller
private readonly IWorkContext _workContext;
private readonly IRepository _warehouseRepository;
private readonly IRepository _stockHistoryRepository;
- private readonly IRepository _backInStockSubscriptionRepository;
+ private readonly IRepository _backInStockSubscriptionRepository;
- public StockApiController(IRepository stockRepository, IStockService stockService, IWorkContext workContext, IRepository warehouseRepository, IRepository stockHistoryRepository, IRepository backInStockSubscriptionRepository, IStockSubscriptionService stockSubscriptionService)
+ public StockApiController(IRepository stockRepository, IStockService stockService, IWorkContext workContext, IRepository warehouseRepository, IRepository stockHistoryRepository, IRepository backInStockSubscriptionRepository, IStockSubscriptionService stockSubscriptionService)
{
_stockRepository = stockRepository;
_stockService = stockService;
@@ -145,13 +145,12 @@ public async Task GetStockHistory(int warehouseId, int productId)
public async Task BackInStockSubscribe(long productId, string customerEmail)
{
if (await _backInStockSubscriptionRepository.Query()
- .Where(o => o.ProductId == productId && o.CustomerEmail == customerEmail)
- .AnyAsync())
+ .AnyAsync(o => o.ProductId == productId && o.CustomerEmail == customerEmail))
{
return Conflict();
}
- await _stockSubscriptionService.BackInStockSubscribeAsync(productId, customerEmail);
+ await _stockSubscriptionService.ProductBackInStockSubscribeAsync(productId, customerEmail);
return Ok();
}
diff --git a/src/Modules/SimplCommerce.Module.Inventory/Areas/Inventory/Views/EmailTemplates/BackInStockEmail.cshtml b/src/Modules/SimplCommerce.Module.Inventory/Areas/Inventory/Views/EmailTemplates/ProductBackInStockEmail.cshtml
similarity index 100%
rename from src/Modules/SimplCommerce.Module.Inventory/Areas/Inventory/Views/EmailTemplates/BackInStockEmail.cshtml
rename to src/Modules/SimplCommerce.Module.Inventory/Areas/Inventory/Views/EmailTemplates/ProductBackInStockEmail.cshtml
diff --git a/src/Modules/SimplCommerce.Module.Inventory/Event/BackInStockSendEmailHandler.cs b/src/Modules/SimplCommerce.Module.Inventory/Event/BackInStockSendEmailHandler.cs
deleted file mode 100644
index e1205dfd6..000000000
--- a/src/Modules/SimplCommerce.Module.Inventory/Event/BackInStockSendEmailHandler.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using MediatR;
-using SimplCommerce.Module.Inventory.Services;
-
-namespace SimplCommerce.Module.Inventory.Event
-{
- public class BackInStockSendEmailHandler : INotificationHandler
- {
- public readonly IStockSubscriptionService _stockSubscriptionService;
-
- public BackInStockSendEmailHandler(IStockSubscriptionService stockSubscriptionService)
- {
- _stockSubscriptionService = stockSubscriptionService;
- }
-
- public async Task Handle(BackInStock notification, CancellationToken cancellationToken)
- {
- await _stockSubscriptionService.BackInStockSendNotificationsAsync(notification.ProductId);
- }
- }
-}
diff --git a/src/Modules/SimplCommerce.Module.Inventory/Event/BackInStock.cs b/src/Modules/SimplCommerce.Module.Inventory/Event/ProductBackInStock.cs
similarity index 82%
rename from src/Modules/SimplCommerce.Module.Inventory/Event/BackInStock.cs
rename to src/Modules/SimplCommerce.Module.Inventory/Event/ProductBackInStock.cs
index fdaef7f6e..d1bd8ffaf 100644
--- a/src/Modules/SimplCommerce.Module.Inventory/Event/BackInStock.cs
+++ b/src/Modules/SimplCommerce.Module.Inventory/Event/ProductBackInStock.cs
@@ -7,7 +7,7 @@
namespace SimplCommerce.Module.Inventory.Event
{
- public class BackInStock : INotification
+ public class ProductBackInStock : INotification
{
public long ProductId { get; set; }
}
diff --git a/src/Modules/SimplCommerce.Module.Inventory/Event/ProductBackInStockSendEmailHandler.cs b/src/Modules/SimplCommerce.Module.Inventory/Event/ProductBackInStockSendEmailHandler.cs
new file mode 100644
index 000000000..e2a9c8441
--- /dev/null
+++ b/src/Modules/SimplCommerce.Module.Inventory/Event/ProductBackInStockSendEmailHandler.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using MediatR;
+using SimplCommerce.Module.Inventory.Services;
+
+namespace SimplCommerce.Module.Inventory.Event
+{
+ public class ProductBackInStockSendEmailHandler : INotificationHandler
+ {
+ public readonly IStockSubscriptionService _stockSubscriptionService;
+
+ public ProductBackInStockSendEmailHandler(IStockSubscriptionService stockSubscriptionService)
+ => _stockSubscriptionService = stockSubscriptionService;
+
+ public async Task Handle(ProductBackInStock notification, CancellationToken cancellationToken)
+ => await _stockSubscriptionService.ProductBackInStockSendNotificationsAsync(notification.ProductId);
+ }
+}
diff --git a/src/Modules/SimplCommerce.Module.Inventory/Models/BackInStockSubscription.cs b/src/Modules/SimplCommerce.Module.Inventory/Models/ProductBackInStockSubscription.cs
similarity index 83%
rename from src/Modules/SimplCommerce.Module.Inventory/Models/BackInStockSubscription.cs
rename to src/Modules/SimplCommerce.Module.Inventory/Models/ProductBackInStockSubscription.cs
index 620a50625..df745367c 100644
--- a/src/Modules/SimplCommerce.Module.Inventory/Models/BackInStockSubscription.cs
+++ b/src/Modules/SimplCommerce.Module.Inventory/Models/ProductBackInStockSubscription.cs
@@ -7,9 +7,10 @@
namespace SimplCommerce.Module.Inventory.Models
{
- public class BackInStockSubscription : EntityBase
+ public class ProductBackInStockSubscription : EntityBase
{
public long ProductId { get; set; }
+
public string CustomerEmail { get; set; }
}
}
diff --git a/src/Modules/SimplCommerce.Module.Inventory/ModuleInitializer.cs b/src/Modules/SimplCommerce.Module.Inventory/ModuleInitializer.cs
index cc07700b5..0a618743a 100644
--- a/src/Modules/SimplCommerce.Module.Inventory/ModuleInitializer.cs
+++ b/src/Modules/SimplCommerce.Module.Inventory/ModuleInitializer.cs
@@ -17,8 +17,7 @@ public void ConfigureServices(IServiceCollection serviceCollection)
{
serviceCollection.AddTransient();
serviceCollection.AddTransient();
- serviceCollection.AddTransient, BackInStockSendEmailHandler>();
-
+ serviceCollection.AddTransient, ProductBackInStockSendEmailHandler>();
GlobalConfiguration.RegisterAngularModule("simplAdmin.inventory");
}
diff --git a/src/Modules/SimplCommerce.Module.Inventory/Services/IStockSubscriptionService.cs b/src/Modules/SimplCommerce.Module.Inventory/Services/IStockSubscriptionService.cs
index 67b7830fa..8abf8a771 100644
--- a/src/Modules/SimplCommerce.Module.Inventory/Services/IStockSubscriptionService.cs
+++ b/src/Modules/SimplCommerce.Module.Inventory/Services/IStockSubscriptionService.cs
@@ -8,8 +8,8 @@ namespace SimplCommerce.Module.Inventory.Services
{
public interface IStockSubscriptionService
{
- Task BackInStockSubscribeAsync(long productId, string customerEmail);
+ Task ProductBackInStockSubscribeAsync(long productId, string customerEmail);
- Task BackInStockSendNotificationsAsync(long productId);
+ Task ProductBackInStockSendNotificationsAsync(long productId);
}
}
diff --git a/src/Modules/SimplCommerce.Module.Inventory/Services/StockService.cs b/src/Modules/SimplCommerce.Module.Inventory/Services/StockService.cs
index 20561c4e2..f1356da93 100644
--- a/src/Modules/SimplCommerce.Module.Inventory/Services/StockService.cs
+++ b/src/Modules/SimplCommerce.Module.Inventory/Services/StockService.cs
@@ -49,7 +49,6 @@ public async Task UpdateStock(StockUpdateRequest stockUpdateRequest)
var stock = await _stockRepository.Query().FirstOrDefaultAsync(x => x.ProductId == stockUpdateRequest.ProductId && x.WarehouseId == stockUpdateRequest.WarehouseId);
var prevStockQuantity = product.StockQuantity;
-
stock.Quantity = stock.Quantity + stockUpdateRequest.AdjustedQuantity;
product.StockQuantity = product.StockQuantity + stockUpdateRequest.AdjustedQuantity;
var stockHistory = new StockHistory
@@ -67,7 +66,7 @@ public async Task UpdateStock(StockUpdateRequest stockUpdateRequest)
if (prevStockQuantity <= 0 && product.StockQuantity > 0)
{
- await _mediator.Publish(new BackInStock { ProductId = product.Id });
+ await _mediator.Publish(new ProductBackInStock { ProductId = product.Id });
}
}
}
diff --git a/src/Modules/SimplCommerce.Module.Inventory/Services/StockSubscriptionService.cs b/src/Modules/SimplCommerce.Module.Inventory/Services/StockSubscriptionService.cs
index 92d4733b2..46c4384fa 100644
--- a/src/Modules/SimplCommerce.Module.Inventory/Services/StockSubscriptionService.cs
+++ b/src/Modules/SimplCommerce.Module.Inventory/Services/StockSubscriptionService.cs
@@ -16,22 +16,22 @@ namespace SimplCommerce.Module.Inventory.Services
{
public class StockSubscriptionService : IStockSubscriptionService
{
- private readonly IRepository _backInStockSubscriptionRepository;
+ private readonly IRepository _productBackInStockSubscriptionRepository;
private readonly IRepository _productRepository;
private readonly IEmailSender _emailSender;
private readonly IRazorViewRenderer _viewRender;
- public StockSubscriptionService(IRepository backInStockSubscriptionRepository, IEmailSender emailSender, IRazorViewRenderer viewRender, IRepository productRepository)
+ public StockSubscriptionService(IRepository backInStockSubscriptionRepository, IEmailSender emailSender, IRazorViewRenderer viewRender, IRepository productRepository)
{
- _backInStockSubscriptionRepository = backInStockSubscriptionRepository;
+ _productBackInStockSubscriptionRepository = backInStockSubscriptionRepository;
_emailSender = emailSender;
_viewRender = viewRender;
_productRepository = productRepository;
}
- public async Task BackInStockSendNotificationsAsync(long productId)
+ public async Task ProductBackInStockSendNotificationsAsync(long productId)
{
- var subscriptions = await _backInStockSubscriptionRepository
+ var subscriptions = await _productBackInStockSubscriptionRepository
.Query()
.Where(o => o.ProductId == productId)
.ToListAsync();
@@ -42,29 +42,30 @@ public async Task BackInStockSendNotificationsAsync(long productId)
.Include(o => o.ThumbnailImage)
.FirstOrDefaultAsync();
- var emailBody = await _viewRender.RenderViewToStringAsync("/Areas/Inventory/Views/EmailTemplates/BackInStockEmail.cshtml", product);
+ var emailBody = await _viewRender.RenderViewToStringAsync("/Areas/Inventory/Views/EmailTemplates/ProductBackInStockEmail.cshtml", product);
var emailSubject = $"Back in stock";
foreach (var subscription in subscriptions)
{
await _emailSender.SendEmailAsync(subscription.CustomerEmail, emailSubject, emailBody, true);
- _backInStockSubscriptionRepository.Remove(subscription);
+ _productBackInStockSubscriptionRepository.Remove(subscription);
}
- await _backInStockSubscriptionRepository.SaveChangesAsync();
+ await _productBackInStockSubscriptionRepository.SaveChangesAsync();
}
- public async Task BackInStockSubscribeAsync(long productId, string customerEmail)
+ public async Task ProductBackInStockSubscribeAsync(long productId, string customerEmail)
{
- var subscription = new BackInStockSubscription
+ var subscription = new ProductBackInStockSubscription
{
ProductId = productId,
CustomerEmail = customerEmail
};
- _backInStockSubscriptionRepository.Add(subscription);
- await _backInStockSubscriptionRepository.SaveChangesAsync();
+ _productBackInStockSubscriptionRepository.Add(subscription);
+
+ await _productBackInStockSubscriptionRepository.SaveChangesAsync();
}
}
}
diff --git a/src/SimplCommerce.WebHost/Migrations/20240311113057_AddedProductBackInStockSubscription.Designer.cs b/src/SimplCommerce.WebHost/Migrations/20240311113057_AddedProductBackInStockSubscription.Designer.cs
new file mode 100644
index 000000000..a84334823
--- /dev/null
+++ b/src/SimplCommerce.WebHost/Migrations/20240311113057_AddedProductBackInStockSubscription.Designer.cs
@@ -0,0 +1,4767 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using SimplCommerce.Module.Core.Data;
+
+#nullable disable
+
+namespace SimplCommerce.WebHost.Migrations
+{
+ [DbContext(typeof(SimplDbContext))]
+ [Migration("20240311113057_AddedProductBackInStockSubscription")]
+ partial class AddedProductBackInStockSubscription
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.0")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("ClaimType")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ClaimValue")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("RoleId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("Core_RoleClaim", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("ClaimType")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ClaimValue")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("UserId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("Core_UserClaim", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
+ {
+ b.Property("LoginProvider")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ProviderKey")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ProviderDisplayName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("UserId")
+ .HasColumnType("bigint");
+
+ b.HasKey("LoginProvider", "ProviderKey");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("Core_UserLogin", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("bigint");
+
+ b.Property("LoginProvider")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Name")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Value")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("Core_UserToken", (string)null);
+ });
+
+ modelBuilder.Entity("SimplCommerce.Infrastructure.Localization.Culture", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Localization_Culture", (string)null);
+
+ b.HasData(
+ new
+ {
+ Id = "en-US",
+ Name = "English (US)"
+ });
+ });
+
+ modelBuilder.Entity("SimplCommerce.Infrastructure.Localization.LocalizedContentProperty", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("CultureId")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("EntityId")
+ .HasColumnType("bigint");
+
+ b.Property("EntityType")
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ProperyName")
+ .IsRequired()
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Value")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CultureId");
+
+ b.ToTable("Localization_LocalizedContentProperty", (string)null);
+ });
+
+ modelBuilder.Entity("SimplCommerce.Infrastructure.Localization.Resource", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("CultureId")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Key")
+ .IsRequired()
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Value")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CultureId");
+
+ b.ToTable("Localization_Resource", (string)null);
+ });
+
+ modelBuilder.Entity("SimplCommerce.Module.ActivityLog.Models.Activity", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("ActivityTypeId")
+ .HasColumnType("bigint");
+
+ b.Property("CreatedOn")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("EntityId")
+ .HasColumnType("bigint");
+
+ b.Property("EntityTypeId")
+ .IsRequired()
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("UserId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ActivityTypeId");
+
+ b.ToTable("ActivityLog_Activity", (string)null);
+ });
+
+ modelBuilder.Entity("SimplCommerce.Module.ActivityLog.Models.ActivityType", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.ToTable("ActivityLog_ActivityType", (string)null);
+
+ b.HasData(
+ new
+ {
+ Id = 1L,
+ Name = "EntityView"
+ });
+ });
+
+ modelBuilder.Entity("SimplCommerce.Module.Catalog.Models.Brand", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("IsPublished")
+ .HasColumnType("bit");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Slug")
+ .IsRequired()
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Catalog_Brand", (string)null);
+ });
+
+ modelBuilder.Entity("SimplCommerce.Module.Catalog.Models.Category", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DisplayOrder")
+ .HasColumnType("int");
+
+ b.Property("IncludeInMenu")
+ .HasColumnType("bit");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("IsPublished")
+ .HasColumnType("bit");
+
+ b.Property("MetaDescription")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MetaKeywords")
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("MetaTitle")
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ParentId")
+ .HasColumnType("bigint");
+
+ b.Property("Slug")
+ .IsRequired()
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ThumbnailImageId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ParentId");
+
+ b.HasIndex("ThumbnailImageId");
+
+ b.ToTable("Catalog_Category", (string)null);
+ });
+
+ modelBuilder.Entity("SimplCommerce.Module.Catalog.Models.Product", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("BrandId")
+ .HasColumnType("bigint");
+
+ b.Property("CreatedById")
+ .HasColumnType("bigint");
+
+ b.Property("CreatedOn")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DisplayOrder")
+ .HasColumnType("int");
+
+ b.Property("Gtin")
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("HasOptions")
+ .HasColumnType("bit");
+
+ b.Property("IsAllowToOrder")
+ .HasColumnType("bit");
+
+ b.Property("IsCallForPricing")
+ .HasColumnType("bit");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("IsFeatured")
+ .HasColumnType("bit");
+
+ b.Property("IsPublished")
+ .HasColumnType("bit");
+
+ b.Property("IsVisibleIndividually")
+ .HasColumnType("bit");
+
+ b.Property("LatestUpdatedById")
+ .HasColumnType("bigint");
+
+ b.Property("LatestUpdatedOn")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("MetaDescription")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MetaKeywords")
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("MetaTitle")
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("NormalizedName")
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("OldPrice")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("Price")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("PublishedOn")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("RatingAverage")
+ .HasColumnType("float");
+
+ b.Property("ReviewsCount")
+ .HasColumnType("int");
+
+ b.Property("ShortDescription")
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Sku")
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Slug")
+ .IsRequired()
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("SpecialPrice")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("SpecialPriceEnd")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("SpecialPriceStart")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("Specification")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("StockQuantity")
+ .HasColumnType("int");
+
+ b.Property("StockTrackingIsEnabled")
+ .HasColumnType("bit");
+
+ b.Property("TaxClassId")
+ .HasColumnType("bigint");
+
+ b.Property("ThumbnailImageId")
+ .HasColumnType("bigint");
+
+ b.Property("VendorId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("BrandId");
+
+ b.HasIndex("CreatedById");
+
+ b.HasIndex("LatestUpdatedById");
+
+ b.HasIndex("TaxClassId");
+
+ b.HasIndex("ThumbnailImageId");
+
+ b.ToTable("Catalog_Product", (string)null);
+ });
+
+ modelBuilder.Entity("SimplCommerce.Module.Catalog.Models.ProductAttribute", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("GroupId")
+ .HasColumnType("bigint");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("GroupId");
+
+ b.ToTable("Catalog_ProductAttribute", (string)null);
+ });
+
+ modelBuilder.Entity("SimplCommerce.Module.Catalog.Models.ProductAttributeGroup", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Catalog_ProductAttributeGroup", (string)null);
+ });
+
+ modelBuilder.Entity("SimplCommerce.Module.Catalog.Models.ProductAttributeValue", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("AttributeId")
+ .HasColumnType("bigint");
+
+ b.Property("ProductId")
+ .HasColumnType("bigint");
+
+ b.Property("Value")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AttributeId");
+
+ b.HasIndex("ProductId");
+
+ b.ToTable("Catalog_ProductAttributeValue", (string)null);
+ });
+
+ modelBuilder.Entity("SimplCommerce.Module.Catalog.Models.ProductCategory", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("CategoryId")
+ .HasColumnType("bigint");
+
+ b.Property("DisplayOrder")
+ .HasColumnType("int");
+
+ b.Property("IsFeaturedProduct")
+ .HasColumnType("bit");
+
+ b.Property("ProductId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CategoryId");
+
+ b.HasIndex("ProductId");
+
+ b.ToTable("Catalog_ProductCategory", (string)null);
+ });
+
+ modelBuilder.Entity("SimplCommerce.Module.Catalog.Models.ProductLink", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("LinkType")
+ .HasColumnType("int");
+
+ b.Property("LinkedProductId")
+ .HasColumnType("bigint");
+
+ b.Property("ProductId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LinkedProductId");
+
+ b.HasIndex("ProductId");
+
+ b.ToTable("Catalog_ProductLink", (string)null);
+ });
+
+ modelBuilder.Entity("SimplCommerce.Module.Catalog.Models.ProductMedia", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("DisplayOrder")
+ .HasColumnType("int");
+
+ b.Property("MediaId")
+ .HasColumnType("bigint");
+
+ b.Property("ProductId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("MediaId");
+
+ b.HasIndex("ProductId");
+
+ b.ToTable("Catalog_ProductMedia", (string)null);
+ });
+
+ modelBuilder.Entity("SimplCommerce.Module.Catalog.Models.ProductOption", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Catalog_ProductOption", (string)null);
+
+ b.HasData(
+ new
+ {
+ Id = 1L,
+ Name = "Color"
+ },
+ new
+ {
+ Id = 2L,
+ Name = "Size"
+ });
+ });
+
+ modelBuilder.Entity("SimplCommerce.Module.Catalog.Models.ProductOptionCombination", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("OptionId")
+ .HasColumnType("bigint");
+
+ b.Property("ProductId")
+ .HasColumnType("bigint");
+
+ b.Property("SortIndex")
+ .HasColumnType("int");
+
+ b.Property("Value")
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("OptionId");
+
+ b.HasIndex("ProductId");
+
+ b.ToTable("Catalog_ProductOptionCombination", (string)null);
+ });
+
+ modelBuilder.Entity("SimplCommerce.Module.Catalog.Models.ProductOptionValue", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("DisplayType")
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("OptionId")
+ .HasColumnType("bigint");
+
+ b.Property("ProductId")
+ .HasColumnType("bigint");
+
+ b.Property("SortIndex")
+ .HasColumnType("int");
+
+ b.Property("Value")
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("OptionId");
+
+ b.HasIndex("ProductId");
+
+ b.ToTable("Catalog_ProductOptionValue", (string)null);
+ });
+
+ modelBuilder.Entity("SimplCommerce.Module.Catalog.Models.ProductPriceHistory", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("CreatedById")
+ .HasColumnType("bigint");
+
+ b.Property("CreatedOn")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("OldPrice")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("Price")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("ProductId")
+ .HasColumnType("bigint");
+
+ b.Property("SpecialPrice")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("SpecialPriceEnd")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("SpecialPriceStart")
+ .HasColumnType("datetimeoffset");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CreatedById");
+
+ b.HasIndex("ProductId");
+
+ b.ToTable("Catalog_ProductPriceHistory", (string)null);
+ });
+
+ modelBuilder.Entity("SimplCommerce.Module.Catalog.Models.ProductTemplate", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Catalog_ProductTemplate", (string)null);
+ });
+
+ modelBuilder.Entity("SimplCommerce.Module.Catalog.Models.ProductTemplateProductAttribute", b =>
+ {
+ b.Property("ProductTemplateId")
+ .HasColumnType("bigint");
+
+ b.Property("ProductAttributeId")
+ .HasColumnType("bigint");
+
+ b.HasKey("ProductTemplateId", "ProductAttributeId");
+
+ b.HasIndex("ProductAttributeId");
+
+ b.ToTable("Catalog_ProductTemplateProductAttribute", (string)null);
+ });
+
+ modelBuilder.Entity("SimplCommerce.Module.Checkouts.Models.Checkout", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("CouponCode")
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("CouponRuleName")
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("CreatedById")
+ .HasColumnType("bigint");
+
+ b.Property("CreatedOn")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("CustomerId")
+ .HasColumnType("bigint");
+
+ b.Property("IsProductPriceIncludeTax")
+ .HasColumnType("bit");
+
+ b.Property("LatestUpdatedOn")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("OrderNote")
+ .HasMaxLength(1000)
+ .HasColumnType("nvarchar(1000)");
+
+ b.Property("ShippingAmount")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("ShippingData")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ShippingMethod")
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("TaxAmount")
+ .HasColumnType("decimal(18,2)");
+
+ b.Property("VendorId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CreatedById");
+
+ b.HasIndex("CustomerId");
+
+ b.ToTable("Checkouts_Checkout", (string)null);
+ });
+
+ modelBuilder.Entity("SimplCommerce.Module.Checkouts.Models.CheckoutItem", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("CheckoutId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("CreatedOn")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("ProductId")
+ .HasColumnType("bigint");
+
+ b.Property("Quantity")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CheckoutId");
+
+ b.HasIndex("ProductId");
+
+ b.ToTable("Checkouts_CheckoutItem", (string)null);
+ });
+
+ modelBuilder.Entity("SimplCommerce.Module.Cms.Models.Menu", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("IsPublished")
+ .HasColumnType("bit");
+
+ b.Property("IsSystem")
+ .HasColumnType("bit");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Cms_Menu", (string)null);
+
+ b.HasData(
+ new
+ {
+ Id = 1L,
+ IsPublished = true,
+ IsSystem = true,
+ Name = "Customer Services"
+ },
+ new
+ {
+ Id = 2L,
+ IsPublished = true,
+ IsSystem = true,
+ Name = "Information"
+ });
+ });
+
+ modelBuilder.Entity("SimplCommerce.Module.Cms.Models.MenuItem", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("CustomLink")
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("DisplayOrder")
+ .HasColumnType("int");
+
+ b.Property("EntityId")
+ .HasColumnType("bigint");
+
+ b.Property("MenuId")
+ .HasColumnType("bigint");
+
+ b.Property("Name")
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ParentId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("EntityId");
+
+ b.HasIndex("MenuId");
+
+ b.HasIndex("ParentId");
+
+ b.ToTable("Cms_MenuItem", (string)null);
+ });
+
+ modelBuilder.Entity("SimplCommerce.Module.Cms.Models.Page", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Body")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("CreatedById")
+ .HasColumnType("bigint");
+
+ b.Property("CreatedOn")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("IsPublished")
+ .HasColumnType("bit");
+
+ b.Property("LatestUpdatedById")
+ .HasColumnType("bigint");
+
+ b.Property("LatestUpdatedOn")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("MetaDescription")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MetaKeywords")
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("MetaTitle")
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("PublishedOn")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("Slug")
+ .IsRequired()
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CreatedById");
+
+ b.HasIndex("LatestUpdatedById");
+
+ b.ToTable("Cms_Page", (string)null);
+ });
+
+ modelBuilder.Entity("SimplCommerce.Module.Comments.Models.Comment", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("CommentText")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("CommenterName")
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("CreatedOn")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("EntityId")
+ .HasColumnType("bigint");
+
+ b.Property("EntityTypeId")
+ .HasMaxLength(450)
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ParentId")
+ .HasColumnType("bigint");
+
+ b.Property("Status")
+ .HasColumnType("int");
+
+ b.Property