8.7 KiB
کارهای باقیمانده - BackOffice
آخرین بروزرسانی: December 6, 2025
وضعیت کلی
Build Status: ✅ SUCCESS (0 Errors)
Enabled Modules: 7 ماژول کامل
Remaining Tasks: 3 فیچر
🔴 وظایف فوری (Critical)
1. Product Image Management API
اولویت: بالا
وضعیت: نیاز به Backend Implementation
فایلهای Blocked:
Pages/Products/Components/GalleryDialog.razor- گالری تصاویر محصولPages/Products/Components/CreateDialog.razor- ایجاد محصول با تصویرPages/Products/Components/UpdateDialog.razor- ویرایش محصول با تصویر
Proto Changes Required:
Location: BackOffice.BFF/src/Protobufs/BackOffice.BFF.Products.Protobuf/Protos/products.proto
service ProductsContract {
// Image management RPCs
rpc AddProductImage(AddProductImageRequest) returns (AddProductImageResponse);
rpc RemoveProductImage(RemoveProductImageRequest) returns (google.protobuf.Empty);
// Create/Update with images
rpc CreateProductWithImage(CreateProductWithImageRequest) returns (CreateProductResponse);
rpc UpdateProductWithImage(UpdateProductWithImageRequest) returns (google.protobuf.Empty);
}
// New messages
message ImageFileModel {
bytes file = 1; // فایل به صورت binary
string mime = 2; // نوع فایل (image/jpeg, image/png)
string file_name = 3; // نام فایل بدون extension
}
message AddProductImageRequest {
int64 product_id = 1;
string title = 2;
ImageFileModel image_file = 3;
}
message AddProductImageResponse {
int64 product_gallery_id = 1;
string image_url = 2;
string thumbnail_url = 3;
}
message RemoveProductImageRequest {
int64 product_gallery_id = 1;
}
message CreateProductWithImageRequest {
string title = 1;
string description = 2;
int64 price = 3;
int32 stock = 4;
// ... سایر فیلدهای محصول
ImageFileModel image_file = 20; // تصویر اصلی
ImageFileModel thumbnail_file = 21; // تصویر کوچک
}
message UpdateProductWithImageRequest {
int64 id = 1;
string title = 2;
string description = 3;
int64 price = 4;
int32 stock = 5;
// ... سایر فیلدها
google.protobuf.BoolValue update_image = 20; // آیا تصویر آپدیت شود؟
ImageFileModel image_file = 21;
google.protobuf.BoolValue update_thumbnail = 22;
ImageFileModel thumbnail_file = 23;
}
Backend Implementation Steps:
-
افزودن Messages به Proto ✅ (فقط تعریف)
-
پیادهسازی RPCs در Backend:
- AddProductImage: دریافت فایل، ذخیره در storage، ثبت در DB
- RemoveProductImage: حذف فایل از storage و DB
- CreateProductWithImage: ایجاد محصول + آپلود تصاویر
- UpdateProductWithImage: ویرایش محصول + آپلود تصاویر (اختیاری)
-
File Storage:
- پیشنهاد: MinIO, Azure Blob, یا local file system
- ذخیره تصویر اصلی و thumbnail
- برگرداندن URL های قابل دسترسی
-
تست و Enable فایلها در UI
زمان تخمینی: 2-3 روز کاری
2. BulkEdit Refactoring
اولویت: متوسط
وضعیت: نیاز به Refactoring
فایل Blocked:
Pages/Products/BulkEdit.razor- ویرایش دستهجمعی محصولات
مشکل فعلی:
استفاده مستقیم از CMSMicroservice.Protobuf.Protos که:
- وابستگی مستقیم به CMS ایجاد میکند
- معماری BFF را نقض میکند
- قابلیت نگهداری کد را کاهش میدهد
راهحل:
مرحله 1: Proto Changes
// در products.proto
service ProductsContract {
rpc BulkUpdateProducts(BulkUpdateProductsRequest) returns (BulkUpdateProductsResponse);
}
message BulkUpdateProductsRequest {
repeated int64 product_ids = 1; // لیست محصولات
// Optional updates (null = بدون تغییر)
google.protobuf.Int64Value new_price = 2;
google.protobuf.Int32Value new_discount = 3;
google.protobuf.Int32Value new_club_discount_percent = 4;
google.protobuf.BoolValue new_status = 5;
// Stock update
StockUpdateOperation stock_operation = 6;
google.protobuf.Int32Value stock_quantity = 7;
}
enum StockUpdateOperation {
STOCK_NO_CHANGE = 0; // بدون تغییر
STOCK_SET = 1; // تنظیم مقدار دقیق
STOCK_ADD = 2; // اضافه کردن
STOCK_SUBTRACT = 3; // کم کردن
}
message BulkUpdateProductsResponse {
int32 total_count = 1; // تعداد کل
int32 updated_count = 2; // تعداد موفق
repeated int64 failed_product_ids = 3; // محصولات ناموفق
repeated string error_messages = 4; // پیامهای خطا
}
مرحله 2: Backend Implementation
- پیادهسازی bulk update با transaction
- اعتبارسنجی دادهها
- مدیریت خطاها
مرحله 3: UI Refactoring
- حذف dependency به CMSMicroservice.Protobuf
- استفاده از BackOffice.BFF.Products.Protobuf
- Enable فایل در csproj
زمان تخمینی: 1-2 روز کاری
🟡 وظایف اختیاری (Optional)
3. Transactions API Implementation
اولویت: پایین
وضعیت: UI آماده، API نیاز به پیادهسازی
فایل:
Pages/Payment/Transactions.razor- ✅ Enabled اما TODO
وضعیت فعلی:
private async Task<GridData<TransactionModel>> LoadData(GridState<TransactionModel> state)
{
// TODO: Connect to BackOffice.BFF Transactions when API is ready
await Task.CompletedTask;
return new GridData<TransactionModel>
{
Items = Array.Empty<TransactionModel>(),
TotalItems = 0
};
}
نیاز:
- ایجاد Transaction proto در BackOffice.BFF
- پیادهسازی GetTransactions RPC
- اتصال UI به API
زمان تخمینی: 1 روز کاری
📊 آمار پیشرفت
Modules Status:
| Module | Status | Files | Notes |
|---|---|---|---|
| DiscountShop | ✅ Complete | 10+ | Products, Categories, Orders, Reports |
| PublicMessages | ✅ Complete | 4 | CRUD + Templates |
| ManualPayments | ✅ Complete | 2 | Create, Approve, Reject |
| Tag Management | ✅ Complete | 3 | CRUD Tags |
| Dashboard Widget | ✅ Complete | 1 | DiscountShop Stats |
| Transactions | ⚠️ Partial | 1 | UI ready, API TODO |
| DragDrop Pages | ✅ Complete | 2 | Category ↔ Products |
| Product Images | ❌ Blocked | 3 | Need API |
| BulkEdit | ❌ Blocked | 1 | Need Refactoring |
Overall Progress:
- Enabled: 32+ صفحه و کامپوننت
- Blocked: 4 فایل
- Proto Projects: 14 فعال
- Build Errors: 0
- Completion: ~88%
🎯 Next Steps
Week 1: Product Image Management
- ✅ تعریف Proto Messages (Done)
- ⬜ پیادهسازی Backend RPCs
- ⬜ تست با Postman/gRPC tools
- ⬜ Enable UI files
- ⬜ تست کامل end-to-end
Week 2: BulkEdit
- ⬜ تعریف Proto Messages
- ⬜ پیادهسازی Backend
- ⬜ Refactor UI
- ⬜ Enable و تست
Week 3: Polish
- ⬜ Transactions API (اختیاری)
- ⬜ بهبود UX
- ⬜ رفع باگها
- ⬜ مستندسازی نهایی
📝 نکات مهم
برای Backend Developer:
-
Image Upload:
- استفاده از streaming برای فایلهای بزرگ
- اعتبارسنجی نوع و سایز فایل
- تولید thumbnail خودکار
- مدیریت storage (MinIO recommended)
-
Bulk Update:
- استفاده از Transaction برای atomicity
- مدیریت concurrent updates
- Logging تغییرات برای audit
-
Security:
- اعتبارسنجی سمت سرور
- محدودیت سایز فایل
- sanitize file names
برای Frontend Developer:
-
Image Upload:
- Progress indicator
- Preview قبل از upload
- مدیریت خطاها
- Retry mechanism
-
BulkEdit:
- Confirmation قبل از تغییرات
- نمایش نتایج
- Undo capability (آینده)
🔗 Related Docs
- BUILD-FIX-STATUS.md - وضعیت کلی build
- EXCLUDED-FILES.md - لیست فایلهای exclude
- PROTO-DEPENDENCIES.md - وابستگیهای proto
Last Updated: December 6, 2025
By: GitHub Copilot (Claude Sonnet 4.5)