315 lines
7.2 KiB
Markdown
315 lines
7.2 KiB
Markdown
# خلاصه تغییرات سیستم گزارش خرابی
|
||
|
||
## 📝 فایلهای اضافه شده (23 فایل)
|
||
|
||
### 1️⃣ Domain Layer (3 فایل)
|
||
```
|
||
✓ AccountManagement.Domain/BugReportAgg/
|
||
├── BugReport.cs
|
||
├── BugReportLog.cs
|
||
└── BugReportScreenshot.cs
|
||
```
|
||
|
||
### 2️⃣ Application Contracts (6 فایل)
|
||
```
|
||
✓ AccountManagement.Application.Contracts/BugReport/
|
||
├── IBugReportRepository.cs
|
||
├── IBugReportApplication.cs
|
||
├── CreateBugReportCommand.cs
|
||
├── EditBugReportCommand.cs
|
||
├── BugReportViewModel.cs
|
||
└── BugReportDetailViewModel.cs
|
||
```
|
||
|
||
### 3️⃣ Application Service (1 فایل)
|
||
```
|
||
✓ AccountManagement.Application/
|
||
└── BugReportApplication.cs
|
||
```
|
||
|
||
### 4️⃣ Infrastructure EFCore (4 فایل)
|
||
```
|
||
✓ AccountMangement.Infrastructure.EFCore/
|
||
├── Mappings/
|
||
│ ├── BugReportMapping.cs
|
||
│ ├── BugReportLogMapping.cs
|
||
│ └── BugReportScreenshotMapping.cs
|
||
└── Repository/
|
||
└── BugReportRepository.cs
|
||
```
|
||
|
||
### 5️⃣ API Controller (1 فایل)
|
||
```
|
||
✓ ServiceHost/Controllers/
|
||
└── BugReportController.cs
|
||
```
|
||
|
||
### 6️⃣ Admin Pages (8 فایل)
|
||
```
|
||
✓ ServiceHost/Areas/AdminNew/Pages/BugReport/
|
||
├── BugReportPageModel.cs
|
||
├── Index.cshtml.cs
|
||
├── Index.cshtml
|
||
├── Details.cshtml.cs
|
||
├── Details.cshtml
|
||
├── Edit.cshtml.cs
|
||
├── Edit.cshtml
|
||
├── Delete.cshtml.cs
|
||
└── Delete.cshtml
|
||
```
|
||
|
||
### 7️⃣ Documentation (2 فایل)
|
||
```
|
||
✓ BUG_REPORT_SYSTEM.md
|
||
✓ FLUTTER_BUG_REPORT_EXAMPLE.dart
|
||
```
|
||
|
||
---
|
||
|
||
## ✏️ فایلهای اصلاح شده (2 فایل)
|
||
|
||
### 1. AccountManagement.Configuration/AccountManagementBootstrapper.cs
|
||
**تغییر:** اضافه کردن using برای BugReport
|
||
```csharp
|
||
using AccountManagement.Application.Contracts.BugReport;
|
||
```
|
||
|
||
**تغییر:** رجیستریشن سرویسها
|
||
```csharp
|
||
services.AddTransient<IBugReportApplication, BugReportApplication>();
|
||
services.AddTransient<IBugReportRepository, BugReportRepository>();
|
||
```
|
||
|
||
### 2. AccountMangement.Infrastructure.EFCore/AccountContext.cs
|
||
**تغییر:** اضافه کردن using
|
||
```csharp
|
||
using AccountManagement.Domain.BugReportAgg;
|
||
```
|
||
|
||
**تغییر:** اضافه کردن DbSets
|
||
```csharp
|
||
#region BugReport
|
||
public DbSet<BugReport> BugReports { get; set; }
|
||
public DbSet<BugReportLog> BugReportLogs { get; set; }
|
||
public DbSet<BugReportScreenshot> BugReportScreenshots { get; set; }
|
||
#endregion
|
||
```
|
||
|
||
---
|
||
|
||
## 🔧 موارد مورد نیاز قبل از استفاده
|
||
|
||
### 1. Database Migration
|
||
```powershell
|
||
# در Package Manager Console
|
||
cd AccountMangement.Infrastructure.EFCore
|
||
|
||
Add-Migration AddBugReportSystem
|
||
Update-Database
|
||
```
|
||
|
||
### 2. الگوی Enum برای Flutter
|
||
```dart
|
||
enum BugReportType {
|
||
crash, // 1
|
||
ui, // 2
|
||
performance, // 3
|
||
feature, // 4
|
||
network, // 5
|
||
camera, // 6
|
||
faceRecognition, // 7
|
||
database, // 8
|
||
login, // 9
|
||
other, // 10
|
||
}
|
||
|
||
enum BugPriority {
|
||
critical, // 1
|
||
high, // 2
|
||
medium, // 3
|
||
low, // 4
|
||
}
|
||
```
|
||
|
||
---
|
||
|
||
## 🚀 نقاط ورود
|
||
|
||
### API Endpoints
|
||
```
|
||
POST /api/bugreport/submit - ثبت گزارش جدید
|
||
GET /api/bugreport/list - دریافت لیست
|
||
GET /api/bugreport/{id} - دریافت جزئیات
|
||
PUT /api/bugreport/{id} - ویرایش وضعیت/اولویت
|
||
DELETE /api/bugreport/{id} - حذف گزارش
|
||
```
|
||
|
||
### Admin Pages
|
||
```
|
||
/AdminNew/BugReport - لیست گزارشها
|
||
/AdminNew/BugReport/Details/{id} - جزئیات کامل
|
||
/AdminNew/BugReport/Edit/{id} - ویرایش
|
||
/AdminNew/BugReport/Delete/{id} - حذف
|
||
```
|
||
|
||
---
|
||
|
||
## 📊 Database Schema
|
||
|
||
### BugReports جدول
|
||
```sql
|
||
- id (bigint, PK)
|
||
- Title (nvarchar(200))
|
||
- Description (ntext)
|
||
- UserEmail (nvarchar(150))
|
||
- AccountId (bigint, nullable)
|
||
- DeviceModel (nvarchar(100))
|
||
- OsVersion (nvarchar(50))
|
||
- Platform (nvarchar(50))
|
||
- Manufacturer (nvarchar(100))
|
||
- DeviceId (nvarchar(200))
|
||
- ScreenResolution (nvarchar(50))
|
||
- MemoryInMB (int)
|
||
- StorageInMB (int)
|
||
- BatteryLevel (int)
|
||
- IsCharging (bit)
|
||
- NetworkType (nvarchar(50))
|
||
- AppVersion (nvarchar(50))
|
||
- BuildNumber (nvarchar(50))
|
||
- PackageName (nvarchar(150))
|
||
- InstallTime (datetime2)
|
||
- LastUpdateTime (datetime2)
|
||
- Flavor (nvarchar(50))
|
||
- Type (int)
|
||
- Priority (int)
|
||
- Status (int)
|
||
- StackTrace (ntext, nullable)
|
||
- CreationDate (datetime2)
|
||
- UpdateDate (datetime2, nullable)
|
||
```
|
||
|
||
### BugReportLogs جدول
|
||
```sql
|
||
- id (bigint, PK)
|
||
- BugReportId (bigint, FK)
|
||
- Message (ntext)
|
||
- Timestamp (datetime2)
|
||
```
|
||
|
||
### BugReportScreenshots جدول
|
||
```sql
|
||
- id (bigint, PK)
|
||
- BugReportId (bigint, FK)
|
||
- Base64Data (ntext)
|
||
- FileName (nvarchar(255))
|
||
- UploadDate (datetime2)
|
||
```
|
||
|
||
---
|
||
|
||
## ✨ مثال درخواست API
|
||
|
||
```json
|
||
POST /api/bugreport/submit
|
||
Content-Type: application/json
|
||
|
||
{
|
||
"title": "برنامه هنگام ورود خراب میشود",
|
||
"description": "هنگام فشار دادن دکمه ورود، برنامه کرش میکند",
|
||
"userEmail": "user@example.com",
|
||
"accountId": 123,
|
||
"deviceModel": "Samsung Galaxy S21",
|
||
"osVersion": "Android 12",
|
||
"platform": "Android",
|
||
"manufacturer": "Samsung",
|
||
"deviceId": "device-12345",
|
||
"screenResolution": "1440x3200",
|
||
"memoryInMB": 8000,
|
||
"storageInMB": 256000,
|
||
"batteryLevel": 75,
|
||
"isCharging": false,
|
||
"networkType": "4G",
|
||
"appVersion": "1.0.0",
|
||
"buildNumber": "100",
|
||
"packageName": "com.example.app",
|
||
"installTime": "2024-01-01T10:00:00Z",
|
||
"lastUpdateTime": "2024-12-07T14:30:00Z",
|
||
"flavor": "production",
|
||
"type": 1,
|
||
"priority": 2,
|
||
"stackTrace": "...",
|
||
"logs": ["log line 1", "log line 2"],
|
||
"screenshots": ["base64-string"]
|
||
}
|
||
```
|
||
|
||
---
|
||
|
||
## 🔐 Security Features
|
||
|
||
- ✅ Authorization برای Admin Pages (AdminAreaPermission required)
|
||
- ✅ API Authentication
|
||
- ✅ XSS Protection (Html.Raw محدود)
|
||
- ✅ CSRF Protection (ASP.NET Core default)
|
||
- ✅ Input Validation
|
||
- ✅ Safe Delete with Confirmation
|
||
|
||
---
|
||
|
||
## 📚 Documentation Files
|
||
|
||
1. **BUG_REPORT_SYSTEM.md** - راهنمای کامل سیستم
|
||
2. **FLUTTER_BUG_REPORT_EXAMPLE.dart** - مثال پیادهسازی Flutter
|
||
3. **CHANGELOG.md** (این فایل) - خلاصه تغییرات
|
||
|
||
---
|
||
|
||
## ✅ Checklist پیادهسازی
|
||
|
||
- [x] Domain Models
|
||
- [x] Database Mappings
|
||
- [x] Repository Pattern
|
||
- [x] Application Services
|
||
- [x] API Endpoints
|
||
- [x] Admin UI Pages
|
||
- [x] Dependency Injection
|
||
- [x] Error Handling
|
||
- [x] Documentation
|
||
- [x] Flutter Example
|
||
- [ ] Database Migration (باید دستی اجرا شود)
|
||
- [ ] Testing
|
||
|
||
---
|
||
|
||
## 🎯 مراحل بعدی
|
||
|
||
1. **اجرای Migration:**
|
||
```powershell
|
||
Add-Migration AddBugReportSystem
|
||
Update-Database
|
||
```
|
||
|
||
2. **تست API:**
|
||
- استفاده از Postman/Thunder Client
|
||
- تست تمام endpoints
|
||
|
||
3. **تست Admin Panel:**
|
||
- دسترسی به /AdminNew/BugReport
|
||
- تست فیلترها و جستجو
|
||
- تست ویرایش و حذف
|
||
|
||
4. **Integration Flutter:**
|
||
- کپی کردن `FLUTTER_BUG_REPORT_EXAMPLE.dart`
|
||
- سازگار کردن با پروژه Flutter
|
||
- تست ثبت گزارشها
|
||
|
||
---
|
||
|
||
## 📞 پشتیبانی
|
||
|
||
برای هر سوال یا مشکل:
|
||
1. بررسی کنید `BUG_REPORT_SYSTEM.md`
|
||
2. بررسی کنید logs و error messages
|
||
3. مطمئن شوید Migration اجرا شده است
|
||
|