add subscription service proto

This commit is contained in:
daniel.w 2024-10-25 15:14:56 +08:00
parent d0a6f9e0ec
commit 7cf7dd6f4c
1 changed files with 117 additions and 7 deletions

View File

@ -203,6 +203,8 @@ message UnavailableBalance{
string unconfirmed = 2; // string unconfirmed = 2; //
} }
// TODO
service WalletService { service WalletService {
// CreateWallet // CreateWallet
rpc CreateWallet(CreateWalletReq) returns (OKResp); rpc CreateWallet(CreateWalletReq) returns (OKResp);
@ -228,14 +230,122 @@ service WalletService {
rpc QueryBalance(QueryBalanceByDateReq) returns (QueryBalanceByDateResp); rpc QueryBalance(QueryBalanceByDateReq) returns (QueryBalanceByDateResp);
} }
// ->
//
//
// ========== =========== // ========== ===========
service InventoryService {}
message StockAdjustmentReq {
string product_id = 1; // ID
int64 quantity = 2; // 調 ()
}
message StockQueryReq {
string product_id = 1; // ID
}
message StockResp {
string product_id = 1; // ID
int64 available_quantity = 2; //
int64 reserved_quantity = 3; //
}
message StockListResp {
repeated StockResp stock_items = 1; //
Pager page =2;
}
message StockReservationReq {
string product_id = 1; // ID
int64 quantity = 2; //
}
message BatchStockAdjustmentReq {
repeated StockAdjustmentReq adjustments = 1; // 調
}
service InventoryService {
// AddStock
rpc AddStock(StockAdjustmentReq) returns (OKResp);
// ReduceStock
rpc ReduceStock(StockAdjustmentReq) returns (OKResp);
// QueryStock
rpc QueryStock(StockQueryReq) returns (StockResp);
// ListAllStock
rpc ListAllStock(NoneReq) returns (StockListResp);
// ReserveStock ()
rpc ReserveStock(StockReservationReq) returns (OKResp);
// ReleaseReservedStock ()
rpc ReleaseReservedStock(StockReservationReq) returns (OKResp);
// AdjustStock 調 ()
rpc AdjustStock(BatchStockAdjustmentReq) returns (OKResp);
}
// ========== =========== // ========== ===========
service ProductService {} service ProductService {}
// ========== =========== // ========== ===========
service SubscriptionService {}
//
message SubscriptionCreateReq {
string user_id = 1; // 使ID
string plan_id = 2; // ID
string start_date = 3; //
}
message SubscriptionUpdateReq {
string subscription_id = 1; // ID
string plan_id = 2; // ID
}
message SubscriptionCancelReq {
string subscription_id = 1; // ID
}
message SubscriptionQueryReq {
string subscription_id = 1; // ID
}
message SubscriptionResp {
string subscription_id = 1; // ID
string user_id = 2; // 使ID
string plan_id = 3; // ID
string start_date = 4; //
string end_date = 5; //
string status = 6; // (: "active", "expired", "canceled")
}
message SubscriptionListResp {
repeated SubscriptionResp subscriptions = 1; //
}
message SubscriptionRenewReq {
string subscription_id = 1; // ID
string renewal_date = 2; //
}
message SubscriptionStatusQueryReq {
string subscription_id = 1; // ID
}
message SubscriptionStatusResp {
string subscription_id = 1; // ID
string status = 2; //
string message = 3; //
}
service SubscriptionService {
// CreateSubscription
rpc CreateSubscription(SubscriptionCreateReq) returns (SubscriptionResp);
// UpdateSubscription
rpc UpdateSubscription(SubscriptionUpdateReq) returns (SubscriptionResp);
// CancelSubscription
rpc CancelSubscription(SubscriptionCancelReq) returns (OKResp);
// QuerySubscription
rpc QuerySubscription(SubscriptionQueryReq) returns (SubscriptionResp);
// ListSubscriptions ()
rpc ListSubscriptions(NoneReq) returns (SubscriptionListResp);
// RenewSubscription
rpc RenewSubscription(SubscriptionRenewReq) returns (SubscriptionResp);
// CheckSubscriptionStatus (//)
rpc CheckSubscriptionStatus(SubscriptionStatusQueryReq) returns (SubscriptionStatusResp);
// RefreshSubscriptionStatus cron 5
rpc RefreshSubscriptionStatus(NoneReq) returns (OKResp);
}