diff --git a/00-INDEX.md b/00-INDEX.md index a65cd3b..013b0e7 100644 --- a/00-INDEX.md +++ b/00-INDEX.md @@ -1,7 +1,7 @@ # 📚 FourSat Project - فهرست جامع مستندات -> **نسخه**: 2.4 -> **آخرین بروزرسانی**: ۵ دی ۱۴۰۴ (December 25, 2025) +> **نسخه**: 2.5 +> **آخرین بروزرسانی**: ۶ دی ۱۴۰۴ (December 26, 2025) > **وضعیت**: ✅ تجمیع و بازسازی کامل --- @@ -38,7 +38,12 @@ | **BackOffice UI** | ✅ Production Ready | 100% | [`04-FRONTEND/BackOffice/ui-status.md`](04-FRONTEND/BackOffice/ui-status.md) | | **FrontOffice UI** | 🚧 In Progress | 75% | [`04-FRONTEND/FrontOffice/README.md`](04-FRONTEND/FrontOffice/README.md) | -### آخرین دستاوردها (۵ دی): +### آخرین دستاوردها (۶ دی): +- ✅ **App Version Management**: سیستم کامل مدیریت نسخه اپلیکیشن‌های موبایل +- ✅ **ReferralCode در درخت**: نمایش کد معرف در نودهای درخت شبکه FrontOffice +- ✅ **BackOffice Settings Page**: صفحه `/settings/app-versions` با UI کامل + +### دستاوردهای قبلی (۵ دی): - ✅ **Chatika Enabled Flag**: قابلیت فعال/غیرفعال کردن Worker چتیکا از Config - ✅ **DayaLoan Fix**: جلوگیری از استعلام مجدد مشتریان با قرارداد - ✅ **BackOffice Tree Rewrite**: بازنویسی کامل صفحه درخت شبکه با d3-org-chart @@ -278,6 +283,20 @@ ## 📝 تاریخچه تغییرات +### نسخه 2.5 (۶ دی ۱۴۰۴ / Dec 26, 2025): +- ✅ **App Version Management**: سیستم کامل مدیریت نسخه اپلیکیشن‌های موبایل +- ✅ **BackOffice UI**: صفحه `/settings/app-versions` با MudBlazor +- ✅ **ReferralCode Display**: نمایش کد معرف در درخت شبکه FrontOffice +- ✅ Changelog جدید: `CHANGELOG-2025-12-26.md` + +### نسخه 2.4 (۵ دی ۱۴۰۴ / Dec 25, 2025): +- ✅ **Chatika Enabled Flag**: قابلیت فعال/غیرفعال کردن Worker چتیکا +- ✅ **DayaLoan Fix**: جلوگیری از استعلام مجدد مشتریان با قرارداد +- ✅ **BackOffice Tree Rewrite**: بازنویسی کامل با d3-org-chart +- ✅ **Node Tooltip**: نمایش اطلاعات کاربر روی hover +- ✅ **GetNetworkTree SP**: Stored Procedure برای بهبود سرعت +- ✅ Changelog جدید: `CHANGELOG-2025-12-25.md` + ### نسخه 2.3 (۳ دی ۱۴۰۴ / Dec 23, 2025): - ✅ **Chatika Integration**: Worker خودکار فعال‌سازی حساب چتیکا - ✅ **ClubFeatureType Enum**: جایگزینی hardcoded IDs با Enum قابل نگهداری diff --git a/03-BACKEND/BackOffice.BFF/README.md b/03-BACKEND/BackOffice.BFF/README.md index 925f89c..512fcc6 100644 --- a/03-BACKEND/BackOffice.BFF/README.md +++ b/03-BACKEND/BackOffice.BFF/README.md @@ -17,10 +17,10 @@ BackOffice.BFF از قراردادهای Protobuf **اختصاصی خودش** ا | Project | Version | Namespace | Purpose | |---------|---------|-----------|----------| -| BackOffice.BFF.ClubMembership.Protobuf | 0.0.6 | Foursat.BackOffice.BFF.ClubMembership.Protos | باشگاه مشتریان | -| BackOffice.BFF.Commission.Protobuf | 0.0.6 | Foursat.BackOffice.BFF.Commission.Protos | کمیسیون | -| BackOffice.BFF.Configuration.Protobuf | 1.0.6 | Foursat.BackOffice.BFF.Configuration.Protos | تنظیمات | -| BackOffice.BFF.NetworkMembership.Protobuf | 0.0.6 | Foursat.BackOffice.BFF.NetworkMembership.Protos | شبکه | +| BackOffice.BFF.ClubMembership.Protobuf | 0.0.7 | Foursat.BackOffice.BFF.ClubMembership.Protos | باشگاه مشتریان | +| BackOffice.BFF.Commission.Protobuf | 0.0.13 | Foursat.BackOffice.BFF.Commission.Protos | کمیسیون | +| BackOffice.BFF.Configuration.Protobuf | 1.0.20 | BackOffice.BFF.Configuration.Protobuf.Protos | تنظیمات + AppVersion | +| BackOffice.BFF.NetworkMembership.Protobuf | 0.0.11 | Foursat.BackOffice.BFF.NetworkMembership.Protos | شبکه | **تغییر معماری (۱۷ آذر ۱۴۰۴)**: - ❌ **قبلا**: استفاده مستقیم از `CMSMicroservice.Protobuf` (Anti-Pattern) diff --git a/04-FRONTEND/BackOffice/README.md b/04-FRONTEND/BackOffice/README.md index 432cef6..684e146 100644 --- a/04-FRONTEND/BackOffice/README.md +++ b/04-FRONTEND/BackOffice/README.md @@ -1,8 +1,8 @@ # BackOffice - Network & Commission Management System -**Version**: 2.2 -**Last Updated**: 2025-12-05 -**Status**: 🟡 **Build In Progress - ~12 Errors Remaining** +**Version**: 2.3 +**Last Updated**: 2025-12-26 +**Status**: ✅ **Build Successful - Production Ready** --- @@ -14,28 +14,24 @@ BackOffice is a comprehensive Blazor WebAssembly application for managing networ ## 🎯 Current Status -### **Build Status: 🔴 FAILING (~12 errors)** +### **Build Status: ✅ SUCCESSFUL (0 Errors, ~246 Warnings)** -> See `BackOffice/docs/BUILD-FIX-STATUS.md` for detailed error list +### **Recent Changes (2025-12-26)**: +- ✅ **NEW**: App Version Management page (`/settings/app-versions`) +- ✅ Network Tree rewritten with d3-org-chart +- ✅ All proto dependencies resolved +- ✅ MudBlazor upgraded to 8.x with proper T parameter -### **Recent Changes (2025-12-05)**: -- ⚠️ Migrated from .NET 8 to .NET 9 -- ⚠️ Updated MudBlazor to 8.14.0 (requires T parameter for generics) -- ⚠️ Multiple files excluded from build (missing proto dependencies) -- ⚠️ Products.Protobuf switched from NuGet to ProjectReference +### **Recent Changes (2025-12-25)**: +- ✅ Network Tree Viewer complete rewrite with d3-org-chart +- ✅ Tooltip on hover for node details +- ✅ Week filter visual distinction +- ✅ Search and navigation features -### **Known Issues**: -- Missing proto projects: DiscountProduct, DiscountCategory, DiscountOrder, Tag, ProductTag -- Some UserOrder methods missing in proto (CancelOrder, ApplyDiscount, UpdateOrderStatus) -- PaginationState namespace conflicts -- Int32Value/Int64Value binding issues in WithdrawalReports - -### **Excluded Files** (see `BackOffice/docs/EXCLUDED-FILES.md`): -- `Pages/DiscountShop/**` - needs new proto projects -- `Pages/Tag/**` - needs Tag.Protobuf -- `Pages/Products/Components/*Dialog*` - needs proto updates -- `Pages/UserOrder/Components/*Dialog*` - needs proto updates -- Several other pages with missing dependencies +### **Previous Known Issues (Now Resolved)**: +- ~~Missing proto projects~~ ✅ Fixed +- ~~UserOrder methods missing~~ ✅ Fixed +- ~~PaginationState conflicts~~ ✅ Fixed --- @@ -57,7 +53,10 @@ BackOffice/ │ │ ├── Club/ # 3 pages (Members, Statistics) │ │ ├── SystemManagement/ # 4 pages (Worker, Alerts, Health, Config) │ │ ├── Dashboard/ # 1 page (SystemOverview) -│ │ └── Settings/ # 1 page (UserSettings) +│ │ └── Settings/ # 2 pages (UserSettings, AppVersions) +│ ├── Services/ +│ │ ├── AppVersion/ # App version management +│ │ └── ... │ └── Components/ # Reusable dialogs └── README.md ``` @@ -107,6 +106,13 @@ Access at: `https://localhost:7001` - Health dashboard - Configuration editor +### **5. App Version Management** 📱 (NEW) +- Mobile app version control +- Force update configuration +- Min required version setting +- Cache clear requirements +- Update messages & release notes + --- ## 🔧 Technical Stack diff --git a/04-FRONTEND/FrontOffice/README.md b/04-FRONTEND/FrontOffice/README.md index e0b1a5b..8728eb4 100644 --- a/04-FRONTEND/FrontOffice/README.md +++ b/04-FRONTEND/FrontOffice/README.md @@ -2,11 +2,25 @@ > **FrontOffice**: رابط کاربری Blazor Server برای مشتریان نهایی سیستم FourSat > -> **آخرین بروزرسانی**: ۲۸ آذر ۱۴۰۴ (18 دسامبر 2025) +> **آخرین بروزرسانی**: ۶ دی ۱۴۰۴ (26 دسامبر 2025) --- -## 🆕 تغییرات اخیر (۲۸ آذر ۱۴۰۴) +## 🆕 تغییرات اخیر (۶ دی ۱۴۰۴) + +### ✅ نمایش کد معرف در درخت شبکه +- **کد معرف**: نمایش ReferralCode برای کاربران فعال باشگاه +- **دکمه کپی**: امکان کپی کد معرف با یک کلیک +- **استایل**: طراحی زیبا با رنگ سبز برای کد معرف +- **فایل‌های تغییر یافته**: + - `Utilities/NetworkMembershipDtos.cs` - فیلد ReferralCode + - `Utilities/NetworkMembershipService.cs` - Mapping + - `wwwroot/js/org-chart.js` - نمایش در نود + - `wwwroot/css/org-chart.css` - استایل‌ها + +--- + +## 🆕 تغییرات قبلی (۲۸ آذر ۱۴۰۴) ### ✅ نمودار درختی شبکه با d3-org-chart - **کتابخانه**: d3-org-chart v3 + d3.js v7 + d3-flextree diff --git a/CHANGELOG-2025-12-26.md b/CHANGELOG-2025-12-26.md new file mode 100644 index 0000000..a09640f --- /dev/null +++ b/CHANGELOG-2025-12-26.md @@ -0,0 +1,383 @@ +# 📝 Changelog - ۶ دی ۱۴۰۴ (26 December 2025) + +> **Session**: سیستم مدیریت نسخه اپلیکیشن (App Version Management) + نمایش کد معرف در درخت شبکه + +--- + +## 🎯 خلاصه Session + +این session شامل موارد زیر بود: +1. **App Version Management** - سیستم کامل مدیریت نسخه اپلیکیشن‌های موبایل +2. **ReferralCode در NetworkTree** - نمایش کد معرف در درخت شبکه FrontOffice +3. **BackOffice UI** - صفحه مدیریت نسخه‌ها در پنل ادمین + +--- + +## ✨ New Features + +### 1. 📱 سیستم مدیریت نسخه اپلیکیشن (App Version Management) ✅ + +**نیاز**: مدیریت نسخه‌های اپلیکیشن‌های موبایل و کنترل به‌روزرسانی اجباری + +**معماری**: +``` +┌─────────────────────────────────────────────────────────────┐ +│ Flow Diagram │ +├─────────────────────────────────────────────────────────────┤ +│ │ +│ BackOffice UI ──(gRPC)──► BackOffice.BFF ──(gRPC)──► CMS │ +│ (Blazor) (API Gateway) (Database) │ +│ │ +│ /settings/app-versions AppVersionService AppVersions │ +│ Table │ +└─────────────────────────────────────────────────────────────┘ +``` + +--- + +#### 1.1 CMS Layer (Database + gRPC) ✅ + +**Entity**: `AppVersion.cs` (موجود) +```csharp +public class AppVersion : BaseAuditableEntity +{ + public string AppName { get; set; } // FoursatMarketApp, FoursatClubApp + public string CurrentVersion { get; set; } // 1.2.0 + public string MinRequiredVersion { get; set; } // 1.0.0 + public bool RequiresFullCacheClear { get; set; } + public string UpdateMessage { get; set; } + public string ReleaseNotes { get; set; } + public bool IsActive { get; set; } +} +``` + +**Protobuf**: `appversion.proto` +```protobuf +service AppVersionContract { + rpc GetAllAppVersions(GetAllAppVersionsRequest) returns (GetAllAppVersionsResponse); + rpc GetAppVersion(GetAppVersionRequest) returns (GetAppVersionResponse); + rpc UpdateAppVersion(UpdateAppVersionRequest) returns (google.protobuf.Empty); +} +``` + +**فایل‌ها**: +- `CMSMicroservice.Protobuf/Protos/appversion.proto` +- `CMSMicroservice.WebApi/Services/AppVersionService.cs` +- پکیج NuGet: `CMSMicroservice.Protobuf` v0.0.159 + +--- + +#### 1.2 BackOffice.BFF Layer ✅ + +**Protobuf اختصاصی**: `BackOffice.BFF.Configuration.Protobuf/Protos/appversion.proto` +```protobuf +option csharp_namespace = "BackOffice.BFF.Configuration.Protobuf.Protos.AppVersion"; + +service AppVersionContract { + rpc GetAllAppVersions(GetAllAppVersionsRequest) returns (GetAllAppVersionsResponse) { + option (google.api.http) = { get: "/AppVersion/GetAll" }; + }; + rpc GetAppVersion(GetAppVersionRequest) returns (GetAppVersionResponse) { + option (google.api.http) = { get: "/AppVersion/Get" }; + }; + rpc UpdateAppVersion(UpdateAppVersionRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { post: "/AppVersion/Update" body: "*" }; + }; +} +``` + +**CQRS Components**: +| Component | Path | Description | +|-----------|------|-------------| +| `GetAllAppVersionsQuery` | ConfigurationCQ/Queries/ | Query با `IncludeInactive` | +| `GetAllAppVersionsResponseDto` | ConfigurationCQ/Queries/ | Response DTO با لیست آیتم‌ها | +| `GetAllAppVersionsQueryHandler` | ConfigurationCQ/Queries/ | Handler که CMS رو کال می‌کنه | +| `UpdateAppVersionCommand` | ConfigurationCQ/Commands/ | Command برای آپدیت | +| `UpdateAppVersionCommandHandler` | ConfigurationCQ/Commands/ | Handler که CMS رو کال می‌کنه | + +**gRPC Service**: `AppVersionService.cs` +```csharp +public class AppVersionService : AppVersionContract.AppVersionContractBase +{ + public override async Task GetAllAppVersions(...) + public override async Task GetAppVersion(...) + public override async Task UpdateAppVersion(...) +} +``` + +**Mapster Profile**: `AppVersionProfile.cs` + +**فایل‌های جدید**: +- `src/BackOffice.BFF.Application/ConfigurationCQ/Queries/GetAllAppVersions/*` +- `src/BackOffice.BFF.Application/ConfigurationCQ/Commands/UpdateAppVersion/*` +- `src/BackOffice.BFF.WebApi/Services/AppVersionService.cs` +- `src/BackOffice.BFF.WebApi/Common/Mappings/AppVersionProfile.cs` +- `src/Protobufs/BackOffice.BFF.Configuration.Protobuf/Protos/appversion.proto` + +**پکیج NuGet**: `Foursat.BackOffice.BFF.Configuration.Protobuf` v1.0.20 + +--- + +#### 1.3 BackOffice UI (Blazor) ✅ + +**مسیر صفحه**: `/settings/app-versions` + +**Service Layer**: + +`IAppVersionService.cs`: +```csharp +public interface IAppVersionService +{ + Task> GetAllAsync(bool includeInactive = false); + Task GetByNameAsync(string appName); + Task UpdateAsync(UpdateAppVersionDto dto); +} +``` + +`AppVersionDto.cs`: +```csharp +public class AppVersionDto +{ + public long Id { get; set; } + public string AppName { get; set; } + public string AppNameDisplay { get; } // ترجمه فارسی + public string CurrentVersion { get; set; } + public string MinRequiredVersion { get; set; } + public bool RequiresFullCacheClear { get; set; } + public string UpdateMessage { get; set; } + public string ReleaseNotes { get; set; } + public bool IsActive { get; set; } + public DateTime? Created { get; set; } + public DateTime? LastModified { get; set; } +} +``` + +**UI Components**: + +| Component | Description | +|-----------|-------------| +| `AppVersions.razor` | صفحه اصلی با جدول و کارت‌ها | +| `AppVersionEditDialog.razor` | Dialog ویرایش نسخه | + +**ویژگی‌های صفحه**: +- 📋 جدول MudDataGrid با اطلاعات همه نسخه‌ها +- 🔍 فیلتر نمایش نسخه‌های غیرفعال +- 🃏 کارت خلاصه برای هر اپلیکیشن فعال +- ✏️ ویرایش با Dialog شامل: + - نسخه فعلی + - حداقل نسخه مورد نیاز + - نیاز به پاکسازی کش + - پیام به‌روزرسانی + - یادداشت‌های انتشار + - دلیل تغییر (برای لاگ) + +**فایل‌های جدید**: +- `Services/AppVersion/IAppVersionService.cs` +- `Services/AppVersion/AppVersionService.cs` +- `Pages/Settings/AppVersions.razor` +- `Pages/Settings/Components/AppVersionEditDialog.razor` + +**تغییرات در فایل‌های موجود**: +- `Common/Configure/ConfigureService.cs` - ثبت service و gRPC client +- `BackOffice.csproj` - آپدیت پکیج به v1.0.20 + +--- + +### 2. 🔗 نمایش کد معرف در درخت شبکه FrontOffice ✅ + +**نیاز**: نمایش کد معرف افرادی که در باشگاه فعالند کنار هر نود + +**تغییرات**: + +#### 2.1 CMS - Stored Procedure +`SP_GetNetworkTree.sql` - فیلد `ReferralCode` اضافه شده: +```sql +SELECT + ... + u.ReferralCode, + ... +FROM NetworkTree_CTE t +JOIN AspNetUsers u ON t.UserId = u.Id +``` + +#### 2.2 FrontOffice DTOs +`NetworkMembershipDtos.cs`: +```csharp +public class NetworkNodeDto +{ + // ... existing fields + public string? ReferralCode { get; set; } // جدید +} + +public class FlatNetworkNodeDto +{ + // ... existing fields + public string? ReferralCode { get; set; } // جدید +} +``` + +#### 2.3 JavaScript - org-chart.js +```javascript +// فقط برای کاربران فعال باشگاه نمایش بده +${d.isClubActive && d.referralCode ? ` +
+ کد معرف: + ${d.referralCode} + +
+` : ''} +``` + +#### 2.4 CSS - org-chart.css +```css +.node-referral { + display: flex; + align-items: center; + gap: 4px; + margin-top: 4px; + padding: 3px 6px; + background: rgba(76, 175, 80, 0.1); + border-radius: 4px; + font-size: 11px; +} + +.referral-code { + font-weight: bold; + color: #4CAF50; + font-family: monospace; +} + +.copy-btn { + background: transparent; + border: none; + cursor: pointer; + padding: 2px; + color: #666; +} + +.copy-toast { + position: fixed; + bottom: 20px; + left: 50%; + transform: translateX(-50%); + background: #333; + color: white; + padding: 8px 16px; + border-radius: 4px; + z-index: 10000; +} +``` + +**فایل‌های تغییر یافته**: +- `FrontOffice/Utilities/NetworkMembershipDtos.cs` +- `FrontOffice/Utilities/NetworkMembershipService.cs` +- `FrontOffice/wwwroot/js/org-chart.js` +- `FrontOffice/wwwroot/css/org-chart.css` + +--- + +## 📦 Package Updates + +| Package | From | To | Project | +|---------|------|-----|---------| +| `CMSMicroservice.Protobuf` | 0.0.156 | 0.0.159 | BackOffice.BFF.Domain | +| `Foursat.BackOffice.BFF.Configuration.Protobuf` | 1.0.7 | 1.0.20 | BackOffice | + +--- + +## 🗄️ Git Commits + +### BackOffice.BFF +``` +commit 6bc45e4 +feat(bff): Add App Version management endpoints + +- Add appversion.proto with GetAll, Get, Update RPCs +- Add GetAllAppVersionsQuery and handler +- Add UpdateAppVersionCommand and handler +- Add AppVersionService gRPC service +- Add AppVersionProfile for Mapster mappings +- Update IApplicationContractContext with AppVersions client +- Bump Configuration.Protobuf to 1.0.20 +``` + +### BackOffice +``` +commit 6b140c3 +feat(backoffice): Add App Version management UI + +- Add IAppVersionService interface and implementation +- Add AppVersions.razor page for managing app versions +- Add AppVersionEditDialog component for editing versions +- Register AppVersion gRPC client and service in DI +- Update Foursat.BackOffice.BFF.Configuration.Protobuf to 1.0.20 +``` + +### CMS +``` +commit bca3b7f +feat: Add ReferralCode to NetworkTree and NetworkMembershipProfile + +- Add ReferralCode to SP_GetNetworkTree stored procedure +- Map ReferralCode in NetworkMembershipProfile +- Update networkmembership.proto with referral_code field +``` + +--- + +## ✅ Build Status + +```bash +# CMS +cd /home/masoud/Apps/project/FourSat/CMS/src +dotnet build CMSMicroservice.WebApi/CMSMicroservice.WebApi.csproj +# Result: Build succeeded. 0 Error(s) + +# BackOffice.BFF +cd /home/masoud/Apps/project/FourSat/BackOffice.BFF/src +dotnet build BackOffice.BFF.WebApi/BackOffice.BFF.WebApi.csproj +# Result: Build succeeded. 200 Warning(s), 0 Error(s) + +# BackOffice +cd /home/masoud/Apps/project/FourSat/BackOffice/src +dotnet build BackOffice/BackOffice.csproj +# Result: Build succeeded. 246 Warning(s), 0 Error(s) +``` + +--- + +## 📊 آمار Session + +| متریک | مقدار | +|-------|-------| +| فایل‌های جدید | 12 | +| فایل‌های تغییر یافته | 10 | +| قابلیت‌های جدید | 2 | +| خطوط کد اضافه شده | ~1000 | +| پکیج‌های NuGet آپدیت شده | 2 | +| Commits | 3 | + +--- + +## 📍 مسیرهای دسترسی + +| Feature | URL | Project | +|---------|-----|---------| +| مدیریت نسخه اپ‌ها | `/settings/app-versions` | BackOffice | +| درخت شبکه با کد معرف | `/profile/tree` | FrontOffice | + +--- + +## ⚠️ یادآوری‌ها + +1. **Stored Procedure**: اسکریپت `SP_GetNetworkTree.sql` باید روی دیتابیس production اجرا شود +2. **منوی BackOffice**: صفحه `/settings/app-versions` در منوی سایدبار اضافه نشده - در صورت نیاز `NavMenu.razor` آپدیت شود + +--- + +## 🔗 Related Changelogs + +- [CHANGELOG-2025-12-25.md](CHANGELOG-2025-12-25.md) - درخت شبکه BackOffice با d3-org-chart +- [CHANGELOG-2025-12-23.md](CHANGELOG-2025-12-23.md) - پیاده‌سازی Worker چتیکا