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

328 lines
9.1 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-08 02:06:40 +00:00
// ====================== Category Param ======================
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-08 03:49:07 +00:00
// ====================== Tags Param ======================
2025-04-08 02:06:40 +00:00
2025-04-08 03:49:07 +00:00
message CreateTagsReq{
int32 types=1;
string name=2;
int64 show_type=3;
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;
optional int32 types=2;
optional string name=3;
optional int64 show_type=4;
optional string cover=5;
}
message TagsReq {
string id =1;
}
message Tags{
string id=1;
int32 types=2;
string name=3;
int64 show_type=4;
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;
optional int32 types=5;
optional int64 show_type=6;
}
message ListTagsResp {
int64 total =1;
repeated Tags data=3;
}
2025-04-08 02:06:40 +00:00
2025-04-08 09:20:34 +00:00
// ====================== KYC Param ======================
message KYC {
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
}
message CreateKYCReq {
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;
}
message FindLatestKYCByUIDReq {
string uid = 1;
}
message FindKYCByIDReq {
string id = 1;
}
message ListKYCReq {
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;
}
message ListKYCResp {
repeated KYC list = 1;
int64 total = 2;
}
message UpdateKYCStatusReq {
string id = 1;
string status = 2; // 可改 enumPENDING, APPROVED, REJECTED
optional string reason = 3;
}
message UpdateKYCInfoReq {
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 09:29:56 +00:00
// ====================== Product Item Param ======================
2025-04-08 09:20:34 +00:00
2025-04-09 09:29:56 +00:00
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;
optional string updated_at = 17;
optional string created_at = 18;
}
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;
}
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-06 02:08:46 +00:00
service Product {
2025-04-08 02:06:40 +00:00
// ====================== Category Service Start ======================
2025-04-06 02:08:46 +00:00
// CreateCategory 建立 product 分類
rpc CreateCategory(CreateCategoryReq) returns(OKResp);
2025-04-08 02:06:40 +00:00
// ModifyCategory 修改 product 分類名稱
rpc ModifyCategory(ModifyCategoryReq) returns(OKResp);
// DeleteCategory 刪除 product 分類
rpc DeleteCategory(CategoryReq) returns(OKResp);
// GetCategory 取得 product 分類
rpc GetCategory(CategoryReq) returns(Category);
2025-04-08 03:49:07 +00:00
// ListCategory 建立 product 分類
2025-04-08 02:06:40 +00:00
rpc ListCategory(ListCategoryReq) returns(ListCategoryResp);
// ====================== Category Service End ======================
2025-04-08 03:49:07 +00:00
// ====================== Tags Service Start ======================
// CreateTags 建立 tags
rpc CreateTags(CreateTagsReq) returns(OKResp);
// ModifyTags 修改 tags
rpc ModifyTags(ModifyTagsReq) returns(OKResp);
// DeleteTags 刪除tags
rpc DeleteTags(TagsReq) returns(OKResp);
// GetTags 取得 tags
rpc GetTags(TagsReq) returns(Tags);
// ListTags 建立 tags
rpc ListTags(ListTagsReq) returns(ListTagsResp);
// ====================== Tags Service End ======================
2025-04-08 09:20:34 +00:00
// ====================== Know You Customer Service Start ======================
// CreateKYC 建立 KYC 資料
rpc CreateKYC (CreateKYCReq) returns (OKResp);
// FindLatestKYCByUID 根據使用者 UID 查詢最新 KYC 紀錄
rpc FindLatestKYCByUID (FindLatestKYCByUIDReq) returns (KYC);
// FindKYCByID 根據 KYC ID 查詢
rpc FindKYCByID (FindKYCByIDReq) returns (KYC);
// ListKYC 分頁查詢 KYC 清單(後台審核用)
rpc ListKYC (ListKYCReq) returns (ListKYCResp);
// UpdateKYCStatus 更新 KYC 審核狀態與原因
rpc UpdateKYCStatus (UpdateKYCStatusReq) returns (OKResp);
// UpdateKYCInfo 更新使用者的 KYC尚未審核
rpc UpdateKYCInfo (UpdateKYCInfoReq) returns (OKResp);
2025-04-09 09:29:56 +00:00
// ====================== Know You Customer Service End ======================
// ====================== ProductItem Service Start ======================
// CreateItem 建立 ProductItem
rpc CreateItem(CreateProductItemRequest) returns (OKResp);
// GetProductItem 取得 ProductItem
rpc GetProductItem(GetProductItemRequest) returns (ProductItem);
// GetProductItemsByProductID 使用 ProductID 取得 ProductItems
rpc GetProductItemsByProductID(ListProductItemRequest) returns (ListProductItemResponse);
// DeleteProductItems 刪除 Delete Product Item
rpc DeleteProductItems(DeleteProductItemRequest) returns (OKResp);
// DeleteProductItemsByReferenceID 使用 ProductID 刪除所有 Item
rpc DeleteProductItemsByReferenceID(DeleteProductItemsByReferenceIDReq) returns (OKResp);
// 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);
// ====================== ProductItem Service End ======================
2025-04-08 09:20:34 +00:00
}