feat: Implement Discount Product and Shopping Cart functionalities

- Added UpdateDiscountProductCommandValidator for validating discount product updates.
- Created GetDiscountProductByIdQuery and its handler for retrieving discount product details by ID.
- Implemented GetDiscountProductsQuery and handler for fetching a list of discount products with filtering options.
- Developed AddToCartCommand and handler for adding products to the shopping cart.
- Implemented ClearCartCommand and handler for clearing the shopping cart.
- Created RemoveFromCartCommand and handler for removing items from the cart.
- Added UpdateCartItemCountCommand and handler for updating the quantity of items in the cart.
- Developed GetUserCartQuery and handler for retrieving the user's shopping cart details.
- Implemented Product Tag functionalities including assigning tags to products, creating, updating, and deleting tags.
- Added queries for fetching all tags and products by tag.
This commit is contained in:
masoodafar-web
2025-12-04 02:41:19 +03:30
parent c9dab944fa
commit 4f400eabc5
92 changed files with 2285 additions and 41 deletions

View File

@@ -48,6 +48,8 @@ service CommissionContract
};
rpc GetWorkerExecutionLogs(GetWorkerExecutionLogsRequest) returns (GetWorkerExecutionLogsResponse){
};
rpc GetWithdrawalReports(GetWithdrawalReportsRequest) returns (GetWithdrawalReportsResponse){
};
}
// ============ Commands ============
@@ -347,3 +349,47 @@ message WorkerExecutionLogModel
int32 records_processed = 9;
google.protobuf.StringValue details = 10; // JSON or text details
}
// GetWithdrawalReports Query
message GetWithdrawalReportsRequest
{
google.protobuf.Timestamp start_date = 1; // Optional - default: 30 days ago
google.protobuf.Timestamp end_date = 2; // Optional - default: today
int32 period_type = 3; // ReportPeriodType: Daily=1, Weekly=2, Monthly=3
google.protobuf.Int32Value status = 4; // CommissionPayoutStatus enum (optional)
google.protobuf.Int64Value user_id = 5; // Optional user filter
}
message GetWithdrawalReportsResponse
{
repeated PeriodReport period_reports = 1;
WithdrawalSummary summary = 2;
}
message PeriodReport
{
string period_label = 1; // e.g., "2025-01-15", "هفته 3", "فروردین 1404"
google.protobuf.Timestamp start_date = 2;
google.protobuf.Timestamp end_date = 3;
int32 total_requests = 4;
int32 pending_count = 5;
int32 approved_count = 6;
int32 rejected_count = 7;
int32 completed_count = 8;
int32 failed_count = 9;
int64 total_amount = 10;
int64 paid_amount = 11;
int64 pending_amount = 12;
}
message WithdrawalSummary
{
int32 total_requests = 1;
int64 total_amount = 2;
int64 total_paid = 3;
int64 total_pending = 4;
int64 total_rejected = 5;
int64 average_amount = 6;
int32 unique_users = 7;
float success_rate = 8; // Percentage (0-100)
}