feat: Add core entities and history tables for network-club system

Core Entities:
- Add SystemConfiguration for dynamic config management
- Add ClubMembership, ClubFeature, UserClubFeature for club management
- Add NetworkWeeklyBalance for binary network tracking
- Add WeeklyCommissionPool, UserCommissionPayout for commission system

History Entities (Audit Trail):
- Add ClubMembershipHistory
- Add NetworkMembershipHistory
- Add CommissionPayoutHistory
- Add SystemConfigurationHistory

Updates to Existing Entities:
- User: Add NetworkParentId, LegPosition, and navigation properties
- UserWallet: Add NetworkBalance and DiscountBalance fields
- Products: Add IsClubExclusive and ClubDiscountPercent fields
- GlobalUsings: Add new namespaces for club/network/commission entities
This commit is contained in:
masoodafar-web
2025-11-29 03:44:41 +03:30
parent 462ae5dcc0
commit d20dc86d2f
15 changed files with 618 additions and 2 deletions
@@ -0,0 +1,52 @@
namespace CMSMicroservice.Domain.Entities.Network;
/// <summary>
/// تعادل‌های هفتگی شبکه باینری
/// </summary>
public class NetworkWeeklyBalance : BaseAuditableEntity
{
/// <summary>
/// شناسه کاربر
/// </summary>
public long UserId { get; set; }
/// <summary>
/// User Navigation Property
/// </summary>
public virtual User User { get; set; }
/// <summary>
/// شماره هفته (مثال: "2025-W48")
/// </summary>
public string WeekNumber { get; set; }
/// <summary>
/// تعداد تعادل شاخه چپ در این هفته
/// </summary>
public int LeftLegBalances { get; set; }
/// <summary>
/// تعداد تعادل شاخه راست در این هفته
/// </summary>
public int RightLegBalances { get; set; }
/// <summary>
/// امتیاز کاربر: MIN(LeftLegBalances, RightLegBalances)
/// </summary>
public int TotalBalances { get; set; }
/// <summary>
/// مبلغی که از این کاربر به استخر هفتگی اضافه شد (ریال)
/// </summary>
public long WeeklyPoolContribution { get; set; }
/// <summary>
/// زمان محاسبه توسط Worker
/// </summary>
public DateTime? CalculatedAt { get; set; }
/// <summary>
/// آیا منقضی شده (بعد از توزیع کمیسیون)
/// </summary>
public bool IsExpired { get; set; }
}