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

323 lines
8.4 KiB
Protocol Buffer
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

syntax = "proto3";
package product;
option go_package="./product";
// OKResp
message OKResp {}
// NoneReq
message NoneReq {}
// ====================== Category ======================
message CreateCategoryReq {
string name = 1;
}
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;
}
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);
}
// ====================== Tags Param ======================
message CreateTagsReq{
string types=1;
string name=2;
string show_type=3;
optional string cover=4;
}
message ModifyTagsReq{
string id=1;
optional string types=2;
optional string name=3;
optional string show_type=4;
optional string cover=5;
}
message TagsReq {
string id =1;
}
message Tags{
string id=1;
string types=2;
string name=3;
string 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 string types=5;
optional string show_type=6;
}
message ListTagsResp {
int64 total =1;
repeated Tags data=3;
}
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);
}
// ====================== 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;
}
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);
}
// ====================== 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;
optional int64 updated_at = 17;
optional int64 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;
}
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;
}
service Product_Item_Service {
// Create 建立 ProductItem
rpc Create(CreateProductItemRequest) returns (OKResp);
// GetProductItem 取得 ProductItem
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);
// 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);
}
// ====================== Product Param ======================