feat: Add discount module with protobuf definitions and gRPC services
This commit is contained in:
@@ -0,0 +1,152 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package discountproduct;
|
||||
|
||||
import "public_messages.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
option csharp_namespace = "BackOffice.BFF.DiscountProduct.Protobuf.Protos.DiscountProduct";
|
||||
|
||||
service DiscountProductContract
|
||||
{
|
||||
rpc CreateDiscountProduct(CreateDiscountProductRequest) returns (CreateDiscountProductResponse){
|
||||
option (google.api.http) = {
|
||||
post: "/CreateDiscountProduct"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc UpdateDiscountProduct(UpdateDiscountProductRequest) returns (google.protobuf.Empty){
|
||||
option (google.api.http) = {
|
||||
put: "/UpdateDiscountProduct"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc DeleteDiscountProduct(DeleteDiscountProductRequest) returns (google.protobuf.Empty){
|
||||
option (google.api.http) = {
|
||||
delete: "/DeleteDiscountProduct"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc GetDiscountProductById(GetDiscountProductByIdRequest) returns (GetDiscountProductByIdResponse){
|
||||
option (google.api.http) = {
|
||||
get: "/GetDiscountProductById"
|
||||
};
|
||||
};
|
||||
rpc GetDiscountProducts(GetDiscountProductsRequest) returns (GetDiscountProductsResponse){
|
||||
option (google.api.http) = {
|
||||
get: "/GetDiscountProducts"
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
// Create Product
|
||||
message CreateDiscountProductRequest
|
||||
{
|
||||
string title = 1;
|
||||
string short_infomation = 2;
|
||||
string full_information = 3;
|
||||
int64 price = 4;
|
||||
int32 max_discount_percent = 5;
|
||||
string image_path = 6;
|
||||
string thumbnail_path = 7;
|
||||
int32 initial_count = 8;
|
||||
int32 sort_order = 9;
|
||||
bool is_active = 10;
|
||||
repeated int64 category_ids = 11;
|
||||
}
|
||||
|
||||
message CreateDiscountProductResponse
|
||||
{
|
||||
int64 product_id = 1;
|
||||
}
|
||||
|
||||
// Update Product
|
||||
message UpdateDiscountProductRequest
|
||||
{
|
||||
int64 product_id = 1;
|
||||
string title = 2;
|
||||
string short_infomation = 3;
|
||||
string full_information = 4;
|
||||
int64 price = 5;
|
||||
int32 max_discount_percent = 6;
|
||||
string image_path = 7;
|
||||
string thumbnail_path = 8;
|
||||
int32 sort_order = 9;
|
||||
bool is_active = 10;
|
||||
repeated int64 category_ids = 11;
|
||||
}
|
||||
|
||||
// Delete Product
|
||||
message DeleteDiscountProductRequest
|
||||
{
|
||||
int64 product_id = 1;
|
||||
}
|
||||
|
||||
// Get Product By Id
|
||||
message GetDiscountProductByIdRequest
|
||||
{
|
||||
int64 product_id = 1;
|
||||
int64 user_id = 2; // Optional for view count tracking
|
||||
}
|
||||
|
||||
message GetDiscountProductByIdResponse
|
||||
{
|
||||
int64 id = 1;
|
||||
string title = 2;
|
||||
string short_infomation = 3;
|
||||
string full_information = 4;
|
||||
int64 price = 5;
|
||||
int32 max_discount_percent = 6;
|
||||
string image_path = 7;
|
||||
string thumbnail_path = 8;
|
||||
int32 remaining_count = 9;
|
||||
int32 view_count = 10;
|
||||
int32 sort_order = 11;
|
||||
bool is_active = 12;
|
||||
repeated CategoryInfo categories = 13;
|
||||
google.protobuf.Timestamp created = 14;
|
||||
}
|
||||
|
||||
message CategoryInfo
|
||||
{
|
||||
int64 id = 1;
|
||||
string name = 2;
|
||||
string title = 3;
|
||||
}
|
||||
|
||||
// Get Products with Filters
|
||||
message GetDiscountProductsRequest
|
||||
{
|
||||
google.protobuf.Int64Value category_id = 1;
|
||||
google.protobuf.StringValue search_query = 2;
|
||||
google.protobuf.Int64Value min_price = 3;
|
||||
google.protobuf.Int64Value max_price = 4;
|
||||
google.protobuf.BoolValue is_active = 5;
|
||||
google.protobuf.BoolValue in_stock = 6;
|
||||
int32 page_number = 7;
|
||||
int32 page_size = 8;
|
||||
}
|
||||
|
||||
message GetDiscountProductsResponse
|
||||
{
|
||||
messages.MetaData meta_data = 1;
|
||||
repeated DiscountProductDto models = 2;
|
||||
}
|
||||
|
||||
message DiscountProductDto
|
||||
{
|
||||
int64 id = 1;
|
||||
string title = 2;
|
||||
string short_infomation = 3;
|
||||
int64 price = 4;
|
||||
int32 max_discount_percent = 5;
|
||||
string image_path = 6;
|
||||
string thumbnail_path = 7;
|
||||
int32 remaining_count = 8;
|
||||
int32 view_count = 9;
|
||||
bool is_active = 10;
|
||||
google.protobuf.Timestamp created = 11;
|
||||
}
|
||||
Reference in New Issue
Block a user