app-cloudep-product-service/generate/protobuf/product.proto

323 lines
8.4 KiB
Protocol Buffer
Raw Normal View History

2025-03-12 14:05:38 +00:00
syntax = "proto3";
package product;
option go_package="./product";
2025-04-06 02:08:46 +00:00
// OKResp
message OKResp {}
// NoneReq
message NoneReq {}
2025-04-09 14:46:53 +00:00
// ====================== Category ======================
2025-04-06 02:08:46 +00:00
message CreateCategoryReq {
string name = 1;
}
2025-04-08 02:06:40 +00:00
message ModifyCategoryReq {
string id =1;
string name = 2;
}
message CategoryReq {
string id =1;
}
message Category {
string id =1;
string name =2;
int64 create_time=3;
int64 update_time=4;
}
message ListCategoryReq {
int64 page_index =1;
int64 page_size =2;
repeated string ids=3;
}
message ListCategoryResp {
int64 total =1;
repeated Category data=3;
}
2025-04-09 14:46:53 +00:00
service Category_Service {
// Create 建立 product 分類
rpc Create(CreateCategoryReq) returns(OKResp);
// Modify 修改 product 分類名稱
rpc Modify(ModifyCategoryReq) returns(OKResp);
// Delete 刪除 product 分類
rpc Delete(CategoryReq) returns(OKResp);
// Get 取得 product 分類
rpc Get(CategoryReq) returns(Category);
// List 建立 product 分類
rpc List(ListCategoryReq) returns(ListCategoryResp);
}
2025-04-08 03:49:07 +00:00
// ====================== Tags Param ======================
message CreateTagsReq{
2025-04-09 14:46:53 +00:00
string types=1;
2025-04-08 03:49:07 +00:00
string name=2;
2025-04-09 14:46:53 +00:00
string show_type=3;
2025-04-08 03:49:07 +00:00
optional string cover=4;
}
2025-04-08 02:06:40 +00:00
2025-04-08 03:49:07 +00:00
message ModifyTagsReq{
string id=1;
2025-04-09 14:46:53 +00:00
optional string types=2;
2025-04-08 03:49:07 +00:00
optional string name=3;
2025-04-09 14:46:53 +00:00
optional string show_type=4;
2025-04-08 03:49:07 +00:00
optional string cover=5;
}
message TagsReq {
string id =1;
}
message Tags{
string id=1;
2025-04-09 14:46:53 +00:00
string types=2;
2025-04-08 03:49:07 +00:00
string name=3;
2025-04-09 14:46:53 +00:00
string show_type=4;
2025-04-08 03:49:07 +00:00
string cover=5;
int64 update_at=6;
int64 created_at=7;
}
message ListTagsReq {
int64 page_index =1;
int64 page_size =2;
repeated string ids=3;
optional string name=4;
2025-04-09 14:46:53 +00:00
optional string types=5;
optional string show_type=6;
2025-04-08 03:49:07 +00:00
}
message ListTagsResp {
int64 total =1;
repeated Tags data=3;
}
2025-04-08 02:06:40 +00:00
2025-04-09 14:46:53 +00:00
service Tag_Service {
// CreateTags 建立 tags
rpc Create(CreateTagsReq) returns(OKResp);
// ModifyTags 修改 tags
rpc Modify(ModifyTagsReq) returns(OKResp);
// DeleteTags 刪除tags
rpc Delete(TagsReq) returns(OKResp);
// GetTags 取得 tags
rpc Get(TagsReq) returns(Tags);
// ListTags 建立 tags
rpc List(ListTagsReq) returns(ListTagsResp);
}
2025-04-08 09:20:34 +00:00
// ====================== KYC Param ======================
2025-04-09 14:46:53 +00:00
message Kyc {
2025-04-08 09:20:34 +00:00
string id = 1; // MongoDB ObjectID 字串格式
string uid = 2; // 驗證人 UID
string country_region = 3; // 地區(例如 "TW", "JP", "US"...
string name = 4; // 真實姓名
string identification = 5; // 身分證字號 or 護照號碼
string identification_type = 6; // ID 類型ID_CARD, PASSPORT, RESIDENT_CERT
string address = 7; // 戶籍地址(或居住地址)
string postal_code = 8; // 郵遞區號(海外使用)
string id_front_image = 9; // 身分證/護照 正面
string id_back_image = 10; // 身分證/居留證 反面
string bank_statement_img = 11; // 銀行存摺封面照
string bank_code = 12; // 銀行代碼(可為 SWIFT
string bank_name = 13; // 銀行名稱(顯示用)
string branch_code = 14; // 分行代碼
string branch_name = 15; // 分行名稱(顯示用)
string bank_account = 16; // 銀行帳號
string status = 17; // 審核狀態PENDING, APPROVED, REJECTED
string reject_reason = 18; // 若被駁回,原因描述
int64 updated_at = 19; // 更新時間timestamp
int64 created_at = 20; // 建立時間timestamp
}
2025-04-09 14:46:53 +00:00
message CreateKycReq {
2025-04-08 09:20:34 +00:00
string uid = 1;
string country_region = 2;
string name = 3;
string identification = 4;
string identification_type = 5;
string address = 6;
string postal_code = 7;
string id_front_image = 8;
string id_back_image = 9;
string bank_statement_img = 10;
string bank_code = 11;
string bank_name = 12;
string branch_code = 13;
string branch_name = 14;
string bank_account = 15;
}
2025-04-09 14:46:53 +00:00
message FindLatestKycByUIDReq {
2025-04-08 09:20:34 +00:00
string uid = 1;
}
2025-04-09 14:46:53 +00:00
message FindKycByIDReq {
2025-04-08 09:20:34 +00:00
string id = 1;
}
2025-04-09 14:46:53 +00:00
message ListKycReq {
2025-04-08 09:20:34 +00:00
optional string uid = 1;
optional string country = 2;
optional string status = 3; // 可改 enum
int64 page_size = 4;
int64 page_index = 5;
bool sort_by_date = 6;
}
2025-04-09 14:46:53 +00:00
message ListKycResp {
repeated Kyc list = 1;
2025-04-08 09:20:34 +00:00
int64 total = 2;
}
2025-04-09 14:46:53 +00:00
message UpdateKycStatusReq {
2025-04-08 09:20:34 +00:00
string id = 1;
string status = 2; // 可改 enumPENDING, APPROVED, REJECTED
optional string reason = 3;
}
2025-04-09 14:46:53 +00:00
message UpdateKycInfoReq {
2025-04-08 09:20:34 +00:00
string id = 1;
optional string name = 2;
optional string identification = 3;
optional string identification_type = 4;
optional string address = 5;
optional string postal_code = 6;
optional string id_front_image = 7;
optional string id_back_image = 8;
optional string bank_statement_img = 9;
optional string bank_code = 10;
optional string bank_name = 11;
optional string branch_code = 12;
optional string branch_name = 13;
optional string bank_account = 14;
}
2025-04-09 14:46:53 +00:00
service Kyc_Service{
// Create 建立 KYC 資料
rpc Create (CreateKycReq) returns (OKResp);
// FindLatestByUID 根據使用者 UID 查詢最新 KYC 紀錄
rpc FindLatestByUid (FindLatestKycByUIDReq) returns (Kyc);
// FindByID 根據 KYC ID 查詢
rpc FindById (FindKycByIDReq) returns (Kyc);
// List 分頁查詢 Kyc 清單(後台審核用)
rpc List (ListKycReq) returns (ListKycResp);
// UpdateStatus 更新 Kyc 審核狀態與原因
rpc UpdateStatus (UpdateKycStatusReq) returns (OKResp);
// Update 更新使用者的 Kyc尚未審核
rpc Update (UpdateKycInfoReq) returns (OKResp);
}
2025-04-09 09:29:56 +00:00
// ====================== Product Item Param ======================
message ProductItem {
optional string id = 1;
string reference_id = 2;
string name = 3;
string description = 4;
string short_description = 5;
bool is_un_limit = 6;
bool is_free = 7;
uint64 stock = 8;
string price = 9;
string sku = 10;
string time_series = 11;
repeated Media media = 12;
string status = 13;
repeated CustomField freight = 14;
repeated CustomField custom_fields = 15;
uint64 sales_count = 16;
2025-04-09 14:46:53 +00:00
optional int64 updated_at = 17;
optional int64 created_at = 18;
2025-04-09 09:29:56 +00:00
}
message Media {
string url = 1;
string type = 2;
optional uint64 sort=3;
}
message CustomField {
string key = 1;
string value = 2;
}
message CreateProductItemRequest {
ProductItem item = 1;
}
2025-04-08 09:20:34 +00:00
2025-04-09 09:29:56 +00:00
message GetProductItemRequest {
string id = 1;
}
message ListProductItemRequest {
int64 page_size = 1;
int64 page_index = 2;
string reference_id = 3;
optional bool is_un_limit = 4;
optional bool is_free = 5;
optional string status = 6;
}
message ListProductItemResponse{
repeated ProductItem data = 1;
int64 total = 2;
}
message DeleteProductItemRequest {
repeated string id = 1;
}
message DeleteProductItemsByReferenceIDReq {
string id = 1;
}
message IncDecSalesCountRequest {
string id = 1;
uint64 count = 2;
}
2025-04-09 14:55:58 +00:00
2025-04-09 09:29:56 +00:00
message UpdateProductItemRequest {
string id = 1;
optional string name = 2;
optional string description = 3;
optional string short_description = 4;
optional bool is_un_limit = 5;
optional bool is_free = 6;
optional uint64 stock = 7;
optional string price = 8;
optional string sku = 9;
optional string time_series = 10;
repeated Media media = 11;
optional string status = 12;
repeated CustomField freight = 13;
repeated CustomField custom_fields = 14;
}
message UpdateStatusRequest {
string id = 1;
string status = 2;
}
2025-04-08 09:20:34 +00:00
2025-04-09 14:46:53 +00:00
service Product_Item_Service {
// Create 建立 ProductItem
rpc Create(CreateProductItemRequest) returns (OKResp);
2025-04-09 09:29:56 +00:00
// GetProductItem 取得 ProductItem
2025-04-09 14:46:53 +00:00
rpc Get(GetProductItemRequest) returns (ProductItem);
// ListByProductId 使用 ProductID 取得 ProductItems
rpc ListByProductId(ListProductItemRequest) returns (ListProductItemResponse);
// Delete 刪除 Delete Product Item
rpc Delete(DeleteProductItemRequest) returns (OKResp);
// DeleteByReferenceId 使用 ProductID 刪除所有 Item
rpc DeleteByReferenceId(DeleteProductItemsByReferenceIDReq) returns (OKResp);
2025-04-09 09:29:56 +00:00
// IncSalesCount 增加賣出數量
rpc IncSalesCount(IncDecSalesCountRequest) returns (OKResp);
// DecSalesCount 減少賣出數量
rpc DecSalesCount(IncDecSalesCountRequest) returns (OKResp);
// Update 更新 Item
rpc Update(UpdateProductItemRequest) returns (OKResp);
// UpdateStatus 更新 Item status
rpc UpdateStatus(UpdateStatusRequest) returns (OKResp);
2025-04-08 09:20:34 +00:00
}
2025-04-09 14:55:58 +00:00
// ====================== Product Param ======================