diff --git a/src/CMSMicroservice.Application/AppVersionCQ/Commands/UpdateAppVersion/UpdateAppVersionCommand.cs b/src/CMSMicroservice.Application/AppVersionCQ/Commands/UpdateAppVersion/UpdateAppVersionCommand.cs
new file mode 100644
index 0000000..309cbd8
--- /dev/null
+++ b/src/CMSMicroservice.Application/AppVersionCQ/Commands/UpdateAppVersion/UpdateAppVersionCommand.cs
@@ -0,0 +1,42 @@
+namespace CMSMicroservice.Application.AppVersionCQ.Commands.UpdateAppVersion;
+
+///
+/// Command برای آپدیت یا ایجاد نسخه جدید اپلیکیشن
+///
+public record UpdateAppVersionCommand : IRequest
+{
+ ///
+ /// نام اپلیکیشن (FrontOffice, BackOffice, MobileApp)
+ ///
+ public string AppName { get; init; } = string.Empty;
+
+ ///
+ /// شماره نسخه جدید (مثلاً 1.2.3)
+ ///
+ public string CurrentVersion { get; init; } = string.Empty;
+
+ ///
+ /// حداقل نسخه مورد نیاز
+ ///
+ public string? MinRequiredVersion { get; init; }
+
+ ///
+ /// آیا کش کامل باید پاک بشه؟
+ ///
+ public bool RequiresFullCacheClear { get; init; }
+
+ ///
+ /// پیام آپدیت
+ ///
+ public string? UpdateMessage { get; init; }
+
+ ///
+ /// توضیحات تغییرات این نسخه
+ ///
+ public string? ReleaseNotes { get; init; }
+
+ ///
+ /// دلیل آپدیت (برای لاگ)
+ ///
+ public string? UpdateReason { get; init; }
+}
diff --git a/src/CMSMicroservice.Application/AppVersionCQ/Commands/UpdateAppVersion/UpdateAppVersionCommandHandler.cs b/src/CMSMicroservice.Application/AppVersionCQ/Commands/UpdateAppVersion/UpdateAppVersionCommandHandler.cs
new file mode 100644
index 0000000..6128484
--- /dev/null
+++ b/src/CMSMicroservice.Application/AppVersionCQ/Commands/UpdateAppVersion/UpdateAppVersionCommandHandler.cs
@@ -0,0 +1,65 @@
+using CMSMicroservice.Domain.Entities.Configuration;
+
+namespace CMSMicroservice.Application.AppVersionCQ.Commands.UpdateAppVersion;
+
+///
+/// Handler برای آپدیت یا ایجاد نسخه جدید اپلیکیشن
+///
+public class UpdateAppVersionCommandHandler : IRequestHandler
+{
+ private readonly IApplicationDbContext _context;
+ private readonly ILogger _logger;
+
+ public UpdateAppVersionCommandHandler(
+ IApplicationDbContext context,
+ ILogger logger)
+ {
+ _context = context;
+ _logger = logger;
+ }
+
+ public async Task Handle(UpdateAppVersionCommand request, CancellationToken cancellationToken)
+ {
+ // پیدا کردن نسخه موجود برای این اپ
+ var existingVersion = await _context.AppVersions
+ .Where(v => v.AppName == request.AppName && !v.IsDeleted)
+ .FirstOrDefaultAsync(cancellationToken);
+
+ if (existingVersion != null)
+ {
+ // آپدیت نسخه موجود
+ existingVersion.CurrentVersion = request.CurrentVersion;
+ existingVersion.MinRequiredVersion = request.MinRequiredVersion ?? request.CurrentVersion;
+ existingVersion.RequiresFullCacheClear = request.RequiresFullCacheClear;
+ existingVersion.UpdateMessage = request.UpdateMessage;
+ existingVersion.ReleaseNotes = request.ReleaseNotes;
+
+ _logger.LogInformation(
+ "App version updated: {AppName} v{Version}, CacheClear={CacheClear}, Reason={Reason}",
+ request.AppName, request.CurrentVersion, request.RequiresFullCacheClear, request.UpdateReason);
+ }
+ else
+ {
+ // ایجاد نسخه جدید
+ var newVersion = new AppVersion
+ {
+ AppName = request.AppName,
+ CurrentVersion = request.CurrentVersion,
+ MinRequiredVersion = request.MinRequiredVersion ?? request.CurrentVersion,
+ RequiresFullCacheClear = request.RequiresFullCacheClear,
+ UpdateMessage = request.UpdateMessage,
+ ReleaseNotes = request.ReleaseNotes,
+ IsActive = true
+ };
+
+ _context.AppVersions.Add(newVersion);
+
+ _logger.LogInformation(
+ "New app version created: {AppName} v{Version}, CacheClear={CacheClear}, Reason={Reason}",
+ request.AppName, request.CurrentVersion, request.RequiresFullCacheClear, request.UpdateReason);
+ }
+
+ await _context.SaveChangesAsync(cancellationToken);
+ return Unit.Value;
+ }
+}
diff --git a/src/CMSMicroservice.Application/AppVersionCQ/Queries/GetAllAppVersions/GetAllAppVersionsQuery.cs b/src/CMSMicroservice.Application/AppVersionCQ/Queries/GetAllAppVersions/GetAllAppVersionsQuery.cs
new file mode 100644
index 0000000..dc366ab
--- /dev/null
+++ b/src/CMSMicroservice.Application/AppVersionCQ/Queries/GetAllAppVersions/GetAllAppVersionsQuery.cs
@@ -0,0 +1,23 @@
+namespace CMSMicroservice.Application.AppVersionCQ.Queries.GetAllAppVersions;
+
+///
+/// Query برای دریافت همه نسخههای اپلیکیشنها
+///
+public record GetAllAppVersionsQuery(bool IncludeInactive = false) : IRequest>;
+
+///
+/// DTO برای هر آیتم نسخه اپلیکیشن
+///
+public record AppVersionItemDto
+{
+ public long Id { get; init; }
+ public string AppName { get; init; } = string.Empty;
+ public string CurrentVersion { get; init; } = string.Empty;
+ public string MinRequiredVersion { get; init; } = string.Empty;
+ public bool RequiresFullCacheClear { get; init; }
+ public string? UpdateMessage { get; init; }
+ public string? ReleaseNotes { get; init; }
+ public bool IsActive { get; init; }
+ public DateTime Created { get; init; }
+ public DateTime? LastModified { get; init; }
+}
diff --git a/src/CMSMicroservice.Application/AppVersionCQ/Queries/GetAllAppVersions/GetAllAppVersionsQueryHandler.cs b/src/CMSMicroservice.Application/AppVersionCQ/Queries/GetAllAppVersions/GetAllAppVersionsQueryHandler.cs
new file mode 100644
index 0000000..cb76b95
--- /dev/null
+++ b/src/CMSMicroservice.Application/AppVersionCQ/Queries/GetAllAppVersions/GetAllAppVersionsQueryHandler.cs
@@ -0,0 +1,44 @@
+namespace CMSMicroservice.Application.AppVersionCQ.Queries.GetAllAppVersions;
+
+///
+/// Handler برای دریافت همه نسخههای اپلیکیشنها
+///
+public class GetAllAppVersionsQueryHandler : IRequestHandler>
+{
+ private readonly IApplicationDbContext _context;
+
+ public GetAllAppVersionsQueryHandler(IApplicationDbContext context)
+ {
+ _context = context;
+ }
+
+ public async Task> Handle(GetAllAppVersionsQuery request, CancellationToken cancellationToken)
+ {
+ var query = _context.AppVersions
+ .Where(v => !v.IsDeleted);
+
+ if (!request.IncludeInactive)
+ {
+ query = query.Where(v => v.IsActive);
+ }
+
+ var versions = await query
+ .OrderBy(v => v.AppName)
+ .Select(v => new AppVersionItemDto
+ {
+ Id = v.Id,
+ AppName = v.AppName,
+ CurrentVersion = v.CurrentVersion,
+ MinRequiredVersion = v.MinRequiredVersion,
+ RequiresFullCacheClear = v.RequiresFullCacheClear,
+ UpdateMessage = v.UpdateMessage,
+ ReleaseNotes = v.ReleaseNotes,
+ IsActive = v.IsActive,
+ Created = v.Created,
+ LastModified = v.LastModified
+ })
+ .ToListAsync(cancellationToken);
+
+ return versions;
+ }
+}
diff --git a/src/CMSMicroservice.Application/AppVersionCQ/Queries/GetAppVersion/GetAppVersionQuery.cs b/src/CMSMicroservice.Application/AppVersionCQ/Queries/GetAppVersion/GetAppVersionQuery.cs
new file mode 100644
index 0000000..3a664ec
--- /dev/null
+++ b/src/CMSMicroservice.Application/AppVersionCQ/Queries/GetAppVersion/GetAppVersionQuery.cs
@@ -0,0 +1,22 @@
+namespace CMSMicroservice.Application.AppVersionCQ.Queries.GetAppVersion;
+
+///
+/// Query برای دریافت آخرین نسخه یک اپلیکیشن
+///
+public record GetAppVersionQuery(string AppName, string? CurrentClientVersion = null) : IRequest;
+
+///
+/// DTO برای اطلاعات نسخه اپلیکیشن
+///
+public record AppVersionDto
+{
+ public bool Found { get; init; }
+ public string AppName { get; init; } = string.Empty;
+ public string CurrentVersion { get; init; } = string.Empty;
+ public string MinRequiredVersion { get; init; } = string.Empty;
+ public bool RequiresFullCacheClear { get; init; }
+ public bool RequiresUpdate { get; init; }
+ public string? UpdateMessage { get; init; }
+ public string? ReleaseNotes { get; init; }
+ public DateTime? LastUpdated { get; init; }
+}
diff --git a/src/CMSMicroservice.Application/AppVersionCQ/Queries/GetAppVersion/GetAppVersionQueryHandler.cs b/src/CMSMicroservice.Application/AppVersionCQ/Queries/GetAppVersion/GetAppVersionQueryHandler.cs
new file mode 100644
index 0000000..f80b3f7
--- /dev/null
+++ b/src/CMSMicroservice.Application/AppVersionCQ/Queries/GetAppVersion/GetAppVersionQueryHandler.cs
@@ -0,0 +1,75 @@
+using CMSMicroservice.Domain.Entities.Configuration;
+
+namespace CMSMicroservice.Application.AppVersionCQ.Queries.GetAppVersion;
+
+///
+/// Handler برای دریافت آخرین نسخه اپلیکیشن
+///
+public class GetAppVersionQueryHandler : IRequestHandler
+{
+ private readonly IApplicationDbContext _context;
+
+ public GetAppVersionQueryHandler(IApplicationDbContext context)
+ {
+ _context = context;
+ }
+
+ public async Task Handle(GetAppVersionQuery request, CancellationToken cancellationToken)
+ {
+ var appVersion = await _context.AppVersions
+ .Where(v => v.AppName == request.AppName && v.IsActive && !v.IsDeleted)
+ .FirstOrDefaultAsync(cancellationToken);
+
+ if (appVersion == null)
+ {
+ return new AppVersionDto
+ {
+ Found = false,
+ AppName = request.AppName
+ };
+ }
+
+ // مقایسه ورژن کلاینت با حداقل نسخه مورد نیاز
+ bool requiresUpdate = false;
+ if (!string.IsNullOrEmpty(request.CurrentClientVersion) && !string.IsNullOrEmpty(appVersion.MinRequiredVersion))
+ {
+ requiresUpdate = CompareVersions(request.CurrentClientVersion, appVersion.MinRequiredVersion) < 0;
+ }
+
+ return new AppVersionDto
+ {
+ Found = true,
+ AppName = appVersion.AppName,
+ CurrentVersion = appVersion.CurrentVersion,
+ MinRequiredVersion = appVersion.MinRequiredVersion,
+ RequiresFullCacheClear = appVersion.RequiresFullCacheClear,
+ RequiresUpdate = requiresUpdate,
+ UpdateMessage = appVersion.UpdateMessage,
+ ReleaseNotes = appVersion.ReleaseNotes,
+ LastUpdated = appVersion.LastModified ?? appVersion.Created
+ };
+ }
+
+ ///
+ /// مقایسه دو نسخه (مثلاً 1.2.3 با 1.3.0)
+ /// برگشت: منفی = اولی کوچکتر، مثبت = اولی بزرگتر، صفر = برابر
+ ///
+ private static int CompareVersions(string version1, string version2)
+ {
+ var v1Parts = version1.Split('.').Select(s => int.TryParse(s, out var n) ? n : 0).ToArray();
+ var v2Parts = version2.Split('.').Select(s => int.TryParse(s, out var n) ? n : 0).ToArray();
+
+ var maxLen = Math.Max(v1Parts.Length, v2Parts.Length);
+
+ for (int i = 0; i < maxLen; i++)
+ {
+ var v1 = i < v1Parts.Length ? v1Parts[i] : 0;
+ var v2 = i < v2Parts.Length ? v2Parts[i] : 0;
+
+ if (v1 != v2)
+ return v1.CompareTo(v2);
+ }
+
+ return 0;
+ }
+}
diff --git a/src/CMSMicroservice.Application/Common/Interfaces/IApplicationDbContext.cs b/src/CMSMicroservice.Application/Common/Interfaces/IApplicationDbContext.cs
index 849830a..9b01342 100644
--- a/src/CMSMicroservice.Application/Common/Interfaces/IApplicationDbContext.cs
+++ b/src/CMSMicroservice.Application/Common/Interfaces/IApplicationDbContext.cs
@@ -47,6 +47,7 @@ public interface IApplicationDbContext
DbSet CommissionPayoutHistories { get; }
DbSet WorkerExecutionLogs { get; }
DbSet DayaLoanContracts { get; }
+ DbSet AppVersions { get; }
// ============= Discount Shop =============
DbSet DiscountProducts { get; }
diff --git a/src/CMSMicroservice.Domain/Entities/Configuration/AppVersion.cs b/src/CMSMicroservice.Domain/Entities/Configuration/AppVersion.cs
new file mode 100644
index 0000000..8714bdc
--- /dev/null
+++ b/src/CMSMicroservice.Domain/Entities/Configuration/AppVersion.cs
@@ -0,0 +1,43 @@
+namespace CMSMicroservice.Domain.Entities.Configuration;
+
+///
+/// نسخه اپلیکیشنهای فرانتاند
+/// وقتی ورژن آپدیت بشه، فرانتها باید کش و دادههای محلی رو پاک کنن
+///
+public class AppVersion : BaseAuditableEntity
+{
+ ///
+ /// نام اپلیکیشن (FrontOffice, BackOffice, MobileApp)
+ ///
+ public string AppName { get; set; } = string.Empty;
+
+ ///
+ /// شماره نسخه فعلی (مثلاً 1.2.3)
+ ///
+ public string CurrentVersion { get; set; } = string.Empty;
+
+ ///
+ /// حداقل نسخه مورد نیاز - اگر کاربر از این پایینتر باشه باید آپدیت کنه
+ ///
+ public string MinRequiredVersion { get; set; } = string.Empty;
+
+ ///
+ /// آیا کش کامل باید پاک بشه؟
+ ///
+ public bool RequiresFullCacheClear { get; set; }
+
+ ///
+ /// پیام آپدیت برای نمایش به کاربر
+ ///
+ public string? UpdateMessage { get; set; }
+
+ ///
+ /// توضیحات تغییرات این نسخه
+ ///
+ public string? ReleaseNotes { get; set; }
+
+ ///
+ /// فعال یا غیرفعال
+ ///
+ public bool IsActive { get; set; } = true;
+}
diff --git a/src/CMSMicroservice.Infrastructure/Persistence/ApplicationDbContext.cs b/src/CMSMicroservice.Infrastructure/Persistence/ApplicationDbContext.cs
index 3e5a29c..2ccc451 100644
--- a/src/CMSMicroservice.Infrastructure/Persistence/ApplicationDbContext.cs
+++ b/src/CMSMicroservice.Infrastructure/Persistence/ApplicationDbContext.cs
@@ -87,6 +87,7 @@ public class ApplicationDbContext : DbContext, IApplicationDbContext
// Configuration
public DbSet SystemConfigurations => Set();
public DbSet SystemConfigurationHistories => Set();
+ public DbSet AppVersions => Set();
// Club Management
public DbSet ClubMemberships => Set();
diff --git a/src/CMSMicroservice.Infrastructure/Persistence/Migrations/20251225143501_AddAppVersionsTable.Designer.cs b/src/CMSMicroservice.Infrastructure/Persistence/Migrations/20251225143501_AddAppVersionsTable.Designer.cs
new file mode 100644
index 0000000..50d8546
--- /dev/null
+++ b/src/CMSMicroservice.Infrastructure/Persistence/Migrations/20251225143501_AddAppVersionsTable.Designer.cs
@@ -0,0 +1,3699 @@
+//
+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("20251225143501_AddAppVersionsTable")]
+ partial class AddAppVersionsTable
+ {
+ ///
+ 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.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("GiftValue")
+ .HasColumnType("bigint");
+
+ b.Property("InitialContribution")
+ .HasColumnType("bigint");
+
+ b.Property("IsActive")
+ .HasColumnType("bit");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LastModified")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifiedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PurchaseMethod")
+ .HasColumnType("int");
+
+ b.Property("TotalEarned")
+ .HasColumnType("bigint");
+
+ b.Property("UserId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("IsActive")
+ .HasDatabaseName("IX_ClubMembership_IsActive");
+
+ b.HasIndex("UserId")
+ .IsUnique()
+ .HasDatabaseName("IX_ClubMembership_UserId");
+
+ b.ToTable("ClubMemberships", "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("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("Status")
+ .HasDatabaseName("IX_UserCommissionPayout_Status");
+
+ b.HasIndex("WeekDefinitionId");
+
+ b.HasIndex("WeeklyPoolId")
+ .HasDatabaseName("IX_UserCommissionPayout_WeeklyPoolId");
+
+ b.HasIndex("UserId", "WeekDefinitionId")
+ .IsUnique()
+ .HasDatabaseName("IX_UserCommissionPayout_UserId_WeekDefinitionId");
+
+ 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("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("WeekDefinitionId")
+ .IsUnique()
+ .HasDatabaseName("IX_WeeklyCommissionPool_WeekDefinitionId");
+
+ 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.Configuration.SystemConfiguration", 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("DataType")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("Description")
+ .HasMaxLength(500)
+ .HasColumnType("nvarchar(500)");
+
+ b.Property("IsActive")
+ .HasColumnType("bit");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("Key")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("nvarchar(200)");
+
+ b.Property("LastModified")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifiedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Scope")
+ .HasColumnType("int");
+
+ b.Property("Value")
+ .IsRequired()
+ .HasMaxLength(1000)
+ .HasColumnType("nvarchar(1000)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("IsActive")
+ .HasDatabaseName("IX_SystemConfiguration_IsActive");
+
+ b.HasIndex("Scope", "Key")
+ .IsUnique()
+ .HasDatabaseName("IX_SystemConfiguration_Scope_Key");
+
+ b.ToTable("SystemConfigurations", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.Contract", 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")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("HtmlContent")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LastModified")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifiedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Type")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("Contracts", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.DayaLoanContract", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("ContractNumber")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("IsProcessed")
+ .HasColumnType("bit");
+
+ b.Property("LastCheckDate")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModified")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifiedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("NationalCode")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ProcessedDate")
+ .HasColumnType("datetime2");
+
+ b.Property("Status")
+ .HasColumnType("int");
+
+ b.Property("TransactionId")
+ .HasColumnType("bigint");
+
+ b.Property("UserId")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("TransactionId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("DayaLoanContracts", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.DiscountShop.DiscountCategory", 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("ImagePath")
+ .HasMaxLength(500)
+ .HasColumnType("nvarchar(500)");
+
+ 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("Name")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.Property("ParentCategoryId")
+ .HasColumnType("bigint");
+
+ b.Property("SortOrder")
+ .HasColumnType("int");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("nvarchar(200)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ParentCategoryId");
+
+ b.ToTable("DiscountCategories", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.DiscountShop.DiscountOrder", 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("DeliveryDescription")
+ .HasMaxLength(500)
+ .HasColumnType("nvarchar(500)");
+
+ b.Property("DeliveryStatus")
+ .HasColumnType("int");
+
+ b.Property("DiscountBalanceUsed")
+ .HasColumnType("bigint");
+
+ b.Property("GatewayAmountPaid")
+ .HasColumnType("bigint");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LastModified")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifiedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PaymentDate")
+ .HasColumnType("datetime2");
+
+ b.Property("PaymentStatus")
+ .HasColumnType("int");
+
+ b.Property("TotalAmount")
+ .HasColumnType("bigint");
+
+ b.Property("TrackingCode")
+ .HasMaxLength(100)
+ .HasColumnType("nvarchar(100)");
+
+ b.Property("TransactionId")
+ .HasColumnType("bigint");
+
+ b.Property("UserAddressId")
+ .HasColumnType("bigint");
+
+ b.Property("UserId")
+ .HasColumnType("bigint");
+
+ b.Property("VatAmount")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("TransactionId");
+
+ b.HasIndex("UserAddressId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("DiscountOrders", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.DiscountShop.DiscountOrderDetail", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Count")
+ .HasColumnType("int");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property("CreatedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DiscountAmount")
+ .HasColumnType("bigint");
+
+ b.Property("DiscountOrderId")
+ .HasColumnType("bigint");
+
+ b.Property("DiscountPercentUsed")
+ .HasColumnType("int");
+
+ b.Property("FinalPrice")
+ .HasColumnType("bigint");
+
+ b.Property("IsDeleted")
+ .HasColumnType("bit");
+
+ b.Property("LastModified")
+ .HasColumnType("datetime2");
+
+ b.Property("LastModifiedBy")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ProductId")
+ .HasColumnType("bigint");
+
+ b.Property("UnitPrice")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("DiscountOrderId");
+
+ b.HasIndex("ProductId");
+
+ b.ToTable("DiscountOrderDetails", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.DiscountShop.DiscountProduct", 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("FullInformation")
+ .IsRequired()
+ .HasMaxLength(2000)
+ .HasColumnType("nvarchar(2000)");
+
+ b.Property("ImagePath")
+ .IsRequired()
+ .HasMaxLength(500)
+ .HasColumnType("nvarchar(500)");
+
+ 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("MaxDiscountPercent")
+ .HasColumnType("int");
+
+ b.Property("Price")
+ .HasColumnType("bigint");
+
+ b.Property("Rate")
+ .HasColumnType("int");
+
+ b.Property("RemainingCount")
+ .HasColumnType("int");
+
+ b.Property("SaleCount")
+ .HasColumnType("int");
+
+ b.Property("ShortInfomation")
+ .IsRequired()
+ .HasMaxLength(500)
+ .HasColumnType("nvarchar(500)");
+
+ b.Property("ThumbnailPath")
+ .IsRequired()
+ .HasMaxLength(500)
+ .HasColumnType("nvarchar(500)");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("nvarchar(200)");
+
+ b.Property("ViewCount")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("DiscountProducts", "CMS");
+ });
+
+ modelBuilder.Entity("CMSMicroservice.Domain.Entities.DiscountShop.DiscountProductCategory", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("CategoryId")
+ .HasColumnType("bigint");
+
+ b.Property("Created")
+ .HasColumnType("datetime2");
+
+ b.Property