feat: Fix multiple pages in BackOffice and enable product features
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# BackOffice Build Fix Status
|
||||
|
||||
> آخرین بروزرسانی: December 6, 2025
|
||||
> آخرین بروزرسانی: December 20, 2025
|
||||
|
||||
## وضعیت فعلی
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
- ✅ BackOffice.BFF.DiscountShoppingCart.Protobuf
|
||||
- ✅ BackOffice.BFF.PublicMessage.Protobuf
|
||||
- ✅ BackOffice.BFF.ManualPayment.Protobuf
|
||||
- ✅ BackOffice.BFF.ClubMembership.Protobuf
|
||||
- ✅ BackOffice.BFF.Commission.Protobuf
|
||||
|
||||
### BackOffice UI:
|
||||
- **Build**: ✅ موفق - 0 Error
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
# BackOffice Changelog
|
||||
|
||||
> تاریخچه تغییرات پروژه BackOffice
|
||||
|
||||
---
|
||||
|
||||
## December 20, 2025
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
#### 1. صفحه `/network/balances` - ValidationException
|
||||
**مشکل**: خطای ValidationException هنگام لود صفحه
|
||||
|
||||
**راهحل**: اضافه کردن Mapster mapping در `CommissionProfile.cs`:
|
||||
```csharp
|
||||
config.NewConfig<GetUserWeeklyBalancesRequest, GetUserWeeklyBalancesQuery>()
|
||||
.Map(dest => dest.PaginationState, src => src.PaginationState);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### 2. صفحه `/club/members` - دادهها لود نمیشدند
|
||||
**مشکل**: صفحه خالی بود و دادهای نمایش نمیداد
|
||||
|
||||
**راهحل**: ایجاد `ClubMembershipProfile.cs` در CMS و BFF با mappings کامل:
|
||||
- `GetAllClubMembershipsRequest` ↔ `GetAllClubMembershipsQuery`
|
||||
- `GetAllClubMembershipsResponseDto` ↔ `GetAllClubMembershipsResponse`
|
||||
|
||||
**فایلهای جدید**:
|
||||
- `CMS/WebApi/Common/Mappings/ClubMembershipProfile.cs`
|
||||
- `BackOffice.BFF/WebApi/Common/Mappings/ClubMembershipProfile.cs` (بازنویسی)
|
||||
|
||||
---
|
||||
|
||||
#### 3. صفحه `/club/statistics` - Unimplemented Error
|
||||
**مشکل**: خطای `Status(StatusCode="Unimplemented")`
|
||||
|
||||
**راهحل**:
|
||||
1. اضافه کردن override `GetClubStatistics` در `ClubMembershipService.cs`
|
||||
2. اضافه کردن mappings برای Statistics در هر دو Profile
|
||||
|
||||
---
|
||||
|
||||
### ✨ New Features
|
||||
|
||||
#### 4. فعالسازی قابلیتهای Products
|
||||
**قبل**: همه دکمهها "در حال توسعه" نشان میدادند
|
||||
|
||||
**بعد**: همه قابلیتها فعال شدند:
|
||||
- ✅ ایجاد محصول جدید (CreateDialog)
|
||||
- ✅ ویرایش محصول (UpdateDialog)
|
||||
- ✅ گالری تصاویر (GalleryDialog)
|
||||
- ✅ مدیریت تگها (AssignTagsDialog)
|
||||
|
||||
**فایل**: `ProductsMainPage.razor.cs`
|
||||
|
||||
---
|
||||
|
||||
#### 5. فیلد "تعداد موجودی" در Products
|
||||
**اضافات**:
|
||||
- فیلد موجودی در فرم ایجاد محصول
|
||||
- فیلد موجودی در فرم ویرایش محصول
|
||||
- ستون موجودی در لیست با رنگبندی:
|
||||
- 🔴 ناموجود (0 یا کمتر)
|
||||
- 🟡 کم موجود (کمتر از 10)
|
||||
- 🟢 موجود (10 یا بیشتر)
|
||||
|
||||
**فایلهای تغییر یافته**:
|
||||
- `CreateDialog.razor`
|
||||
- `UpdateDialog.razor`
|
||||
- `ProductsMainPage.razor`
|
||||
- `CreateNewProductsCommand.cs` (BFF)
|
||||
- `UpdateProductsCommand.cs` (BFF)
|
||||
|
||||
---
|
||||
|
||||
## December 6, 2025
|
||||
|
||||
### ✅ Major Milestones
|
||||
|
||||
- Build Errors: 60+ → 0
|
||||
- MudBlazor 8 Migration Complete
|
||||
- All Product Image Management APIs Implemented
|
||||
- BulkEdit Module Enabled
|
||||
- All Files Unexcluded
|
||||
|
||||
### 🔧 Technical Changes
|
||||
|
||||
- `IMudDialogInstance` جایگزین `MudDialogInstance`
|
||||
- `MudSwitch T="bool"` اضافه شد
|
||||
- `MudChip T="string"` اضافه شد
|
||||
- Products از NuGet به ProjectReference تغییر کرد
|
||||
|
||||
---
|
||||
|
||||
## December 1, 2025
|
||||
|
||||
### ✅ Network & Commission System
|
||||
|
||||
- Commission Dashboard Complete
|
||||
- Network Members Page Complete
|
||||
- Club Members Page Complete
|
||||
- Weekly Pool Management
|
||||
- Withdrawal System
|
||||
- Payout System
|
||||
|
||||
---
|
||||
|
||||
## November 29, 2025
|
||||
|
||||
### ✅ Initial Setup
|
||||
|
||||
- SystemConfigurations Table Created
|
||||
- Base Configuration Values Added:
|
||||
- `Network.MaxDepth`: 10
|
||||
- `Club.DefaultMembershipDurationMonths`: 12
|
||||
- `Commission.MinimumPayoutAmount`: 100000
|
||||
- `System.MaintenanceMode`: false
|
||||
@@ -1,156 +0,0 @@
|
||||
# راهنمای ادامه کار - BackOffice Build Fix
|
||||
|
||||
> این فایل برای شروع چت جدید طراحی شده است
|
||||
|
||||
## وضعیت فعلی
|
||||
|
||||
**تاریخ**: December 6, 2025
|
||||
**Build Status**: ✅ SUCCESS (0 خطا)
|
||||
**پیشرفت**: 100% COMPLETE - آماده Production
|
||||
|
||||
---
|
||||
|
||||
## 🎉 پروژه کامل شد!
|
||||
|
||||
**همه چیز آماده است**:
|
||||
- ✅ 0 Build Errors
|
||||
- ✅ 9 Modules فعال
|
||||
- ✅ 38+ صفحه و کامپوننت
|
||||
- ✅ BulkEdit کامل
|
||||
- ✅ Product Image Management کامل (Backend implemented)
|
||||
- ✅ Proto Projects: 14 پروژه فعال
|
||||
- ✅ MudBlazor 8.14.0 Migration کامل
|
||||
|
||||
---
|
||||
|
||||
## دستور بررسی وضعیت
|
||||
|
||||
```bash
|
||||
# بررسی Build
|
||||
cd /home/masoud/Apps/project/FourSat/BackOffice/src
|
||||
dotnet build BackOffice.sln --no-incremental
|
||||
|
||||
# بررسی BackOffice.BFF
|
||||
cd /home/masoud/Apps/project/FourSat/BackOffice.BFF/src
|
||||
dotnet build BackOffice.BFF.sln --no-incremental
|
||||
|
||||
# مشاهده داکیومنتها
|
||||
cat /home/masoud/Apps/project/FourSat/BackOffice/docs/BUILD-FIX-STATUS.md
|
||||
cat /home/masoud/Apps/project/FourSat/BackOffice/docs/REMAINING-TASKS.md
|
||||
cat /home/masoud/Apps/project/FourSat/BackOffice/docs/EXCLUDED-FILES.md
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ✅ همه مشکلات حل شد!
|
||||
|
||||
### تکمیل شده:
|
||||
- ✅ PaginationState namespace - حل شد
|
||||
- ✅ BulkEdit Module - فعال و کار میکند
|
||||
- ✅ Product Image Management - کامل (Proto + UI + Backend)
|
||||
- ✅ GalleryDialog - فعال
|
||||
- ✅ CreateDialog/UpdateDialog - فعال با Image Upload
|
||||
- ✅ ProductsService methods - uncommented و فعال
|
||||
- ✅ CQRS Handlers - پیادهسازی شده
|
||||
- ✅ CMS Integration - متصل به ProductGalleries
|
||||
- ✅ Image Optimization - 1200x1200 + 300x300
|
||||
|
||||
---
|
||||
|
||||
## خطاهای قدیمی (همه حل شدند)
|
||||
|
||||
### 1. PaginationState Namespace
|
||||
**فایل**: `ProductsAutoComplete.razor.cs`
|
||||
**خطا**: `PaginationState` پیدا نمیشه
|
||||
**فیکس**: تغییر using به `BackOffice.BFF.Products.Protobuf.Protos.Products`
|
||||
|
||||
### 2. Int32Value/Int64Value Binding
|
||||
**فایل**: `WithdrawalReports.razor`
|
||||
**خطا**: `@bind-Value` روی `Int32Value` کار نمیکنه
|
||||
**فیکس**: استفاده از conversion یا wrapper
|
||||
|
||||
### 3. GalleryDialog Reference
|
||||
**فایل**: `ProductsMainPage.razor.cs`
|
||||
**خطا**: `GalleryDialog` exclude شده ولی متد `OpenGalleryDialog` هنوز هست
|
||||
**فیکس**: comment کردن متد
|
||||
|
||||
### 4. DiscountShopWidget Reference
|
||||
**فایل**: `SystemOverview.razor`
|
||||
**خطا**: component exclude شده ولی استفاده میشه
|
||||
**فیکس**: حذف یا comment کردن component از صفحه
|
||||
|
||||
### 5. ClubMembers Bool Binding
|
||||
**فایل**: `ClubMembers.razor`
|
||||
**خطا**: `bool?` به `MudSwitch T="bool"` bind نمیشه
|
||||
**فیکس**: تغییر نوع متغیر یا استفاده از converter
|
||||
|
||||
---
|
||||
|
||||
## فایلهای کلیدی
|
||||
|
||||
| فایل | هدف |
|
||||
|------|-----|
|
||||
| `BackOffice.csproj` | لیست exclude ها و references |
|
||||
| `ConfigureService.cs` | DI registrations |
|
||||
| `_Imports.razor` | global using و inject ها |
|
||||
| `BackOffice/docs/BUILD-FIX-STATUS.md` | وضعیت کامل خطاها |
|
||||
| `BackOffice/docs/EXCLUDED-FILES.md` | فایلهای exclude شده |
|
||||
| `BackOffice/docs/PROTO-DEPENDENCIES.md` | وابستگیهای proto |
|
||||
|
||||
---
|
||||
|
||||
## نکات مهم
|
||||
|
||||
1. **هیچ فایلی حذف نشده** - فقط از build exclude شدند
|
||||
2. **Products.Protobuf** از ProjectReference استفاده میکند (نه NuGet)
|
||||
3. **MudBlazor 8.14.0** نیاز به `T` parameter دارد
|
||||
4. **Snackbar** در `_Imports.razor` inject شده
|
||||
5. **.NET 9** target framework هست
|
||||
|
||||
---
|
||||
|
||||
## چکلیست تکمیل شده
|
||||
|
||||
- [x] فیکس PaginationState namespace
|
||||
- [x] فعالسازی BulkEdit Module
|
||||
- [x] اضافه کردن Proto Messages برای Image Upload
|
||||
- [x] فعالسازی GalleryDialog
|
||||
- [x] فعالسازی CreateDialog/UpdateDialog
|
||||
- [x] Uncomment کردن ProductsService methods
|
||||
- [x] بررسی CQRS Handlers
|
||||
- [x] اتصال به CMS ProductGalleries
|
||||
- [x] ✅ Build موفق - BackOffice UI
|
||||
- [x] ✅ Build موفق - BackOffice.BFF
|
||||
- [x] تست و تایید نهایی
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ قبل از شروع کار - بخوان!
|
||||
|
||||
### Proto Package Management (خیلی مهم!)
|
||||
|
||||
**هر تغییر در Proto = این 3 مرحله اجباری:**
|
||||
|
||||
1. ✏️ Version++ در `.csproj`
|
||||
2. 📦 `dotnet pack -c Release`
|
||||
3. 🔄 Update version در پروژههای وابسته
|
||||
|
||||
**این قانون برای همه سرویسها است:**
|
||||
- CMS Proto → BFF Protos → UI
|
||||
- هر لایه → لایه بالاتر
|
||||
|
||||
**فراموش کردن = Bug های عجیب و غریب!**
|
||||
|
||||
---
|
||||
|
||||
## 🎯 System Status: PRODUCTION READY ✅
|
||||
|
||||
**BackOffice System**:
|
||||
- UI: 100% Complete
|
||||
- Backend: 100% Complete
|
||||
- Build: 0 Errors
|
||||
- Modules: 9 Active
|
||||
- Pages: 38+
|
||||
- Proto Projects: 14
|
||||
|
||||
**آماده برای استفاده در Production** 🚀
|
||||
@@ -1,170 +0,0 @@
|
||||
# فایلهای Exclude شده از Build
|
||||
|
||||
> آخرین بروزرسانی: December 6, 2025
|
||||
>
|
||||
> این فایلها از build خارج شدند ولی **حذف نشدند**
|
||||
|
||||
## ✅ فایلهای برگردانده شده (Enabled)
|
||||
|
||||
این فایلها قبلاً exclude بودند و حالا **فعال** شدند:
|
||||
|
||||
### DiscountShop Module
|
||||
- ✅ `Pages/DiscountShop/**` - تمام صفحات فروشگاه تخفیفی
|
||||
- ✅ `Services/DiscountProduct/**` - سرویس محصولات تخفیفی
|
||||
- ✅ `Services/DiscountCategory/**` - سرویس دستهبندیها
|
||||
- ✅ `Services/DiscountOrder/**` - سرویس سفارشات
|
||||
|
||||
### Tag Module
|
||||
- ✅ `Pages/Tag/**` - صفحات مدیریت تگ
|
||||
- ✅ `Services/Tag/**` - سرویس تگ
|
||||
|
||||
### PublicMessages Module
|
||||
- ✅ `Pages/PublicMessages/**` - مدیریت پیامهای عمومی
|
||||
- ✅ `Services/PublicMessage/**` - سرویس پیامها
|
||||
|
||||
### Payment Module
|
||||
- ✅ `Pages/Payment/ManualPayments.razor*` - پرداختهای دستی
|
||||
- ✅ `Pages/Payment/Components/ManualPaymentDialog.razor*` - دیالوگ پرداخت
|
||||
- ✅ `Pages/Payment/Transactions.razor*` - صفحه تراکنشها
|
||||
|
||||
### Dashboard
|
||||
- ✅ `Pages/Dashboard/DiscountShopWidget.razor*` - ویجت آمار فروشگاه
|
||||
|
||||
### DragDrop Pages
|
||||
- ✅ `Pages/Category/CategoryProductsDragDropPage.razor*` - مدیریت محصولات دسته
|
||||
- ✅ `Pages/Products/ProductCategoriesDragDropPage.razor*` - مدیریت دستههای محصول
|
||||
|
||||
### BulkEdit Module
|
||||
- ✅ `Pages/Products/BulkEdit.razor*` - ویرایش گروهی محصولات (ENABLED)
|
||||
|
||||
### BulkEdit Module
|
||||
- ✅ `Pages/Products/BulkEdit.razor*` - ویرایش گروهی محصولات (ENABLED)
|
||||
|
||||
### Product Image Management
|
||||
- ✅ `Pages/Products/Components/GalleryDialog.razor*` - گالری تصاویر (ENABLED)
|
||||
- ✅ `Pages/Products/Components/CreateDialog.razor*` - ایجاد محصول با تصویر (ENABLED)
|
||||
- ✅ `Pages/Products/Components/UpdateDialog.razor*` - ویرایش محصول با تصویر (ENABLED)
|
||||
|
||||
---
|
||||
|
||||
## ❌ فایلهای هنوز Exclude
|
||||
|
||||
**هیچ فایلی Exclude نیست!** ✨
|
||||
|
||||
تمامی فایلها فعال شدند. Proto Messages و RPCهای لازم برای Image Upload اضافه شدند.
|
||||
|
||||
### ✅ وضعیت نهایی:
|
||||
همه چیز کامل و آماده است:
|
||||
- ✅ `GetProductGalleryAsync` - دریافت لیست تصاویر محصول (READY)
|
||||
- ✅ `AddProductImageAsync` - آپلود تصویر جدید (READY)
|
||||
- ✅ `RemoveProductImageAsync` - حذف تصویر (READY)
|
||||
|
||||
**Backend Implementation**: ✅ COMPLETED
|
||||
- ProductsService.cs: Methods uncommented
|
||||
- CQRS Handlers: Fully implemented
|
||||
- CMS Integration: Connected
|
||||
- Image Processing: Optimized with SixLabors.ImageSharp
|
||||
|
||||
---
|
||||
|
||||
## آمار
|
||||
|
||||
- **✅ فایلهای Enabled**: ~38+ صفحه و ~15 سرویس
|
||||
- **❌ فایلهای Excluded**: 0 فایل ✅
|
||||
|
||||
---
|
||||
|
||||
## آمار
|
||||
|
||||
- **✅ فایلهای Enabled**: ~30+ صفحه و ~15 سرویس
|
||||
- **❌ فایلهای Excluded**: 4 فایل
|
||||
- **Proto Projects ساخته شده**: 14
|
||||
- **Build Errors**: 0
|
||||
|
||||
---
|
||||
|
||||
## Exclude های فعلی در csproj
|
||||
|
||||
```xml
|
||||
<ItemGroup>
|
||||
<!-- BulkEdit - needs refactoring -->
|
||||
<Compile Remove="Pages\Products\BulkEdit.razor" />
|
||||
<Content Remove="Pages\Products\BulkEdit.razor" />
|
||||
<Compile Remove="Pages\Products\BulkEdit.razor.cs" />
|
||||
|
||||
<!-- GalleryDialog - needs AddProductImageAsync/RemoveProductImageAsync -->
|
||||
<Compile Remove="Pages\Products\Components\GalleryDialog.razor" />
|
||||
<Content Remove="Pages\Products\Components\GalleryDialog.razor" />
|
||||
<Compile Remove="Pages\Products\Components\GalleryDialog.razor.cs" />
|
||||
|
||||
<!-- CreateDialog/UpdateDialog - needs ImageFileModel -->
|
||||
<Compile Remove="Pages\Products\Components\CreateDialog.razor" />
|
||||
<Content Remove="Pages\Products\Components\CreateDialog.razor" />
|
||||
<Compile Remove="Pages\Products\Components\CreateDialog.razor.cs" />
|
||||
<Compile Remove="Pages\Products\Components\UpdateDialog.razor" />
|
||||
<Content Remove="Pages\Products\Components\UpdateDialog.razor" />
|
||||
<Compile Remove="Pages\Products\Components\UpdateDialog.razor.cs" />
|
||||
</ItemGroup>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## نکات مهم
|
||||
|
||||
### برای فعالسازی فایلهای Exclude:
|
||||
|
||||
1. **GalleryDialog, CreateDialog, UpdateDialog**:
|
||||
- نیاز به پیادهسازی Image Upload API در Backend
|
||||
- افزودن `ImageFileModel` message به proto
|
||||
- افزودن RPC methods برای upload/remove
|
||||
|
||||
2. **BulkEdit**:
|
||||
- حذف dependency به `CMSMicroservice.Protobuf`
|
||||
- استفاده از `BackOffice.BFF.Products.Protobuf`
|
||||
- افزودن `BulkUpdateProducts` RPC به backend
|
||||
|
||||
### فایلهای کامل شده که دیگر exclude نیستند:
|
||||
|
||||
- ✅ تمام ماژول DiscountShop
|
||||
- ✅ تمام ماژول Tag
|
||||
- ✅ تمام ماژول PublicMessages
|
||||
- ✅ تمام ماژول ManualPayments
|
||||
- ✅ DiscountShopWidget
|
||||
- ✅ Transactions
|
||||
- ✅ DragDrop Pages
|
||||
|
||||
---
|
||||
|
||||
<!-- BulkEdit -->
|
||||
<Compile Remove="Pages\Products\BulkEdit.razor" />
|
||||
<Content Remove="Pages\Products\BulkEdit.razor" />
|
||||
<Compile Remove="Pages\Products\BulkEdit.razor.cs" />
|
||||
|
||||
<!-- UserOrder Components -->
|
||||
<Compile Remove="Pages\UserOrder\Components\CancelOrderDialog.razor" />
|
||||
<Content Remove="Pages\UserOrder\Components\CancelOrderDialog.razor" />
|
||||
<Compile Remove="Pages\UserOrder\Components\CancelOrderDialog.razor.cs" />
|
||||
<Compile Remove="Pages\UserOrder\Components\ApplyDiscountDialog.razor" />
|
||||
<Content Remove="Pages\UserOrder\Components\ApplyDiscountDialog.razor" />
|
||||
<Compile Remove="Pages\UserOrder\Components\ApplyDiscountDialog.razor.cs" />
|
||||
<Compile Remove="Pages\UserOrder\Components\ChangeOrderStatusDialog.razor" />
|
||||
<Content Remove="Pages\UserOrder\Components\ChangeOrderStatusDialog.razor" />
|
||||
<Compile Remove="Pages\UserOrder\Components\ChangeOrderStatusDialog.razor.cs" />
|
||||
|
||||
<!-- Transactions -->
|
||||
<Compile Remove="Pages\Payment\Transactions.razor" />
|
||||
<Content Remove="Pages\Payment\Transactions.razor" />
|
||||
<Compile Remove="Pages\Payment\Transactions.razor.cs" />
|
||||
|
||||
<!-- Product Dialogs -->
|
||||
<Compile Remove="Pages\Products\Components\CreateProductDialog.razor" />
|
||||
<Content Remove="Pages\Products\Components\CreateProductDialog.razor" />
|
||||
<Compile Remove="Pages\Products\Components\CreateProductDialog.razor.cs" />
|
||||
<Compile Remove="Pages\Products\Components\UpdateProductDialog.razor" />
|
||||
<Content Remove="Pages\Products\Components\UpdateProductDialog.razor" />
|
||||
<Compile Remove="Pages\Products\Components\UpdateProductDialog.razor.cs" />
|
||||
<Compile Remove="Pages\Products\Components\GalleryDialog.razor" />
|
||||
<Content Remove="Pages\Products\Components\GalleryDialog.razor" />
|
||||
<Compile Remove="Pages\Products\Components\GalleryDialog.razor.cs" />
|
||||
</ItemGroup>
|
||||
```
|
||||
@@ -0,0 +1,28 @@
|
||||
# ⚠️ توجه: مستندات اصلی منتقل شده
|
||||
|
||||
مستندات اصلی پروژه در فولدر زیر قرار دارند:
|
||||
|
||||
```
|
||||
/home/masoud/Apps/project/FourSat/totalDoc/
|
||||
```
|
||||
|
||||
## 🗂️ ساختار اصلی مستندات:
|
||||
|
||||
- **00-INDEX.md** - فهرست جامع مستندات
|
||||
- **QUICK-REFERENCE.md** - مرجع سریع
|
||||
- **FINAL-STATUS.md** - وضعیت نهایی پروژه
|
||||
- **CHANGELOG-2025-12-XX.md** - لاگ تغییرات روزانه
|
||||
- **01-BUSINESS/** - منطق تجاری
|
||||
- **02-ARCHITECTURE/** - معماری سیستم
|
||||
- **03-BACKEND/** - مستندات Backend (CMS, BFF)
|
||||
- **04-FRONTEND/** - مستندات Frontend (BackOffice, FrontOffice)
|
||||
- **05-TASKS/** - کارهای جاری
|
||||
- **06-DEPLOYMENT/** - راهنمای استقرار
|
||||
|
||||
## 📝 این پوشه:
|
||||
|
||||
فایلهای این پوشه (`BackOffice/docs/`) برای مرجع محلی نگه داشته شدهاند ولی **مستندات اصلی و بهروز** در `totalDoc` قرار دارند.
|
||||
|
||||
---
|
||||
|
||||
**تاریخ**: ۳۰ آذر ۱۴۰۴ (20 December 2025)
|
||||
@@ -1,177 +0,0 @@
|
||||
# BackOffice Proto Dependencies
|
||||
|
||||
> این فایل وابستگیهای proto بین BackOffice UI و BackOffice.BFF را مستند میکند
|
||||
|
||||
## Proto های موجود در BackOffice.BFF
|
||||
|
||||
| Proto Project | وضعیت | نوع Reference در UI |
|
||||
|---------------|-------|---------------------|
|
||||
| Category.Protobuf | ✅ موجود | NuGet |
|
||||
| ClubMembership.Protobuf | ✅ موجود | ProjectReference |
|
||||
| Commission.Protobuf | ✅ موجود | ProjectReference |
|
||||
| Common.Protobuf | ✅ موجود | ProjectReference |
|
||||
| Configuration.Protobuf | ✅ موجود | ProjectReference |
|
||||
| Health.Protobuf | ✅ موجود | ProjectReference |
|
||||
| ManualPayment.Protobuf | ✅ موجود | ProjectReference |
|
||||
| NetworkMembership.Protobuf | ✅ موجود | ProjectReference |
|
||||
| Otp.Protobuf | ✅ موجود | NuGet |
|
||||
| Package.Protobuf | ✅ موجود | NuGet |
|
||||
| Products.Protobuf | ✅ موجود | **ProjectReference** (تغییر داده شد) |
|
||||
| PublicMessage.Protobuf | ✅ موجود | ProjectReference |
|
||||
| Role.Protobuf | ✅ موجود | NuGet |
|
||||
| User.Protobuf | ✅ موجود | NuGet |
|
||||
| UserAddress.Protobuf | ✅ موجود | NuGet |
|
||||
| UserOrder.Protobuf | ✅ موجود | NuGet |
|
||||
| UserRole.Protobuf | ✅ موجود | NuGet |
|
||||
|
||||
## Proto های مورد نیاز (وجود ندارند)
|
||||
|
||||
| Proto Project | صفحات وابسته | سرویسهای وابسته |
|
||||
|---------------|-------------|------------------|
|
||||
| DiscountProduct.Protobuf | `Pages/DiscountShop/*` | `Services/DiscountProduct/*` |
|
||||
| DiscountCategory.Protobuf | `Pages/DiscountShop/*` | `Services/DiscountCategory/*` |
|
||||
| DiscountOrder.Protobuf | `Pages/DiscountShop/*` | `Services/DiscountOrder/*` |
|
||||
| Tag.Protobuf | `Pages/Tag/*` | `Services/Tag/*` |
|
||||
| ProductTag.Protobuf | `Pages/Products/BulkEdit` | - |
|
||||
|
||||
## متدهای Proto مورد نیاز (وجود ندارند)
|
||||
|
||||
### UserOrder.Protobuf
|
||||
|
||||
```protobuf
|
||||
// متدهای جدید مورد نیاز
|
||||
rpc CancelOrder(CancelOrderRequest) returns (CancelOrderResponse);
|
||||
rpc ApplyDiscountToOrder(ApplyDiscountToOrderRequest) returns (ApplyDiscountToOrderResponse);
|
||||
rpc UpdateOrderStatus(UpdateOrderStatusRequest) returns (UpdateOrderStatusResponse);
|
||||
|
||||
// فیلدهای جدید در GetUserOrderResponse
|
||||
message GetUserOrderResponse {
|
||||
// ... existing fields ...
|
||||
int64 vat_amount = X;
|
||||
int32 vat_percentage = X;
|
||||
int64 vat_base_amount = X;
|
||||
int64 vat_total_amount = X;
|
||||
}
|
||||
|
||||
// PaymentStatus enum needs None value
|
||||
enum PaymentStatus {
|
||||
None = 0;
|
||||
Success = 1;
|
||||
Reject = 2;
|
||||
Pending = 3;
|
||||
}
|
||||
```
|
||||
|
||||
### Products.Protobuf
|
||||
|
||||
```protobuf
|
||||
// متدهای جدید مورد نیاز
|
||||
rpc AddProductImage(AddProductImageRequest) returns (AddProductImageResponse);
|
||||
rpc RemoveProductImage(RemoveProductImageRequest) returns (google.protobuf.Empty);
|
||||
|
||||
// فیلدهای جدید در CreateNewProductsRequest
|
||||
message CreateNewProductsRequest {
|
||||
// ... existing fields ...
|
||||
bytes image_file = X;
|
||||
bytes thumbnail_file = X;
|
||||
}
|
||||
|
||||
// یا بهتر:
|
||||
message ImageFileModel {
|
||||
bytes content = 1;
|
||||
string file_name = 2;
|
||||
string content_type = 3;
|
||||
}
|
||||
```
|
||||
|
||||
### ManualPayment.Protobuf
|
||||
|
||||
نیاز به بررسی - ممکن است متدهایی کم باشد
|
||||
|
||||
### PublicMessage.Protobuf
|
||||
|
||||
نیاز به بررسی - ممکن است متدهایی کم باشد
|
||||
|
||||
---
|
||||
|
||||
## نحوه ساخت Proto Project جدید
|
||||
|
||||
```bash
|
||||
# 1. ساخت پوشه
|
||||
mkdir -p BackOffice.BFF/src/Protobufs/BackOffice.BFF.Tag.Protobuf/Protos
|
||||
|
||||
# 2. ساخت csproj
|
||||
cat > BackOffice.BFF/src/Protobufs/BackOffice.BFF.Tag.Protobuf/BackOffice.BFF.Tag.Protobuf.csproj << 'EOF'
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Protobuf Include="Protos\*.proto" GrpcServices="Client" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Google.Protobuf" Version="3.29.3" />
|
||||
<PackageReference Include="Grpc.Net.Client" Version="2.71.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.69.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
EOF
|
||||
|
||||
# 3. ساخت proto file
|
||||
cat > BackOffice.BFF/src/Protobufs/BackOffice.BFF.Tag.Protobuf/Protos/tag.proto << 'EOF'
|
||||
syntax = "proto3";
|
||||
|
||||
package tag;
|
||||
|
||||
option csharp_namespace = "BackOffice.BFF.Tag.Protobuf.Protos.Tag";
|
||||
|
||||
// ... define services and messages
|
||||
EOF
|
||||
|
||||
# 4. اضافه کردن به solution
|
||||
dotnet sln BackOffice.BFF/src/BackOffice.BFF.sln add BackOffice.BFF/src/Protobufs/BackOffice.BFF.Tag.Protobuf/BackOffice.BFF.Tag.Protobuf.csproj
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## تغییرات اعمال شده در Products.Protobuf
|
||||
|
||||
### Namespace Change
|
||||
```protobuf
|
||||
// FROM:
|
||||
option csharp_namespace = "CMSMicroservice.Protobuf.Protos.Products";
|
||||
|
||||
// TO:
|
||||
option csharp_namespace = "BackOffice.BFF.Products.Protobuf.Protos.Products";
|
||||
```
|
||||
|
||||
### اضافه شدن public_messages.proto
|
||||
فایل از `ClubMembership.Protobuf` کپی شد با namespace:
|
||||
```protobuf
|
||||
option csharp_namespace = "BackOffice.BFF.Products.Protobuf.Protos";
|
||||
```
|
||||
|
||||
### RPC های جدید
|
||||
```protobuf
|
||||
rpc GetProductGallery(GetProductGalleryRequest) returns (GetProductGalleryResponse);
|
||||
rpc GetCategories(GetCategoriesRequest) returns (GetCategoriesResponse);
|
||||
rpc UpdateProductCategories(UpdateProductCategoriesRequest) returns (google.protobuf.Empty);
|
||||
rpc GetProductsForCategory(GetProductsForCategoryRequest) returns (GetProductsForCategoryResponse);
|
||||
rpc UpdateCategoryProducts(UpdateCategoryProductsRequest) returns (google.protobuf.Empty);
|
||||
```
|
||||
|
||||
### Message های جدید
|
||||
- CategoryItem
|
||||
- CategoryProductItem
|
||||
- GetProductGalleryRequest/Response
|
||||
- ProductGalleryImage
|
||||
- GetCategoriesRequest/Response
|
||||
- UpdateProductCategoriesRequest
|
||||
- GetProductsForCategoryRequest/Response
|
||||
- UpdateCategoryProductsRequest
|
||||
@@ -0,0 +1,34 @@
|
||||
# BackOffice Documentation - README
|
||||
|
||||
> آخرین بروزرسانی: **December 20, 2025**
|
||||
|
||||
## فایلهای این پوشه
|
||||
|
||||
| فایل | شرح |
|
||||
|------|-----|
|
||||
| `STATUS.md` | وضعیت کلی پروژه و Build Status |
|
||||
| `CHANGELOG.md` | تاریخچه تغییرات به ترتیب تاریخ |
|
||||
| `TECHNICAL-NOTES.md` | نکات فنی، Mapster، MudBlazor، Proto |
|
||||
| `development-plan.md` | برنامه توسعه (قدیمی - برای مرجع) |
|
||||
|
||||
---
|
||||
|
||||
## وضعیت فعلی
|
||||
|
||||
```
|
||||
✅ Build Status: SUCCESS (0 Errors)
|
||||
✅ Proto Projects: 24 فعال
|
||||
✅ صفحات فعال: 40+
|
||||
✅ Excluded Files: 0
|
||||
```
|
||||
|
||||
## دستورات سریع
|
||||
|
||||
```bash
|
||||
# Build همه
|
||||
cd /home/masoud/Apps/project/FourSat/BackOffice/src
|
||||
dotnet build BackOffice.sln
|
||||
|
||||
# فقط UI
|
||||
dotnet build BackOffice/BackOffice.csproj
|
||||
```
|
||||
+74
-3
@@ -1,16 +1,87 @@
|
||||
# کارهای باقیمانده - BackOffice
|
||||
|
||||
> آخرین بروزرسانی: December 6, 2025
|
||||
> آخرین بروزرسانی: December 20, 2025
|
||||
|
||||
## وضعیت کلی
|
||||
|
||||
**Build Status**: ✅ SUCCESS (0 Errors)
|
||||
**Enabled Modules**: 9 ماژول کامل
|
||||
**Enabled Modules**: 10+ ماژول کامل
|
||||
**Remaining Tasks**: فقط Backend Implementation
|
||||
|
||||
---
|
||||
|
||||
## ✅ کارهای انجام شده امروز
|
||||
## ✅ کارهای انجام شده - Session December 20, 2025
|
||||
|
||||
### 1. صفحه `/network/balances` - ✅ FIXED
|
||||
**مشکل**: ValidationException هنگام لود صفحه
|
||||
**راهحل**: اضافه کردن Mapster mapping برای `GetUserWeeklyBalancesRequest` → `GetUserWeeklyBalancesQuery`
|
||||
|
||||
**فایل تغییر یافته**:
|
||||
- `BackOffice.BFF/WebApi/Common/Mappings/CommissionProfile.cs`
|
||||
|
||||
```csharp
|
||||
config.NewConfig<GetUserWeeklyBalancesRequest, GetUserWeeklyBalancesQuery>()
|
||||
.Map(dest => dest.PaginationState, src => src.PaginationState);
|
||||
```
|
||||
|
||||
### 2. صفحه `/club/members` - ✅ FIXED
|
||||
**مشکل**: دادهها لود نمیشدند (Mapster mapping نداشت)
|
||||
**راهحل**: ایجاد ClubMembershipProfile در CMS و BFF
|
||||
|
||||
**فایلهای جدید**:
|
||||
- `CMS/WebApi/Common/Mappings/ClubMembershipProfile.cs` (NEW)
|
||||
- `BackOffice.BFF/WebApi/Common/Mappings/ClubMembershipProfile.cs` (REWRITTEN)
|
||||
|
||||
**Mappings اضافه شده**:
|
||||
- `GetAllClubMembershipsRequest` ↔ `GetAllClubMembershipsQuery`
|
||||
- `GetAllClubMembershipsResponseDto` ↔ `GetAllClubMembershipsResponse`
|
||||
|
||||
### 3. صفحه `/club/statistics` - ✅ FIXED
|
||||
**مشکل**: خطای `Status(StatusCode="Unimplemented")`
|
||||
**راهحل**: پیادهسازی متد gRPC در BFF و اضافه کردن mappings
|
||||
|
||||
**فایلهای تغییر یافته**:
|
||||
- `BackOffice.BFF/WebApi/Services/ClubMembershipService.cs` - اضافه شدن `GetClubStatistics` override
|
||||
- `CMS/WebApi/Common/Mappings/ClubMembershipProfile.cs` - اضافه شدن mappings
|
||||
- `BackOffice.BFF/WebApi/Common/Mappings/ClubMembershipProfile.cs` - اضافه شدن mappings
|
||||
|
||||
**Mappings اضافه شده**:
|
||||
- `GetClubStatisticsRequest` ↔ `GetClubStatisticsQuery`
|
||||
- `GetClubStatisticsResponseDto` ↔ `GetClubStatisticsResponse`
|
||||
- PackageDistribution و MonthlyTrend mappings
|
||||
|
||||
### 4. صفحه Products - ✅ ALL FEATURES ENABLED
|
||||
**مشکل**: همه قابلیتها disabled بودند و "در حال توسعه" نشان میدادند
|
||||
**راهحل**: Uncomment کردن کدهای دیالوگها
|
||||
|
||||
**فایل تغییر یافته**:
|
||||
- `BackOffice/Pages/Products/ProductsMainPage.razor.cs`
|
||||
|
||||
**قابلیتهای فعال شده**:
|
||||
- ✅ `CreateNew()` - ایجاد محصول جدید
|
||||
- ✅ `Update()` - ویرایش محصول
|
||||
- ✅ `OpenGallery()` - گالری تصاویر
|
||||
- ✅ `OpenTagAssignment()` - اختصاص تگ
|
||||
|
||||
### 5. فیلد "تعداد موجودی" در Products - ✅ ADDED
|
||||
**مشکل**: فیلد RemainingCount در فرمها و لیست نبود
|
||||
**راهحل**: اضافه کردن فیلد به همه لایهها
|
||||
|
||||
**فایلهای تغییر یافته**:
|
||||
- `BackOffice/Pages/Products/Components/CreateDialog.razor` - اضافه شدن فیلد موجودی
|
||||
- `BackOffice/Pages/Products/Components/UpdateDialog.razor` - اضافه شدن فیلد موجودی
|
||||
- `BackOffice/Pages/Products/ProductsMainPage.razor` - اضافه شدن ستون موجودی با رنگبندی
|
||||
- `BackOffice.BFF.Application/ProductsCQ/Commands/CreateNewProducts/CreateNewProductsCommand.cs` - اضافه شدن `RemainingCount`
|
||||
- `BackOffice.BFF.Application/ProductsCQ/Commands/UpdateProducts/UpdateProductsCommand.cs` - اضافه شدن `RemainingCount`
|
||||
|
||||
**نمایش موجودی در لیست**:
|
||||
- 🔴 **ناموجود** - اگر موجودی `0` یا کمتر (Chip قرمز)
|
||||
- 🟡 **عدد** - اگر موجودی کمتر از `10` (Chip زرد - هشدار)
|
||||
- 🟢 **عدد** - اگر موجودی `10` یا بیشتر (Chip سبز)
|
||||
|
||||
---
|
||||
|
||||
## ✅ کارهای انجام شده قبلی
|
||||
|
||||
### 1. BulkEdit Module - COMPLETED ✅
|
||||
- ✅ حذف dependency به CMSMicroservice
|
||||
|
||||
@@ -0,0 +1,311 @@
|
||||
# Session Log - December 20, 2025
|
||||
|
||||
## خلاصه Session
|
||||
|
||||
این session شامل رفع چندین باگ در صفحات BackOffice و فعالسازی قابلیتهای Products بود.
|
||||
|
||||
---
|
||||
|
||||
## 1. فیکس صفحه `/network/balances`
|
||||
|
||||
### مشکل
|
||||
```
|
||||
ValidationException هنگام لود صفحه بالانسهای هفتگی
|
||||
```
|
||||
|
||||
### علت
|
||||
Mapster mapping برای تبدیل `GetUserWeeklyBalancesRequest` به `GetUserWeeklyBalancesQuery` وجود نداشت.
|
||||
|
||||
### راهحل
|
||||
اضافه کردن mapping در `CommissionProfile.cs`:
|
||||
|
||||
```csharp
|
||||
// File: BackOffice.BFF/src/BackOffice.BFF.WebApi/Common/Mappings/CommissionProfile.cs
|
||||
|
||||
config.NewConfig<GetUserWeeklyBalancesRequest, GetUserWeeklyBalancesQuery>()
|
||||
.Map(dest => dest.PaginationState, src => src.PaginationState);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 2. فیکس صفحه `/club/members`
|
||||
|
||||
### مشکل
|
||||
```
|
||||
صفحه لود میشد ولی هیچ دادهای نمایش نمیداد
|
||||
```
|
||||
|
||||
### علت
|
||||
Mapster mappings در CMS و BFF برای `GetAllClubMemberships` وجود نداشتند.
|
||||
|
||||
### راهحل
|
||||
ایجاد `ClubMembershipProfile.cs` در هر دو لایه:
|
||||
|
||||
**CMS/src/CMSMicroservice.WebApi/Common/Mappings/ClubMembershipProfile.cs** (NEW):
|
||||
```csharp
|
||||
public class ClubMembershipProfile : IRegister
|
||||
{
|
||||
void IRegister.Register(TypeAdapterConfig config)
|
||||
{
|
||||
// GetAllClubMemberships mappings
|
||||
config.NewConfig<GetAllClubMembershipsRequest, GetAllClubMembershipsQuery>()
|
||||
.Map(dest => dest.PaginationState, src => src.PaginationState)
|
||||
.Map(dest => dest.Filter, src => src.Filter);
|
||||
|
||||
config.NewConfig<GetAllClubMembershipsResponseDto, GetAllClubMembershipsResponse>()
|
||||
.MapWith(src => new GetAllClubMembershipsResponse
|
||||
{
|
||||
MetaData = src.MetaData != null ? new CMSMicroservice.Protobuf.Common.MetaData
|
||||
{
|
||||
PageIndex = src.MetaData.PageIndex,
|
||||
TotalPages = src.MetaData.TotalPages,
|
||||
TotalCount = src.MetaData.TotalCount
|
||||
} : null,
|
||||
Models = { src.Models?.Select(...) ?? Enumerable.Empty<...>() }
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**BackOffice.BFF/src/BackOffice.BFF.WebApi/Common/Mappings/ClubMembershipProfile.cs** (REWRITTEN):
|
||||
- Mapping از BFF Proto به Query
|
||||
- Mapping از CMS Response به BFF Proto Response
|
||||
- استفاده از alias imports برای disambiguation
|
||||
|
||||
---
|
||||
|
||||
## 3. فیکس صفحه `/club/statistics`
|
||||
|
||||
### مشکل
|
||||
```
|
||||
Status(StatusCode="Unimplemented", Detail="Method cms.ClubMembershipContract/GetClubStatistics is unimplemented")
|
||||
```
|
||||
|
||||
### علت
|
||||
متد `GetClubStatistics` در BFF Service override نشده بود.
|
||||
|
||||
### راهحل
|
||||
|
||||
**1. اضافه کردن override در ClubMembershipService.cs:**
|
||||
```csharp
|
||||
public override async Task<GetClubStatisticsResponse> GetClubStatistics(
|
||||
GetClubStatisticsRequest request, ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<GetClubStatisticsRequest, GetClubStatisticsQuery, GetClubStatisticsResponse>(request, context);
|
||||
}
|
||||
```
|
||||
|
||||
**2. اضافه کردن mappings در CMS ClubMembershipProfile:**
|
||||
```csharp
|
||||
config.NewConfig<GetClubStatisticsRequest, GetClubStatisticsQuery>();
|
||||
|
||||
config.NewConfig<GetClubStatisticsResponseDto, GetClubStatisticsResponse>()
|
||||
.MapWith(src => new GetClubStatisticsResponse
|
||||
{
|
||||
TotalMembers = src.TotalMembers,
|
||||
ActiveMembers = src.ActiveMembers,
|
||||
// ... سایر فیلدها
|
||||
PackageDistribution = { src.PackageDistribution?.Select(...) },
|
||||
MonthlyTrend = { src.MonthlyTrend?.Select(...) }
|
||||
});
|
||||
```
|
||||
|
||||
**3. اضافه کردن mappings در BFF ClubMembershipProfile:**
|
||||
- Mapping از BFF Proto به Query
|
||||
- Mapping از CMS Response DTO به BFF Proto Response
|
||||
|
||||
---
|
||||
|
||||
## 4. فعالسازی قابلیتهای Products
|
||||
|
||||
### مشکل
|
||||
```
|
||||
همه دکمههای صفحه محصولات "در حال توسعه" نشان میدادند
|
||||
```
|
||||
|
||||
### علت
|
||||
کدهای دیالوگها comment شده بودند با TODO markers.
|
||||
|
||||
### راهحل
|
||||
Uncomment کردن کدها در `ProductsMainPage.razor.cs`:
|
||||
|
||||
**فایل: BackOffice/src/BackOffice/Pages/Products/ProductsMainPage.razor.cs**
|
||||
|
||||
```csharp
|
||||
// ✅ CreateNew() - فعال شد
|
||||
public async Task CreateNew()
|
||||
{
|
||||
var dialog = await DialogService.ShowAsync<CreateDialog>("افزودن محصول",
|
||||
new DialogParameters<CreateDialog> { { x => x.Model, new CreateNewProductsRequest() } },
|
||||
new DialogOptions { CloseButton = true, FullWidth = true, MaxWidth = MaxWidth.Small });
|
||||
// ...
|
||||
}
|
||||
|
||||
// ✅ Update() - فعال شد
|
||||
public async Task Update(DataModel model)
|
||||
{
|
||||
var parameters = new DialogParameters<UpdateDialog> { { x => x.Model, model.Adapt<UpdateProductsRequest>() } };
|
||||
var dialog = await DialogService.ShowAsync<UpdateDialog>("ویرایش محصول", parameters, ...);
|
||||
// ...
|
||||
}
|
||||
|
||||
// ✅ OpenGallery() - فعال شد
|
||||
public async Task OpenGallery(DataModel model)
|
||||
{
|
||||
var parameters = new DialogParameters<GalleryDialog>
|
||||
{
|
||||
{ x => x.ProductId, model.Id },
|
||||
{ x => x.ProductTitle, model.Title }
|
||||
};
|
||||
await DialogService.ShowAsync<GalleryDialog>("گالری تصاویر", parameters, ...);
|
||||
}
|
||||
|
||||
// ✅ OpenTagAssignment() - فعال شد
|
||||
public async Task OpenTagAssignment(DataModel model)
|
||||
{
|
||||
var parameters = new DialogParameters<AssignTagsDialog>
|
||||
{
|
||||
{ x => x.ProductId, model.Id },
|
||||
{ x => x.ProductTitle, model.Title }
|
||||
};
|
||||
await DialogService.ShowAsync<AssignTagsDialog>("مدیریت تگهای محصول", parameters, ...);
|
||||
}
|
||||
```
|
||||
|
||||
**Using statement uncomment شد:**
|
||||
```csharp
|
||||
using BackOffice.Pages.Tag.Components; // برای AssignTagsDialog
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 5. اضافه کردن فیلد "تعداد موجودی" به Products
|
||||
|
||||
### نیاز
|
||||
نمایش و ویرایش تعداد موجودی محصول در فرمها و لیست
|
||||
|
||||
### تغییرات
|
||||
|
||||
**1. فرمهای دیالوگ (CreateDialog.razor & UpdateDialog.razor):**
|
||||
```razor
|
||||
<MudStack Row="true" AlignItems="AlignItems.Center">
|
||||
<MudItem xs="6">
|
||||
<MudNumericField T="int" HideSpinButtons="true" @bind-Value="Model.Discount"
|
||||
Disabled="_isLoading" Label="تخفیف (%)" Variant="Variant.Outlined" Margin="Margin.Dense" />
|
||||
</MudItem>
|
||||
<MudItem xs="6">
|
||||
<MudNumericField T="int" HideSpinButtons="true" @bind-Value="Model.RemainingCount"
|
||||
Disabled="_isLoading" Label="تعداد موجودی" Variant="Variant.Outlined" Margin="Margin.Dense" />
|
||||
</MudItem>
|
||||
</MudStack>
|
||||
```
|
||||
|
||||
**2. ستون جدید در لیست (ProductsMainPage.razor):**
|
||||
```razor
|
||||
<TemplateColumn Title="موجودی" CellStyle="text-wrap: nowrap;">
|
||||
<CellTemplate>
|
||||
@if (context.Item.RemainingCount <= 0)
|
||||
{
|
||||
<MudChip T="string" Color="Color.Error" Size="Size.Small">ناموجود</MudChip>
|
||||
}
|
||||
else if (context.Item.RemainingCount < 10)
|
||||
{
|
||||
<MudChip T="string" Color="Color.Warning" Size="Size.Small">@context.Item.RemainingCount</MudChip>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudChip T="string" Color="Color.Success" Size="Size.Small">@context.Item.RemainingCount</MudChip>
|
||||
}
|
||||
</CellTemplate>
|
||||
</TemplateColumn>
|
||||
```
|
||||
|
||||
**3. اضافه کردن فیلد به BFF Commands (فیکس مهم!):**
|
||||
|
||||
مشکل: فیلد `RemainingCount` در BFF Application Commands نبود و باعث میشد مقدار ارسال/دریافت نشه.
|
||||
|
||||
**CreateNewProductsCommand.cs:**
|
||||
```csharp
|
||||
public int Discount { get; init; }
|
||||
public int Rate { get; init; }
|
||||
public int RemainingCount { get; init; } // ← اضافه شد
|
||||
public ImageFileModel ImageFile { get; init; }
|
||||
```
|
||||
|
||||
**UpdateProductsCommand.cs:**
|
||||
```csharp
|
||||
public int Discount { get; init; }
|
||||
public int Rate { get; init; }
|
||||
public int RemainingCount { get; init; } // ← اضافه شد
|
||||
public string ImagePath { get; init; }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## لیست کامل فایلهای تغییر یافته
|
||||
|
||||
### BackOffice.BFF
|
||||
| فایل | نوع تغییر | توضیح |
|
||||
|------|----------|-------|
|
||||
| `WebApi/Common/Mappings/CommissionProfile.cs` | MODIFIED | اضافه شدن mapping برای GetUserWeeklyBalances |
|
||||
| `WebApi/Common/Mappings/ClubMembershipProfile.cs` | REWRITTEN | Mappings کامل برای ClubMembership |
|
||||
| `WebApi/Services/ClubMembershipService.cs` | MODIFIED | اضافه شدن GetClubStatistics override |
|
||||
| `Application/ProductsCQ/Commands/CreateNewProducts/CreateNewProductsCommand.cs` | MODIFIED | اضافه شدن RemainingCount |
|
||||
| `Application/ProductsCQ/Commands/UpdateProducts/UpdateProductsCommand.cs` | MODIFIED | اضافه شدن RemainingCount |
|
||||
|
||||
### CMS
|
||||
| فایل | نوع تغییر | توضیح |
|
||||
|------|----------|-------|
|
||||
| `WebApi/Common/Mappings/ClubMembershipProfile.cs` | NEW | Mappings برای ClubMembership |
|
||||
|
||||
### BackOffice UI
|
||||
| فایل | نوع تغییر | توضیح |
|
||||
|------|----------|-------|
|
||||
| `Pages/Products/ProductsMainPage.razor.cs` | MODIFIED | فعالسازی CreateNew, Update, OpenGallery, OpenTagAssignment |
|
||||
| `Pages/Products/ProductsMainPage.razor` | MODIFIED | اضافه شدن ستون موجودی |
|
||||
| `Pages/Products/Components/CreateDialog.razor` | MODIFIED | اضافه شدن فیلد موجودی |
|
||||
| `Pages/Products/Components/UpdateDialog.razor` | MODIFIED | اضافه شدن فیلد موجودی |
|
||||
|
||||
---
|
||||
|
||||
## نکات فنی مهم
|
||||
|
||||
### 1. Mapster با Proto Types
|
||||
برای proto types که immutable هستند، باید از `MapWith` استفاده کرد:
|
||||
|
||||
```csharp
|
||||
config.NewConfig<SourceDto, ProtoResponse>()
|
||||
.MapWith(src => new ProtoResponse
|
||||
{
|
||||
Field1 = src.Field1,
|
||||
RepeatedField = { src.List?.Select(...) ?? Enumerable.Empty<...>() }
|
||||
});
|
||||
```
|
||||
|
||||
### 2. Alias Imports برای Proto Disambiguation
|
||||
وقتی دو proto با اسم یکسان داریم:
|
||||
|
||||
```csharp
|
||||
using BffProtos = BackOffice.BFF.ClubMembership.Protobuf.Protos.ClubMembership;
|
||||
using CmsProtos = CMSMicroservice.Protobuf.Protos.ClubMembership;
|
||||
```
|
||||
|
||||
### 3. Null-Safe MetaData Mapping
|
||||
```csharp
|
||||
MetaData = src.MetaData != null ? new MetaData
|
||||
{
|
||||
PageIndex = src.MetaData.PageIndex,
|
||||
TotalPages = src.MetaData.TotalPages,
|
||||
TotalCount = src.MetaData.TotalCount
|
||||
} : null
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Build Status پایان Session
|
||||
|
||||
```
|
||||
BackOffice.BFF: ✅ Build succeeded (0 errors)
|
||||
CMS: ✅ Build succeeded (0 errors)
|
||||
BackOffice UI: ✅ Build succeeded (0 errors)
|
||||
```
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
# BackOffice Project Status
|
||||
|
||||
> آخرین بروزرسانی: **December 20, 2025**
|
||||
|
||||
---
|
||||
|
||||
## 🎯 وضعیت کلی
|
||||
|
||||
| Component | Build Status | Errors |
|
||||
|-----------|--------------|--------|
|
||||
| BackOffice UI | ✅ SUCCESS | 0 |
|
||||
| BackOffice.BFF | ✅ SUCCESS | 0 |
|
||||
| CMS Microservice | ✅ SUCCESS | 0 |
|
||||
|
||||
**System Status**: 🟢 **PRODUCTION READY**
|
||||
|
||||
---
|
||||
|
||||
## 📦 Proto Projects (24 پروژه فعال)
|
||||
|
||||
### Core Protos:
|
||||
- ✅ Common.Protobuf
|
||||
- ✅ Health.Protobuf
|
||||
- ✅ Configuration.Protobuf
|
||||
|
||||
### User Management:
|
||||
- ✅ User.Protobuf
|
||||
- ✅ UserRole.Protobuf
|
||||
- ✅ Role.Protobuf
|
||||
- ✅ UserAddress.Protobuf
|
||||
- ✅ UserWallet.Protobuf
|
||||
- ✅ Otp.Protobuf
|
||||
|
||||
### Products & Shop:
|
||||
- ✅ Products.Protobuf
|
||||
- ✅ Category.Protobuf
|
||||
- ✅ Tag.Protobuf
|
||||
- ✅ ProductTag.Protobuf
|
||||
- ✅ Package.Protobuf
|
||||
|
||||
### Discount Shop:
|
||||
- ✅ DiscountProduct.Protobuf
|
||||
- ✅ DiscountCategory.Protobuf
|
||||
- ✅ DiscountOrder.Protobuf
|
||||
- ✅ DiscountShoppingCart.Protobuf
|
||||
|
||||
### Network & Commission:
|
||||
- ✅ NetworkMembership.Protobuf
|
||||
- ✅ ClubMembership.Protobuf
|
||||
- ✅ Commission.Protobuf
|
||||
|
||||
### Orders & Payments:
|
||||
- ✅ UserOrder.Protobuf
|
||||
- ✅ ManualPayment.Protobuf
|
||||
|
||||
### Messaging:
|
||||
- ✅ PublicMessage.Protobuf
|
||||
|
||||
---
|
||||
|
||||
## 🗂️ ماژولهای فعال
|
||||
|
||||
### 1. Products Module ✅
|
||||
- صفحه اصلی محصولات با فیلتر و صفحهبندی
|
||||
- ایجاد محصول جدید با آپلود تصویر
|
||||
- ویرایش محصول
|
||||
- گالری تصاویر محصول
|
||||
- مدیریت تگهای محصول
|
||||
- ویرایش گروهی (قیمت، موجودی، وضعیت)
|
||||
- **ستون موجودی** با رنگبندی هوشمند (🔴🟡🟢)
|
||||
- DragDrop دستهبندی محصولات
|
||||
|
||||
### 2. Discount Shop Module ✅
|
||||
- مدیریت محصولات تخفیفی
|
||||
- مدیریت دستهبندیها
|
||||
- مدیریت سفارشات
|
||||
- گزارش فروش
|
||||
|
||||
### 3. Commission Module ✅
|
||||
- داشبورد استخر هفتگی
|
||||
- لیست پرداختها
|
||||
- لیست برداشتها
|
||||
- بالانسهای هفتگی کاربران
|
||||
|
||||
### 4. Network Module ✅
|
||||
- لیست اعضای شبکه
|
||||
- نمای درختی شبکه
|
||||
- آمار شبکه
|
||||
|
||||
### 5. Club Module ✅
|
||||
- لیست اعضای باشگاه
|
||||
- آمار باشگاه
|
||||
- مدیریت ویژگیهای باشگاه
|
||||
|
||||
### 6. Tag Module ✅
|
||||
- مدیریت تگها (CRUD)
|
||||
- اختصاص تگ به محصولات
|
||||
|
||||
### 7. Public Messages Module ✅
|
||||
- مدیریت پیامهای عمومی
|
||||
- قالبهای پیام
|
||||
|
||||
### 8. Manual Payments Module ✅
|
||||
- ثبت پرداخت دستی
|
||||
- تایید/رد پرداخت
|
||||
|
||||
### 9. System Management ✅
|
||||
- تنظیمات سیستم
|
||||
- لاگ تغییرات
|
||||
- Health Check
|
||||
|
||||
### 10. Dashboard ✅
|
||||
- ویجت آمار فروشگاه تخفیفی (7 روز اخیر)
|
||||
|
||||
---
|
||||
|
||||
## 📊 آمار
|
||||
|
||||
| Metric | Value |
|
||||
|--------|-------|
|
||||
| Build Errors | 0 |
|
||||
| Proto Projects | 24 |
|
||||
| Active Pages | 40+ |
|
||||
| Active Components | 60+ |
|
||||
| Excluded Files | 0 |
|
||||
| Test Coverage | N/A |
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Environment
|
||||
|
||||
- **Framework**: Blazor WebAssembly .NET 9.0
|
||||
- **UI Library**: MudBlazor 8.14.0
|
||||
- **gRPC**: Grpc.Net.Client 2.70.0
|
||||
- **Mapping**: Mapster 7.4.0+
|
||||
@@ -0,0 +1,230 @@
|
||||
# BackOffice Technical Notes
|
||||
|
||||
> نکات فنی برای توسعهدهندگان
|
||||
|
||||
---
|
||||
|
||||
## 1. Mapster Mapping Patterns
|
||||
|
||||
### 1.1 Proto Types (Immutable)
|
||||
برای proto types که immutable هستند، باید از `MapWith` استفاده کرد:
|
||||
|
||||
```csharp
|
||||
config.NewConfig<SourceDto, ProtoResponse>()
|
||||
.MapWith(src => new ProtoResponse
|
||||
{
|
||||
Field1 = src.Field1,
|
||||
Field2 = src.Field2 ?? string.Empty,
|
||||
RepeatedField = { src.List?.Select(x => new Item { ... }) ?? Enumerable.Empty<Item>() }
|
||||
});
|
||||
```
|
||||
|
||||
### 1.2 Null-Safe MetaData
|
||||
```csharp
|
||||
MetaData = src.MetaData != null ? new MetaData
|
||||
{
|
||||
PageIndex = src.MetaData.PageIndex,
|
||||
TotalPages = src.MetaData.TotalPages,
|
||||
TotalCount = src.MetaData.TotalCount
|
||||
} : null
|
||||
```
|
||||
|
||||
### 1.3 Alias Imports برای Disambiguation
|
||||
وقتی دو proto با نام یکسان داریم:
|
||||
|
||||
```csharp
|
||||
using BffProtos = BackOffice.BFF.ClubMembership.Protobuf.Protos.ClubMembership;
|
||||
using CmsProtos = CMSMicroservice.Protobuf.Protos.ClubMembership;
|
||||
|
||||
// استفاده:
|
||||
config.NewConfig<BffProtos.GetRequest, CmsProtos.GetRequest>();
|
||||
```
|
||||
|
||||
### 1.4 PaginationState Mapping
|
||||
```csharp
|
||||
config.NewConfig<BffRequest, AppQuery>()
|
||||
.Map(dest => dest.PaginationState, src => src.PaginationState);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 2. MudBlazor 8 Breaking Changes
|
||||
|
||||
### 2.1 Dialog Instance
|
||||
```csharp
|
||||
// ❌ قبلی
|
||||
[CascadingParameter] MudDialogInstance MudDialog { get; set; }
|
||||
|
||||
// ✅ جدید
|
||||
[CascadingParameter] IMudDialogInstance MudDialog { get; set; }
|
||||
```
|
||||
|
||||
### 2.2 Generic Components
|
||||
```razor
|
||||
<!-- ❌ قبلی -->
|
||||
<MudSwitch @bind-Value="isActive" />
|
||||
<MudChip>Text</MudChip>
|
||||
|
||||
<!-- ✅ جدید -->
|
||||
<MudSwitch T="bool" @bind-Value="isActive" />
|
||||
<MudChip T="string">Text</MudChip>
|
||||
```
|
||||
|
||||
### 2.3 Drag Events
|
||||
```razor
|
||||
<!-- ❌ قبلی -->
|
||||
@ondragover="e => e.PreventDefault()"
|
||||
|
||||
<!-- ✅ جدید -->
|
||||
@ondragover:preventDefault
|
||||
```
|
||||
|
||||
### 2.4 File Upload
|
||||
```csharp
|
||||
// FilesChanged حالا IBrowserFile میگیرد
|
||||
<MudFileUpload T="IBrowserFile" FilesChanged="OnFileSelected">
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. gRPC Patterns
|
||||
|
||||
### 3.1 Service Override in BFF
|
||||
```csharp
|
||||
public override async Task<GetResponse> GetData(GetRequest request, ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<GetRequest, GetQuery, GetResponse>(request, context);
|
||||
}
|
||||
```
|
||||
|
||||
### 3.2 CQRS Handler
|
||||
```csharp
|
||||
public class GetQueryHandler : IRequestHandler<GetQuery, GetResponseDto>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public async Task<GetResponseDto> Handle(GetQuery request, CancellationToken ct)
|
||||
{
|
||||
var cmsRequest = request.Adapt<CmsProtos.GetRequest>();
|
||||
var response = await _context.Service.GetAsync(cmsRequest, cancellationToken: ct);
|
||||
return response.Adapt<GetResponseDto>();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. Proto Update Checklist
|
||||
|
||||
هر تغییری در Proto نیاز به این مراحل دارد:
|
||||
|
||||
### Step 1: Update Version
|
||||
```xml
|
||||
<!-- در .csproj -->
|
||||
<Version>0.0.142</Version> → <Version>0.0.143</Version>
|
||||
```
|
||||
|
||||
### Step 2: Pack
|
||||
```bash
|
||||
cd path/to/proto/project
|
||||
dotnet pack -c Release
|
||||
# Push به GitLab Registry خودکار انجام میشود
|
||||
```
|
||||
|
||||
### Step 3: Update References
|
||||
```xml
|
||||
<PackageReference Include="Foursat.Proto" Version="0.0.143" />
|
||||
```
|
||||
|
||||
### Step 4: Build & Test
|
||||
```bash
|
||||
dotnet build
|
||||
dotnet test
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 5. Common Fixes
|
||||
|
||||
### 5.1 Snackbar Duplicate Injection
|
||||
اگر در `_Imports.razor` inject شده، در component نیاز نیست:
|
||||
```csharp
|
||||
// ❌ حذف کن
|
||||
[Inject] ISnackbar Snackbar { get; set; }
|
||||
```
|
||||
|
||||
### 5.2 BasePageComponent Reload
|
||||
```csharp
|
||||
private MudDataGrid<Model>? _gridData;
|
||||
|
||||
private async Task OnFilterSubmit()
|
||||
{
|
||||
if (_gridData != null)
|
||||
await _gridData.ReloadServerData();
|
||||
}
|
||||
```
|
||||
|
||||
### 5.3 Nullable Wrapper Types
|
||||
```csharp
|
||||
// Proto nullable types:
|
||||
// google.protobuf.Int64Value → long?
|
||||
// google.protobuf.BoolValue → bool?
|
||||
|
||||
// Set value:
|
||||
request.UserId = userId; // نه new Int64Value { Value = userId }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. Build Commands
|
||||
|
||||
```bash
|
||||
# Full Solution Build
|
||||
cd /home/masoud/Apps/project/FourSat/BackOffice/src
|
||||
dotnet build BackOffice.sln
|
||||
|
||||
# Single Project
|
||||
dotnet build BackOffice/BackOffice.csproj
|
||||
|
||||
# With Restore
|
||||
dotnet build --restore
|
||||
|
||||
# Clean Build
|
||||
dotnet clean && dotnet build
|
||||
|
||||
# Check Errors Only
|
||||
dotnet build 2>&1 | grep -E "error CS"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 7. Project References
|
||||
|
||||
### ProjectReference (Local Development):
|
||||
```xml
|
||||
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/X.Protobuf/X.Protobuf.csproj" />
|
||||
```
|
||||
|
||||
### PackageReference (Production):
|
||||
```xml
|
||||
<PackageReference Include="Foursat.X.Protobuf" Version="0.0.143" />
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 8. File Organization
|
||||
|
||||
```
|
||||
BackOffice/
|
||||
├── docs/
|
||||
│ ├── README.md # Index
|
||||
│ ├── STATUS.md # Current Status
|
||||
│ ├── CHANGELOG.md # History
|
||||
│ ├── TECHNICAL-NOTES.md # This file
|
||||
│ └── SESSION-*.md # Session logs
|
||||
├── src/
|
||||
│ └── BackOffice/
|
||||
│ ├── Pages/ # Blazor pages
|
||||
│ ├── Services/ # gRPC clients
|
||||
│ └── Common/ # Shared components
|
||||
```
|
||||
Reference in New Issue
Block a user