feat: Implement Public Message Management Commands and Queries
- Add GetUserPackageStatusQueryValidator for user package status validation. - Create ArchiveMessageCommand and ArchiveMessageCommandHandler for archiving public messages. - Implement ArchiveMessageCommandValidator to validate message ID. - Introduce PublishMessageCommand and PublishMessageCommandHandler for publishing messages. - Add PublishMessageCommandValidator for validating publish message requests. - Implement GetPublicMessageQuery and GetPublicMessageQueryHandler for retrieving public messages. - Create GetPublicMessageQueryValidator for validating public message requests. - Add ApplyDiscountToOrderCommand and ApplyDiscountToOrderCommandHandler for applying discounts to orders. - Implement ApplyDiscountToOrderCommandValidator for validating discount application requests. - Create UpdateOrderStatusCommand and UpdateOrderStatusCommandHandler for changing order statuses. - Implement UpdateOrderStatusCommandValidator for validating order status updates. - Add CalculateOrderPVQuery and CalculateOrderPVQueryHandler for calculating order PV. - Implement CalculateOrderPVQueryValidator for validating PV calculation requests. - Create GetOrdersByDateRangeQuery and GetOrdersByDateRangeQueryHandler for retrieving orders by date range. - Implement GetOrdersByDateRangeQueryValidator for validating date range queries. - Add PublicMessage entity to represent public messages in the system. - Implement PublicMessageService for handling public message operations via gRPC.
This commit is contained in:
@@ -43,6 +43,25 @@ service PackageContract
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
// Package Purchase System
|
||||
rpc PurchaseGoldenPackage(PurchaseGoldenPackageRequest) returns (PurchaseGoldenPackageResponse){
|
||||
option (google.api.http) = {
|
||||
post: "/PurchaseGoldenPackage"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc VerifyGoldenPackagePurchase(VerifyGoldenPackagePurchaseRequest) returns (VerifyGoldenPackagePurchaseResponse){
|
||||
option (google.api.http) = {
|
||||
post: "/VerifyGoldenPackagePurchase"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc GetUserPackageStatus(GetUserPackageStatusRequest) returns (GetUserPackageStatusResponse){
|
||||
option (google.api.http) = {
|
||||
get: "/GetUserPackageStatus"
|
||||
};
|
||||
};
|
||||
}
|
||||
message CreateNewPackageRequest
|
||||
{
|
||||
@@ -106,3 +125,55 @@ message GetAllPackageByFilterResponseModel
|
||||
string image_path = 4;
|
||||
int64 price = 5;
|
||||
}
|
||||
|
||||
// Package Purchase Messages
|
||||
message PurchaseGoldenPackageRequest
|
||||
{
|
||||
int64 user_id = 1;
|
||||
int64 package_id = 2;
|
||||
string return_url = 3;
|
||||
}
|
||||
|
||||
message PurchaseGoldenPackageResponse
|
||||
{
|
||||
bool success = 1;
|
||||
string message = 2;
|
||||
int64 order_id = 3;
|
||||
string payment_gateway_url = 4;
|
||||
string tracking_code = 5;
|
||||
}
|
||||
|
||||
message VerifyGoldenPackagePurchaseRequest
|
||||
{
|
||||
int64 order_id = 1;
|
||||
string authority = 2;
|
||||
string status = 3;
|
||||
}
|
||||
|
||||
message VerifyGoldenPackagePurchaseResponse
|
||||
{
|
||||
bool success = 1;
|
||||
string message = 2;
|
||||
int64 order_id = 3;
|
||||
int64 transaction_id = 4;
|
||||
string reference_code = 5;
|
||||
int64 wallet_balance = 6;
|
||||
}
|
||||
|
||||
message GetUserPackageStatusRequest
|
||||
{
|
||||
int64 user_id = 1;
|
||||
}
|
||||
|
||||
message GetUserPackageStatusResponse
|
||||
{
|
||||
int64 user_id = 1;
|
||||
string package_purchase_method = 2;
|
||||
bool has_purchased_package = 3;
|
||||
bool is_club_member_active = 4;
|
||||
int64 wallet_balance = 5;
|
||||
int64 discount_balance = 6;
|
||||
bool can_activate_club_membership = 7;
|
||||
google.protobuf.StringValue last_order_number = 8;
|
||||
google.protobuf.Timestamp last_purchase_date = 9;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,60 @@ syntax = "proto3";
|
||||
|
||||
package messages;
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
option csharp_namespace = "CMSMicroservice.Protobuf.Protos";
|
||||
service PublicMessageContract{}
|
||||
|
||||
service PublicMessageContract{
|
||||
rpc CreatePublicMessage(CreatePublicMessageRequest) returns (CreatePublicMessageResponse){
|
||||
option (google.api.http) = {
|
||||
post: "/CreatePublicMessage"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc UpdatePublicMessage(UpdatePublicMessageRequest) returns (google.protobuf.Empty){
|
||||
option (google.api.http) = {
|
||||
put: "/UpdatePublicMessage"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc DeletePublicMessage(DeletePublicMessageRequest) returns (google.protobuf.Empty){
|
||||
option (google.api.http) = {
|
||||
delete: "/DeletePublicMessage"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc PublishMessage(PublishMessageRequest) returns (PublishMessageResponse){
|
||||
option (google.api.http) = {
|
||||
post: "/PublishMessage"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc ArchiveMessage(ArchiveMessageRequest) returns (ArchiveMessageResponse){
|
||||
option (google.api.http) = {
|
||||
post: "/ArchiveMessage"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc GetAllMessages(GetAllMessagesRequest) returns (GetAllMessagesResponse){
|
||||
option (google.api.http) = {
|
||||
get: "/GetAllMessages"
|
||||
};
|
||||
};
|
||||
rpc GetActiveMessages(GetActiveMessagesRequest) returns (GetActiveMessagesResponse){
|
||||
option (google.api.http) = {
|
||||
get: "/GetActiveMessages"
|
||||
};
|
||||
};
|
||||
rpc GetPublicMessage(GetPublicMessageRequest) returns (GetPublicMessageResponse){
|
||||
option (google.api.http) = {
|
||||
get: "/GetPublicMessage"
|
||||
};
|
||||
};
|
||||
}
|
||||
message PaginationState
|
||||
{
|
||||
int32 page_number = 1;
|
||||
@@ -68,3 +120,151 @@ enum PaymentMethod
|
||||
IPG = 0;
|
||||
Wallet = 1;
|
||||
}
|
||||
|
||||
// Public Message Types
|
||||
message CreatePublicMessageRequest
|
||||
{
|
||||
string title = 1;
|
||||
string content = 2;
|
||||
int32 type = 3;
|
||||
int32 priority = 4;
|
||||
google.protobuf.Timestamp start_date = 5;
|
||||
google.protobuf.Timestamp end_date = 6;
|
||||
google.protobuf.StringValue link_url = 7;
|
||||
google.protobuf.StringValue link_text = 8;
|
||||
}
|
||||
|
||||
message CreatePublicMessageResponse
|
||||
{
|
||||
int64 id = 1;
|
||||
}
|
||||
|
||||
message UpdatePublicMessageRequest
|
||||
{
|
||||
int64 id = 1;
|
||||
string title = 2;
|
||||
string content = 3;
|
||||
int32 type = 4;
|
||||
int32 priority = 5;
|
||||
google.protobuf.Timestamp start_date = 6;
|
||||
google.protobuf.Timestamp end_date = 7;
|
||||
google.protobuf.StringValue link_url = 8;
|
||||
google.protobuf.StringValue link_text = 9;
|
||||
}
|
||||
|
||||
message DeletePublicMessageRequest
|
||||
{
|
||||
int64 message_id = 1;
|
||||
}
|
||||
|
||||
message PublishMessageRequest
|
||||
{
|
||||
int64 message_id = 1;
|
||||
}
|
||||
|
||||
message PublishMessageResponse
|
||||
{
|
||||
bool success = 1;
|
||||
string message = 2;
|
||||
google.protobuf.Timestamp published_at = 3;
|
||||
}
|
||||
|
||||
message ArchiveMessageRequest
|
||||
{
|
||||
int64 message_id = 1;
|
||||
}
|
||||
|
||||
message ArchiveMessageResponse
|
||||
{
|
||||
bool success = 1;
|
||||
string message = 2;
|
||||
google.protobuf.Timestamp archived_at = 3;
|
||||
}
|
||||
|
||||
message GetAllMessagesRequest
|
||||
{
|
||||
int32 page_number = 1;
|
||||
int32 page_size = 2;
|
||||
google.protobuf.BoolValue is_active = 3;
|
||||
google.protobuf.Int32Value type = 4;
|
||||
google.protobuf.Int32Value priority = 5;
|
||||
}
|
||||
|
||||
message GetAllMessagesResponse
|
||||
{
|
||||
MetaData meta_data = 1;
|
||||
repeated AdminPublicMessageDto messages = 2;
|
||||
}
|
||||
|
||||
message AdminPublicMessageDto
|
||||
{
|
||||
int64 id = 1;
|
||||
string title = 2;
|
||||
string content = 3;
|
||||
int32 type = 4;
|
||||
string type_name = 5;
|
||||
int32 priority = 6;
|
||||
string priority_name = 7;
|
||||
bool is_active = 8;
|
||||
google.protobuf.Timestamp starts_at = 9;
|
||||
google.protobuf.Timestamp expires_at = 10;
|
||||
int64 created_by_user_id = 11;
|
||||
int32 view_count = 12;
|
||||
google.protobuf.StringValue link_url = 13;
|
||||
google.protobuf.StringValue link_text = 14;
|
||||
google.protobuf.Timestamp created = 15;
|
||||
google.protobuf.Timestamp last_modified = 16;
|
||||
bool is_expired = 17;
|
||||
}
|
||||
|
||||
message GetActiveMessagesRequest
|
||||
{
|
||||
}
|
||||
|
||||
message GetActiveMessagesResponse
|
||||
{
|
||||
repeated PublicMessageDto messages = 1;
|
||||
}
|
||||
|
||||
message PublicMessageDto
|
||||
{
|
||||
int64 id = 1;
|
||||
string title = 2;
|
||||
string content = 3;
|
||||
int32 type = 4;
|
||||
string type_name = 5;
|
||||
int32 priority = 6;
|
||||
string priority_name = 7;
|
||||
google.protobuf.Timestamp starts_at = 8;
|
||||
google.protobuf.Timestamp expires_at = 9;
|
||||
google.protobuf.StringValue link_url = 10;
|
||||
google.protobuf.StringValue link_text = 11;
|
||||
google.protobuf.Timestamp created = 12;
|
||||
}
|
||||
|
||||
message GetPublicMessageRequest
|
||||
{
|
||||
int64 message_id = 1;
|
||||
}
|
||||
|
||||
message GetPublicMessageResponse
|
||||
{
|
||||
int64 id = 1;
|
||||
string title = 2;
|
||||
string content = 3;
|
||||
int32 type = 4;
|
||||
int32 priority = 5;
|
||||
bool is_active = 6;
|
||||
bool is_archived = 7;
|
||||
google.protobuf.Timestamp start_date = 8;
|
||||
google.protobuf.Timestamp end_date = 9;
|
||||
google.protobuf.Timestamp published_at = 10;
|
||||
google.protobuf.Timestamp archived_at = 11;
|
||||
int64 created_by_user_id = 12;
|
||||
int32 view_count = 13;
|
||||
google.protobuf.StringValue link_url = 14;
|
||||
google.protobuf.StringValue link_text = 15;
|
||||
google.protobuf.Timestamp created_at = 16;
|
||||
google.protobuf.Timestamp last_modified_at = 17;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,30 @@ service UserOrderContract
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
|
||||
// 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
|
||||
{
|
||||
@@ -247,3 +271,85 @@ message CancelOrderResponse
|
||||
string message = 3;
|
||||
bool refund_processed = 4;
|
||||
}
|
||||
|
||||
// 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
|
||||
{
|
||||
messages.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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user