feat: Implement User Package Status and User Order Management features

- Added GetUserPackageStatus functionality with mapping and service implementation.
- Introduced UserOrder service methods for updating order status, applying discounts, and calculating order PV.
- Created Protobuf definitions for public messages and user orders, including necessary request and response messages.
- Implemented mapping profiles for package and user order related queries and commands.
- Developed query handlers and validators for new commands and queries in the application layer.
- Established PublicMessage service for handling public messages with appropriate gRPC endpoints.
This commit is contained in:
masoodafar-web
2025-12-04 03:43:28 +03:30
parent 256b41fcb5
commit 4b6f8187e5
34 changed files with 884 additions and 18 deletions
@@ -62,6 +62,30 @@ service UserOrderContract
};
};
// Order Management
rpc UpdateOrderStatus(UpdateOrderStatusRequest) returns (UpdateOrderStatusResponse){
option (google.api.http) = {
post: "/UpdateOrderStatus"
body: "*"
};
};
rpc GetOrdersByDateRange(GetOrdersByDateRangeRequest) returns (GetOrdersByDateRangeResponse){
option (google.api.http) = {
get: "/GetOrdersByDateRange"
};
};
rpc ApplyDiscountToOrder(ApplyDiscountToOrderRequest) returns (ApplyDiscountToOrderResponse){
option (google.api.http) = {
post: "/ApplyDiscountToOrder"
body: "*"
};
};
rpc CalculateOrderPV(CalculateOrderPVRequest) returns (CalculateOrderPVResponse){
option (google.api.http) = {
get: "/CalculateOrderPV"
};
};
}
message CreateNewUserOrderRequest
{
@@ -229,6 +253,88 @@ message MetaData
bool has_next = 6;
}
// Order Management Messages
message UpdateOrderStatusRequest
{
int64 order_id = 1;
int32 new_status = 2;
}
message UpdateOrderStatusResponse
{
bool success = 1;
string message = 2;
int32 old_status = 3;
int32 new_status = 4;
}
message GetOrdersByDateRangeRequest
{
google.protobuf.Timestamp start_date = 1;
google.protobuf.Timestamp end_date = 2;
google.protobuf.Int32Value status = 3;
google.protobuf.Int64Value user_id = 4;
int32 page_number = 5;
int32 page_size = 6;
}
message GetOrdersByDateRangeResponse
{
MetaData meta_data = 1;
repeated OrderSummaryDto orders = 2;
}
message OrderSummaryDto
{
int64 order_id = 1;
string order_number = 2;
int64 user_id = 3;
string user_full_name = 4;
int64 total_amount = 5;
int32 status = 6;
string status_name = 7;
int32 items_count = 8;
google.protobuf.Timestamp created_at = 9;
}
message ApplyDiscountToOrderRequest
{
int64 order_id = 1;
int64 discount_amount = 2;
string reason = 3;
}
message ApplyDiscountToOrderResponse
{
bool success = 1;
string message = 2;
int64 original_amount = 3;
int64 discount_amount = 4;
int64 final_amount = 5;
}
message CalculateOrderPVRequest
{
int64 order_id = 1;
}
message CalculateOrderPVResponse
{
int64 order_id = 1;
int64 total_pv = 2;
repeated ProductPVDto products = 3;
}
message ProductPVDto
{
int64 product_id = 1;
string product_title = 2;
int32 quantity = 3;
int64 unit_pv = 4;
int64 total_pv = 5;
}
message DecimalValue
{