feat: Implement Discount Shop Completion Plan with Product Image Gallery, Admin APIs, VAT Calculation, and Sales Reports

- Added DiscountProductImage entity and related configurations for product image gallery.
- Created commands and queries for managing product images.
- Developed GetAllDiscountOrders API for admin order management with various filters.
- Implemented VAT calculation service and integrated it into order processing.
- Created Sales Reports API with support for daily, weekly, and monthly reports.
- Completed gRPC services for BackOffice.BFF to expose new APIs.
- Updated Proto files and project references accordingly.
This commit is contained in:
masoodafar-web
2026-01-02 00:46:08 +03:30
parent df650c3886
commit 73e1971cc3
11 changed files with 3658 additions and 54 deletions
+174
View File
@@ -0,0 +1,174 @@
# 📝 Changelog - ۲۳ دی ۱۴۰۴ (13 January 2025)
> **Session**: تکمیل BackOffice.BFF WebApi Services برای Discount Shop
---
## 🎯 خلاصه تغییرات
تکمیل لایه gRPC Services برای BackOffice.BFF - بخش فروشگاه تخفیفی
---
## 🆕 WebApi Services جدید
### DiscountCategoryService.cs
**مسیر**: `BackOffice.BFF.WebApi/Services/DiscountCategoryService.cs`
| RPC | Command/Query |
|-----|---------------|
| `Create` | `CreateDiscountCategoryCommand` |
| `Update` | `UpdateDiscountCategoryCommand` |
| `Delete` | `DeleteDiscountCategoryCommand` |
| `GetDiscountCategories` | `GetDiscountCategoriesQuery` |
---
### DiscountShoppingCartService.cs
**مسیر**: `BackOffice.BFF.WebApi/Services/DiscountShoppingCartService.cs`
| RPC | Command/Query |
|-----|---------------|
| `AddToCart` | `AddToCartCommand` |
| `RemoveFromCart` | `RemoveFromCartCommand` |
| `UpdateCartItemCount` | `UpdateCartItemCountCommand` |
| `GetUserCart` | `GetUserCartQuery` |
| `ClearCart` | `ClearCartCommand` |
**توضیح**: این سرویس برای مدیریت سبد خرید کاربران توسط پشتیبانی/ادمین استفاده می‌شود.
---
### TagService.cs
**مسیر**: `BackOffice.BFF.WebApi/Services/TagService.cs`
| RPC | Command/Query |
|-----|---------------|
| `Create` | `CreateTagCommand` |
| `Update` | `UpdateTagCommand` |
| `Delete` | `DeleteTagCommand` |
| `Get` | `GetTagQuery` |
| `GetAll` | `GetAllTagsQuery` |
| `GetProductsByTag` | `GetProductsByTagQuery` |
---
### ProductTagService.cs
**مسیر**: `BackOffice.BFF.WebApi/Services/ProductTagService.cs`
| RPC | Command/Query |
|-----|---------------|
| `CreateNewProductTag` | `CreateProductTagCommand` |
| `UpdateProductTag` | `UpdateProductTagCommand` |
| `DeleteProductTag` | `DeleteProductTagCommand` |
| `GetProductTag` | `GetProductTagQuery` |
| `GetAllProductTagByFilter` | `GetAllProductTagsQuery` |
---
## 🔧 تغییرات Application Layer
### Handlers جدید ایجاد شده
#### ProductTagCQ/Commands/UpdateProductTag/
- `UpdateProductTagCommand.cs`
- `UpdateProductTagCommandHandler.cs`
#### ProductTagCQ/Commands/DeleteProductTag/
- `DeleteProductTagCommand.cs`
- `DeleteProductTagCommandHandler.cs`
#### ProductTagCQ/Queries/GetProductTag/
- `GetProductTagQuery.cs`
- `GetProductTagQueryHandler.cs`
#### ProductTagCQ/Queries/GetAllProductTags/
- `GetAllProductTagsQuery.cs`
- `GetAllProductTagsQueryHandler.cs`
---
### DiscountShoppingCartCQ - اصلاحات Proto
#### فایل‌های تغییر یافته:
**RemoveFromCartCommand.cs**
```diff
- public long CartItemId { get; init; }
+ public long ProductId { get; init; }
```
**UpdateCartItemCountCommand.cs**
```diff
- public long CartItemId { get; init; }
+ public long ProductId { get; init; }
```
**GetUserCartResponseDto.cs**
```diff
- public long UserId { get; set; }
- public long TotalDiscountedPrice { get; set; }
- public long TotalSavings { get; set; }
+ public long TotalDiscountAmount { get; set; }
+ public long FinalPrice { get; set; }
```
**CartItemDto**
```diff
- public long Id { get; set; }
- public long DiscountedPrice { get; set; }
- public DateTime AddedAt { get; set; }
+ public long DiscountAmount { get; set; }
+ public long FinalPrice { get; set; }
+ public int ProductRemainingCount { get; set; }
+ public DateTime Created { get; set; }
```
---
## 📦 تغییرات Proto Projects
### csproj تغییر یافته (GrpcServices: Client → Both)
- `BackOffice.BFF.DiscountCategory.Protobuf.csproj`
- `BackOffice.BFF.DiscountShoppingCart.Protobuf.csproj`
- `BackOffice.BFF.Tag.Protobuf.csproj`
- `BackOffice.BFF.ProductTag.Protobuf.csproj`
### WebApi.csproj - References اضافه شده
```xml
<ProjectReference Include="..\Protobufs\BackOffice.BFF.DiscountCategory.Protobuf\..." />
<ProjectReference Include="..\Protobufs\BackOffice.BFF.DiscountShoppingCart.Protobuf\..." />
<ProjectReference Include="..\Protobufs\BackOffice.BFF.Tag.Protobuf\..." />
<ProjectReference Include="..\Protobufs\BackOffice.BFF.ProductTag.Protobuf\..." />
```
---
## 🗑️ Excludes حذف شده
### BackOffice.BFF.Application.csproj
```diff
- <Compile Remove="DiscountShoppingCartCQ/**/*.cs" />
+ <!-- All excluded handlers have been enabled -->
```
---
## 📊 آمار نهایی
| متریک | مقدار |
|--------|-------|
| Services جدید | 4 |
| Handlers جدید | 8 |
| فایل‌های اصلاح شده | 12 |
| Proto projects تنظیم شده | 4 |
---
## ✅ نتیجه Build
```
Build succeeded.
177 Warning(s)
0 Error(s)
```