Refactor product filtering logic and add database migration for categories and tags

This commit is contained in:
masoodafar-web
2025-11-20 20:06:01 +03:30
parent 69ab91fb2b
commit b15ec93aa1
5 changed files with 1792 additions and 4 deletions

View File

@@ -23,6 +23,59 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Category", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<DateTime>("Created")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.HasColumnType("nvarchar(max)");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("ImagePath")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsActive")
.HasColumnType("bit");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<DateTime?>("LastModified")
.HasColumnType("datetime2");
b.Property<string>("LastModifiedBy")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<long?>("ParentId")
.HasColumnType("bigint");
b.Property<int>("SortOrder")
.HasColumnType("int");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("ParentId");
b.ToTable("Categorys", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Contract", b =>
{
b.Property<long>("Id")
@@ -359,6 +412,82 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.ToTable("Productss", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.PruductCategory", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<long>("CategoryId")
.HasColumnType("bigint");
b.Property<DateTime>("Created")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<DateTime?>("LastModified")
.HasColumnType("datetime2");
b.Property<string>("LastModifiedBy")
.HasColumnType("nvarchar(max)");
b.Property<long>("ProductId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("CategoryId");
b.HasIndex("ProductId");
b.ToTable("PruductCategorys", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.PruductTag", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<DateTime>("Created")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<DateTime?>("LastModified")
.HasColumnType("datetime2");
b.Property<string>("LastModifiedBy")
.HasColumnType("nvarchar(max)");
b.Property<long>("ProductId")
.HasColumnType("bigint");
b.Property<long>("TagId")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("ProductId");
b.HasIndex("TagId");
b.ToTable("PruductTags", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Role", b =>
{
b.Property<long>("Id")
@@ -395,6 +524,51 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.ToTable("Roles", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Tag", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<DateTime>("Created")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.HasColumnType("nvarchar(max)");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsActive")
.HasColumnType("bit");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<DateTime?>("LastModified")
.HasColumnType("datetime2");
b.Property<string>("LastModifiedBy")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("SortOrder")
.HasColumnType("int");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Tags", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Transactions", b =>
{
b.Property<long>("Id")
@@ -883,6 +1057,15 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.ToTable("UserWalletChangeLogs", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Category", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.Category", "Parent")
.WithMany("Categorys")
.HasForeignKey("ParentId");
b.Navigation("Parent");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.FactorDetails", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.UserOrder", "Order")
@@ -921,6 +1104,44 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.Navigation("ProductImage");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.PruductCategory", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.Category", "Category")
.WithMany("PruductCategorys")
.HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CMSMicroservice.Domain.Entities.Products", "Product")
.WithMany("PruductCategorys")
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Category");
b.Navigation("Product");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.PruductTag", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.Products", "Product")
.WithMany("PruductTags")
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CMSMicroservice.Domain.Entities.Tag", "Tag")
.WithMany("PruductTags")
.HasForeignKey("TagId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Product");
b.Navigation("Tag");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Transactions", b =>
{
b.HasOne("CMSMicroservice.Domain.Entities.UserOrder", "Order")
@@ -1056,6 +1277,13 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.Navigation("Wallet");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Category", b =>
{
b.Navigation("Categorys");
b.Navigation("PruductCategorys");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Contract", b =>
{
b.Navigation("UserContracts");
@@ -1077,6 +1305,10 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.Navigation("ProductGalleryss");
b.Navigation("PruductCategorys");
b.Navigation("PruductTags");
b.Navigation("UserCartss");
});
@@ -1085,6 +1317,11 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.Navigation("UserRoles");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Tag", b =>
{
b.Navigation("PruductTags");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.User", b =>
{
b.Navigation("UserAddresss");