diff --git a/src/CMSMicroservice.Domain/Entities/Club/ClubMembership.cs b/src/CMSMicroservice.Domain/Entities/Club/ClubMembership.cs
index e67754b..7f22f28 100644
--- a/src/CMSMicroservice.Domain/Entities/Club/ClubMembership.cs
+++ b/src/CMSMicroservice.Domain/Entities/Club/ClubMembership.cs
@@ -25,34 +25,34 @@ public class ClubMembership : BaseAuditableEntity
///
/// اولین فعالسازی — فقط یک بار ست میشود، هیچوقت overwrite نمیشود
///
- public DateTime FirstActivationDate { get; set; }
+ public DateTime? FirstActivationDate { get; set; }
///
/// اولین پکیج خریداریشده — فقط یک بار ست میشود
///
- public long FirstPackageId { get; set; }
+ public long? FirstPackageId { get; set; }
///
/// FirstPackage Navigation Property
///
- public virtual Package FirstPackage { get; set; }
+ public virtual Package? FirstPackage { get; set; }
///
/// آخرین/جاری فعالسازی — هر خرید مجدد بروزرسانی میشود
/// مبنای تشخیص "فعالشدگان این هفته" (Q22)
///
- public DateTime LastActivationDate { get; set; }
+ public DateTime? LastActivationDate { get; set; }
///
/// آخرین/جاری پکیج — هر خرید مجدد بروزرسانی میشود
/// مبنای carryover per-package (Q23)
///
- public long LastPackageId { get; set; }
+ public long? LastPackageId { get; set; }
///
/// LastPackage Navigation Property
///
- public virtual Package LastPackage { get; set; }
+ public virtual Package? LastPackage { get; set; }
///
/// [DEPRECATED] تاریخ فعالسازی — جایگزین با FirstActivationDate + LastActivationDate
diff --git a/src/CMSMicroservice.Infrastructure/Persistence/Configurations/UserPackagePurchaseConfiguration.cs b/src/CMSMicroservice.Infrastructure/Persistence/Configurations/UserPackagePurchaseConfiguration.cs
index b3bfb8d..736fe02 100644
--- a/src/CMSMicroservice.Infrastructure/Persistence/Configurations/UserPackagePurchaseConfiguration.cs
+++ b/src/CMSMicroservice.Infrastructure/Persistence/Configurations/UserPackagePurchaseConfiguration.cs
@@ -33,7 +33,7 @@ public class UserPackagePurchaseConfiguration : IEntityTypeConfiguration entity.Package)
- .WithMany()
+ .WithMany(p => p.Purchases)
.HasForeignKey(entity => entity.PackageId)
.OnDelete(DeleteBehavior.Restrict);
diff --git a/src/CMSMicroservice.Infrastructure/Persistence/Migrations/20260225191322_AddPackageBasedSystem.Designer.cs b/src/CMSMicroservice.Infrastructure/Persistence/Migrations/20260225191322_AddPackageBasedSystem.Designer.cs
new file mode 100644
index 0000000..375251c
--- /dev/null
+++ b/src/CMSMicroservice.Infrastructure/Persistence/Migrations/20260225191322_AddPackageBasedSystem.Designer.cs
@@ -0,0 +1,5013 @@
+//
+using System;
+using CMSMicroservice.Infrastructure.Persistence;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace CMSMicroservice.Infrastructure.Persistence.Migrations
+{
+ [DbContext(typeof(ApplicationDbContext))]
+ [Migration("20260225191322_AddPackageBasedSystem")]
+ partial class AddPackageBasedSystem
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasDefaultSchema("CMS")
+ .HasAnnotation("ProductVersion", "9.0.11")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.Blog.BlogCategory", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Description")
+ .HasMaxLength(500)
+ .HasColumnType("nvarchar(500)");
+
+ b.Property("IconName")
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.Property("IsActive")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bit")
+ .HasDefaultValue(true);
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LastModified")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifiedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Slug")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.Property("SortOrder")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int")
+ .HasDefaultValue(0);
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("IsActive")
+ .HasDatabaseName("IX_BlogCategories_IsActive");
+
+ b.HasIndex("Slug")
+ .IsUnique()
+ .HasDatabaseName("IX_BlogCategories_Slug");
+
+ b.ToTable("BlogCategories", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.Blog.BlogPost", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("AuthorUserId")
+ .HasColumnType("bigint");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("FeaturedImagePath")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("FeaturedImageThumbnailPath")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("HtmlContent")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("IsFeatured")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bit")
+ .HasDefaultValue(false);
+
+ b.Property("LastModified")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifiedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PublishedAt")
+ .HasColumnType("datetime2");
+
+ b.Property("ScheduledPublishAt")
+ .HasColumnType("datetime2");
+
+ b.Property("Slug")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("nvarchar(200)");
+
+ b.Property("SortOrder")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int")
+ .HasDefaultValue(0);
+
+ b.Property("Status")
+ .HasColumnType("int");
+
+ b.Property("Summary")
+ .HasMaxLength(500)
+ .HasColumnType("nvarchar(500)");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("nvarchar(200)");
+
+ b.Property("ViewCount")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int")
+ .HasDefaultValue(0);
+
+ b.HasKey("Id");
+
+ b.HasIndex("AuthorUserId")
+ .HasDatabaseName("IX_BlogPosts_AuthorUserId");
+
+ b.HasIndex("IsFeatured")
+ .HasDatabaseName("IX_BlogPosts_IsFeatured");
+
+ b.HasIndex("PublishedAt")
+ .HasDatabaseName("IX_BlogPosts_PublishedAt");
+
+ b.HasIndex("Slug")
+ .IsUnique()
+ .HasDatabaseName("IX_BlogPosts_Slug");
+
+ b.HasIndex("Status")
+ .HasDatabaseName("IX_BlogPosts_Status");
+
+ b.HasIndex("Status", "PublishedAt")
+ .HasDatabaseName("IX_BlogPosts_Status_PublishedAt");
+
+ b.ToTable("BlogPosts", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.Blog.BlogPostCategory", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("BlogCategoryId")
+ .HasColumnType("bigint");
+
+ b.Property("BlogPostId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("BlogCategoryId");
+
+ b.HasIndex("BlogPostId");
+
+ b.ToTable("BlogPostCategories", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.Blog.BlogPostImage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("AltText")
+ .HasMaxLength(200)
+ .HasColumnType("nvarchar(200)");
+
+ b.Property("BlogPostId")
+ .HasColumnType("bigint");
+
+ b.Property("Caption")
+ .HasMaxLength(300)
+ .HasColumnType("nvarchar(300)");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ImagePath")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LastModified")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifiedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("SortOrder")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int")
+ .HasDefaultValue(0);
+
+ b.Property("ThumbnailPath")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("BlogPostId");
+
+ b.ToTable("BlogPostImages", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.Blog.BlogPostTag", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("BlogPostId")
+ .HasColumnType("bigint");
+
+ b.Property("TagId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("BlogPostId");
+
+ b.HasIndex("TagId");
+
+ b.ToTable("BlogPostTags", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.Category", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ImagePath")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsActive")
+ .HasColumnType("bit");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LastModified")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifiedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ParentId")
+ .HasColumnType("bigint");
+
+ b.Property("SortOrder")
+ .HasColumnType("int");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ParentId");
+
+ b.ToTable("Categories", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.Club.ClubFeature", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Description")
+ .HasMaxLength(1000)
+ .HasColumnType("nvarchar(1000)");
+
+ b.Property("IsActive")
+ .HasColumnType("bit");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LastModified")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifiedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("SortOrder")
+ .HasColumnType("int");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("nvarchar(200)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("IsActive", "SortOrder")
+ .HasDatabaseName("IX_ClubFeature_IsActive_SortOrder");
+
+ b.ToTable("ClubFeatures", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.Club.ClubMembership", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("ActivatedAt")
+ .HasColumnType("datetime2");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("FirstActivationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("FirstPackageId")
+ .HasColumnType("bigint");
+
+ b.Property("GiftValue")
+ .HasColumnType("bigint");
+
+ b.Property("InitialContribution")
+ .HasColumnType("bigint");
+
+ b.Property("IsActive")
+ .HasColumnType("bit");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LastActivationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModified")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifiedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("LastPackageId")
+ .HasColumnType("bigint");
+
+ b.Property("PurchaseMethod")
+ .HasColumnType("int");
+
+ b.Property("TotalEarned")
+ .HasColumnType("bigint");
+
+ b.Property("UserId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("FirstPackageId");
+
+ b.HasIndex("IsActive")
+ .HasDatabaseName("IX_ClubMembership_IsActive");
+
+ b.HasIndex("LastActivationDate")
+ .HasDatabaseName("IX_ClubMembership_LastActivationDate");
+
+ b.HasIndex("LastPackageId");
+
+ b.HasIndex("UserId")
+ .IsUnique()
+ .HasDatabaseName("IX_ClubMembership_UserId");
+
+ b.ToTable("ClubMemberships", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.Club.ClubMembershipCycle", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("ClubMembershipId")
+ .HasColumnType("bigint");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("CycleNumber")
+ .HasColumnType("int");
+
+ b.Property("IsCurrentCycle")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bit")
+ .HasDefaultValue(false);
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LastModified")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifiedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MagicCompletedAt")
+ .HasColumnType("datetime2");
+
+ b.Property("MagicStartedAt")
+ .HasColumnType("datetime2");
+
+ b.Property("PackageAmount")
+ .HasColumnType("bigint");
+
+ b.Property("PackageId")
+ .HasColumnType("bigint");
+
+ b.Property("PackagePurchasedAt")
+ .HasColumnType("datetime2");
+
+ b.Property("PurchaseMethod")
+ .HasColumnType("int");
+
+ b.Property("UserId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClubMembershipId");
+
+ b.HasIndex("PackageId");
+
+ b.HasIndex("PackagePurchasedAt")
+ .HasDatabaseName("IX_ClubMembershipCycle_PackagePurchasedAt");
+
+ b.HasIndex("UserId", "IsCurrentCycle")
+ .HasDatabaseName("IX_ClubMembershipCycle_UserId_IsCurrentCycle");
+
+ b.ToTable("ClubMembershipCycles", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.Club.UserClubFeature", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("ClubFeatureId")
+ .HasColumnType("bigint");
+
+ b.Property("ClubMembershipId")
+ .HasColumnType("bigint");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("GrantedAt")
+ .HasColumnType("datetime2");
+
+ b.Property("IsActive")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bit")
+ .HasDefaultValue(true);
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LastModified")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifiedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Notes")
+ .HasMaxLength(500)
+ .HasColumnType("nvarchar(500)");
+
+ b.Property("UserId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClubFeatureId");
+
+ b.HasIndex("ClubMembershipId")
+ .HasDatabaseName("IX_UserClubFeature_ClubMembershipId");
+
+ b.HasIndex("UserId", "ClubFeatureId")
+ .IsUnique()
+ .HasDatabaseName("IX_UserClubFeature_UserId_ClubFeatureId");
+
+ b.ToTable("UserClubFeatures", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.Commission.UserCommissionPayout", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("BalancesEarned")
+ .HasColumnType("int");
+
+ b.Property("BankReferenceId")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("BankTrackingCode")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IbanNumber")
+ .HasMaxLength(26)
+ .HasColumnType("nvarchar(26)");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LastModified")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifiedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PackageId")
+ .HasColumnType("bigint");
+
+ b.Property("PaidAt")
+ .HasColumnType("datetime2");
+
+ b.Property("PaymentFailureReason")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ProcessedAt")
+ .HasColumnType("datetime2");
+
+ b.Property("ProcessedBy")
+ .HasMaxLength(200)
+ .HasColumnType("nvarchar(200)");
+
+ b.Property("RejectionReason")
+ .HasMaxLength(500)
+ .HasColumnType("nvarchar(500)");
+
+ b.Property("Status")
+ .HasColumnType("int");
+
+ b.Property("TotalAmount")
+ .HasColumnType("bigint");
+
+ b.Property("UserId")
+ .HasColumnType("bigint");
+
+ b.Property("ValuePerBalance")
+ .HasColumnType("bigint");
+
+ b.Property("WeekDefinitionId")
+ .HasColumnType("bigint");
+
+ b.Property("WeeklyPoolId")
+ .HasColumnType("bigint");
+
+ b.Property("WithdrawalMethod")
+ .HasColumnType("int");
+
+ b.Property("WithdrawnAt")
+ .HasColumnType("datetime2");
+
+ b.HasKey("Id");
+
+ b.HasIndex("PackageId");
+
+ b.HasIndex("Status")
+ .HasDatabaseName("IX_UserCommissionPayout_Status");
+
+ b.HasIndex("WeekDefinitionId");
+
+ b.HasIndex("WeeklyPoolId")
+ .HasDatabaseName("IX_UserCommissionPayout_WeeklyPoolId");
+
+ b.HasIndex("UserId", "WeekDefinitionId", "PackageId")
+ .IsUnique()
+ .HasDatabaseName("IX_UserCommissionPayout_User_WeekDef_Package");
+
+ b.ToTable("UserCommissionPayouts", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.Commission.WeeklyCommissionPool", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("CalculatedAt")
+ .HasColumnType("datetime2");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsCalculated")
+ .HasColumnType("bit");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LastModified")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifiedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PackageId")
+ .HasColumnType("bigint");
+
+ b.Property("TotalBalances")
+ .HasColumnType("int");
+
+ b.Property("TotalPoolAmount")
+ .HasColumnType("bigint");
+
+ b.Property("ValuePerBalance")
+ .HasColumnType("bigint");
+
+ b.Property("WeekDefinitionId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("IsCalculated")
+ .HasDatabaseName("IX_WeeklyCommissionPool_IsCalculated");
+
+ b.HasIndex("PackageId");
+
+ b.HasIndex("WeekDefinitionId", "PackageId")
+ .IsUnique()
+ .HasDatabaseName("IX_WeeklyCommissionPool_WeekDef_Package");
+
+ b.ToTable("WeeklyCommissionPools", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.Commission.WorkerExecutionLog", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("CompletedAt")
+ .HasColumnType("datetime2");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Details")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DurationMs")
+ .HasColumnType("bigint");
+
+ b.Property("ErrorCount")
+ .HasColumnType("int");
+
+ b.Property("ErrorMessage")
+ .HasMaxLength(2000)
+ .HasColumnType("nvarchar(2000)");
+
+ b.Property("ErrorStackTrace")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ExecutionId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LastModified")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifiedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ProcessedCount")
+ .HasColumnType("int");
+
+ b.Property("StartedAt")
+ .HasColumnType("datetime2");
+
+ b.Property("Status")
+ .HasColumnType("int");
+
+ b.Property("WeekDefinitionId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("StartedAt");
+
+ b.HasIndex("Status");
+
+ b.HasIndex("WeekDefinitionId");
+
+ b.ToTable("WorkerExecutionLogs", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.Configuration.AppVersion", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("AppName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("CurrentVersion")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsActive")
+ .HasColumnType("bit");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LastModified")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifiedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MinRequiredVersion")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ReleaseNotes")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("RequiresFullCacheClear")
+ .HasColumnType("bit");
+
+ b.Property("UpdateMessage")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("AppVersions", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.Content.SitePage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("HeroImagePath")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("HeroSubtitle")
+ .HasMaxLength(500)
+ .HasColumnType("nvarchar(500)");
+
+ b.Property("HeroTitle")
+ .HasMaxLength(200)
+ .HasColumnType("nvarchar(200)");
+
+ b.Property("IsActive")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bit")
+ .HasDefaultValue(true);
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LastModified")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifiedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MetaDescription")
+ .HasMaxLength(300)
+ .HasColumnType("nvarchar(300)");
+
+ b.Property("PageKey")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("nvarchar(200)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("PageKey")
+ .IsUnique()
+ .HasDatabaseName("IX_SitePages_PageKey");
+
+ b.ToTable("SitePages", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.Content.SitePageImage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IconName")
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.Property("ImageGroup")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("ImagePath")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsActive")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bit")
+ .HasDefaultValue(true);
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LastModified")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifiedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("LinkUrl")
+ .HasMaxLength(500)
+ .HasColumnType("nvarchar(500)");
+
+ b.Property("SitePageSettingsId")
+ .HasColumnType("bigint");
+
+ b.Property("SortOrder")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int")
+ .HasDefaultValue(0);
+
+ b.Property("Subtitle")
+ .HasMaxLength(300)
+ .HasColumnType("nvarchar(300)");
+
+ b.Property("ThumbnailPath")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Title")
+ .HasMaxLength(200)
+ .HasColumnType("nvarchar(200)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SitePageSettingsId", "ImageGroup")
+ .HasDatabaseName("IX_SitePageImages_SettingsId_Group");
+
+ b.ToTable("SitePageImages", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.Content.SitePageSection", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ExtraData")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("HtmlContent")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IconName")
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.Property("ImagePath")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ImageThumbnailPath")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsActive")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bit")
+ .HasDefaultValue(true);
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LastModified")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifiedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("SectionKey")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.Property("SitePageId")
+ .HasColumnType("bigint");
+
+ b.Property("SortOrder")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int")
+ .HasDefaultValue(0);
+
+ b.Property("Subtitle")
+ .HasMaxLength(300)
+ .HasColumnType("nvarchar(300)");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("nvarchar(200)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SitePageId", "SectionKey")
+ .HasDatabaseName("IX_SitePageSections_PageId_SectionKey");
+
+ b.ToTable("SitePageSections", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.Content.SitePageSettings", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property