add product service proto

This commit is contained in:
daniel.w 2024-10-25 15:21:57 +08:00
parent 7cf7dd6f4c
commit e01d14ab90
1 changed files with 80 additions and 2 deletions

View File

@ -280,7 +280,77 @@ service InventoryService {
}
// ========== ===========
service ProductService {}
//
message ProductCreateReq {
string name = 1; //
string category = 2; //
string description = 3; //
double price = 4; //
}
message ProductUpdateReq {
string product_id = 1; // ID
string name = 2; //
string category = 3; //
string description = 4; //
double price = 5; //
}
message ProductDeleteReq {
string product_id = 1; // ID
}
message ProductQueryReq {
string product_id = 1; // ID
}
message ProductResp {
string product_id = 1; // ID
string name = 2; //
string category = 3; //
string description = 4; //
double price = 5; //
bool is_available = 6; //
}
message ProductListResp {
repeated ProductResp products = 1; //
}
message CategoryQueryReq {
string category = 1; //
}
message ProductPriceUpdateReq {
string product_id = 1; // ID
double new_price = 2; //
}
message ProductStatusUpdateReq {
string product_id = 1; // ID
bool is_available = 2; //
}
service ProductService {
// CreateProduct
rpc CreateProduct(ProductCreateReq) returns (ProductResp);
// UpdateProduct
rpc UpdateProduct(ProductUpdateReq) returns (ProductResp);
// DeleteProduct
rpc DeleteProduct(ProductDeleteReq) returns (OKResp);
// QueryProduct
rpc QueryProduct(ProductQueryReq) returns (ProductResp);
// ListAllProducts
rpc ListAllProducts(NoneReq) returns (ProductListResp);
// ListProductsByCategory
rpc ListProductsByCategory(CategoryQueryReq) returns (ProductListResp);
// UpdateProductPrice
rpc UpdateProductPrice(ProductPriceUpdateReq) returns (OKResp);
// UpdateProductStatus (/)
rpc UpdateProductStatus(ProductStatusUpdateReq) returns (OKResp);
}
// ========== ===========
//
@ -312,8 +382,16 @@ message SubscriptionResp {
string status = 6; // (: "active", "expired", "canceled")
}
message ListSubscriptionsReq {
int64 page_index=1;
int64 page_size=2;
optional string uid=3;
}
message SubscriptionListResp {
repeated SubscriptionResp subscriptions = 1; //
Pager page = 2;
}
message SubscriptionRenewReq {
@ -341,7 +419,7 @@ service SubscriptionService {
// QuerySubscription
rpc QuerySubscription(SubscriptionQueryReq) returns (SubscriptionResp);
// ListSubscriptions ()
rpc ListSubscriptions(NoneReq) returns (SubscriptionListResp);
rpc ListSubscriptions(ListSubscriptionsReq) returns (SubscriptionListResp);
// RenewSubscription
rpc RenewSubscription(SubscriptionRenewReq) returns (SubscriptionResp);
// CheckSubscriptionStatus (//)