Files
BackOffice.BFF/src/Protobufs/BackOffice.BFF.Products.Protobuf/Protos/products.proto
2025-12-06 14:25:02 +03:30

424 lines
10 KiB
Protocol Buffer

syntax = "proto3";
package products;
import "public_messages.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";
option csharp_namespace = "BackOffice.BFF.Products.Protobuf.Protos.Products";
service ProductsContract
{
rpc CreateNewProducts(CreateNewProductsRequest) returns (CreateNewProductsResponse){
option (google.api.http) = {
post: "/CreateNewProducts"
body: "*"
};
};
rpc UpdateProducts(UpdateProductsRequest) returns (google.protobuf.Empty){
option (google.api.http) = {
put: "/UpdateProducts"
body: "*"
};
};
rpc DeleteProducts(DeleteProductsRequest) returns (google.protobuf.Empty){
option (google.api.http) = {
delete: "/DeleteProducts"
body: "*"
};
};
rpc GetProducts(GetProductsRequest) returns (GetProductsResponse){
option (google.api.http) = {
get: "/GetProducts"
};
};
rpc GetAllProductsByFilter(GetAllProductsByFilterRequest) returns (GetAllProductsByFilterResponse){
option (google.api.http) = {
get: "/GetAllProductsByFilter"
};
};
rpc BulkUpdateProductPrices(BulkUpdateProductPricesRequest) returns (BulkUpdateProductPricesResponse){
option (google.api.http) = {
post: "/BulkUpdateProductPrices"
body: "*"
};
};
rpc BulkUpdateProductStock(BulkUpdateProductStockRequest) returns (BulkUpdateProductStockResponse){
option (google.api.http) = {
post: "/BulkUpdateProductStock"
body: "*"
};
};
rpc GetLowStockProducts(GetLowStockProductsRequest) returns (GetLowStockProductsResponse){
option (google.api.http) = {
get: "/GetLowStockProducts"
};
};
rpc ToggleProductStatus(ToggleProductStatusRequest) returns (ToggleProductStatusResponse){
option (google.api.http) = {
post: "/ToggleProductStatus"
body: "*"
};
};
rpc GetProductsForCategory(GetProductsForCategoryRequest) returns (GetProductsForCategoryResponse){
option (google.api.http) = {
get: "/GetProductsForCategory"
};
};
rpc GetCategories(GetCategoriesRequest) returns (GetCategoriesResponse){
option (google.api.http) = {
get: "/GetCategories"
};
};
rpc UpdateProductCategories(UpdateProductCategoriesRequest) returns (google.protobuf.Empty){
option (google.api.http) = {
post: "/UpdateProductCategories"
body: "*"
};
};
rpc UpdateCategoryProducts(UpdateCategoryProductsRequest) returns (google.protobuf.Empty){
option (google.api.http) = {
post: "/UpdateCategoryProducts"
body: "*"
};
};
// Product Gallery / Image Management
rpc GetProductGallery(GetProductGalleryRequest) returns (GetProductGalleryResponse){
option (google.api.http) = {
get: "/GetProductGallery"
};
};
rpc AddProductImage(AddProductImageRequest) returns (AddProductImageResponse){
option (google.api.http) = {
post: "/AddProductImage"
body: "*"
};
};
rpc RemoveProductImage(RemoveProductImageRequest) returns (google.protobuf.Empty){
option (google.api.http) = {
delete: "/RemoveProductImage"
};
};
}
message CreateNewProductsRequest
{
string title = 1;
string description = 2;
string short_infomation = 3;
string full_information = 4;
int64 price = 5;
int32 discount = 6;
int32 rate = 7;
string image_path = 8;
string thumbnail_path = 9;
int32 sale_count = 10;
int32 view_count = 11;
int32 remaining_count = 12;
// لیست شناسه دسته‌بندی‌های محصول
repeated int64 category_ids = 13;
ImageFileModel image_file = 14;
ImageFileModel thumbnail_file = 15;
}
message CreateNewProductsResponse
{
int64 id = 1;
}
message UpdateProductsRequest
{
int64 id = 1;
string title = 2;
string description = 3;
string short_infomation = 4;
string full_information = 5;
int64 price = 6;
int32 discount = 7;
int32 rate = 8;
string image_path = 9;
string thumbnail_path = 10;
int32 sale_count = 11;
int32 view_count = 12;
int32 remaining_count = 13;
// لیست شناسه دسته‌بندی‌های محصول
repeated int64 category_ids = 14;
ImageFileModel image_file = 15;
ImageFileModel thumbnail_file = 16;
}
message DeleteProductsRequest
{
int64 id = 1;
}
message GetProductsRequest
{
int64 id = 1;
}
message GetProductsResponse
{
int64 id = 1;
string title = 2;
string description = 3;
string short_infomation = 4;
string full_information = 5;
int64 price = 6;
int32 discount = 7;
int32 rate = 8;
string image_path = 9;
string thumbnail_path = 10;
int32 sale_count = 11;
int32 view_count = 12;
int32 remaining_count = 13;
// لیست شناسه دسته‌بندی‌های محصول
repeated int64 category_ids = 14;
}
message GetAllProductsByFilterRequest
{
messages.PaginationState pagination_state = 1;
google.protobuf.StringValue sort_by = 2;
GetAllProductsByFilterFilter filter = 3;
}
message GetAllProductsByFilterFilter
{
google.protobuf.Int64Value id = 1;
google.protobuf.StringValue title = 2;
google.protobuf.StringValue description = 3;
google.protobuf.StringValue short_infomation = 4;
google.protobuf.StringValue full_information = 5;
google.protobuf.Int64Value price = 6;
google.protobuf.Int32Value discount = 7;
google.protobuf.Int32Value rate = 8;
google.protobuf.StringValue image_path = 9;
google.protobuf.StringValue thumbnail_path = 10;
google.protobuf.Int32Value sale_count = 11;
google.protobuf.Int32Value view_count = 12;
google.protobuf.Int32Value remaining_count = 13;
google.protobuf.Int64Value category_id = 14;
}
message GetAllProductsByFilterResponse
{
messages.MetaData meta_data = 1;
repeated GetAllProductsByFilterResponseModel models = 2;
}
message GetAllProductsByFilterResponseModel
{
int64 id = 1;
string title = 2;
string description = 3;
string short_infomation = 4;
string full_information = 5;
int64 price = 6;
int32 discount = 7;
int32 rate = 8;
string image_path = 9;
string thumbnail_path = 10;
int32 sale_count = 11;
int32 view_count = 12;
int32 remaining_count = 13;
// لیست شناسه دسته‌بندی‌های محصول
repeated int64 category_ids = 14;
}
// Bulk Update Product Prices
message BulkUpdateProductPricesRequest
{
repeated ProductPriceUpdate products = 1;
}
message ProductPriceUpdate
{
int64 product_id = 1;
int64 new_price = 2;
google.protobuf.Int32Value new_discount = 3;
google.protobuf.Int32Value new_club_discount_percent = 4;
}
message BulkUpdateProductPricesResponse
{
int32 total = 1;
int32 succeeded = 2;
int32 failed = 3;
repeated BulkOperationError errors = 4;
}
message BulkOperationError
{
int64 product_id = 1;
string error_message = 2;
}
// Bulk Update Product Stock
message BulkUpdateProductStockRequest
{
repeated ProductStockUpdate products = 1;
StockUpdateType update_type = 2;
}
message ProductStockUpdate
{
int64 product_id = 1;
int32 quantity = 2;
}
enum StockUpdateType
{
SET = 0;
ADD = 1;
SUBTRACT = 2;
}
message BulkUpdateProductStockResponse
{
int32 total = 1;
int32 succeeded = 2;
int32 failed = 3;
repeated BulkOperationError errors = 4;
}
// Get Low Stock Products
message GetLowStockProductsRequest
{
int32 threshold = 1;
int32 page_index = 2;
int32 page_size = 3;
google.protobuf.BoolValue is_club_exclusive = 4;
}
message GetLowStockProductsResponse
{
messages.MetaData meta_data = 1;
repeated LowStockProduct products = 2;
}
message LowStockProduct
{
int64 id = 1;
string title = 2;
int32 remaining_count = 3;
int64 price = 4;
bool is_club_exclusive = 5;
}
// Toggle Product Status
message ToggleProductStatusRequest
{
repeated int64 product_ids = 1;
bool enable = 2;
int32 default_stock = 3;
}
message ToggleProductStatusResponse
{
int32 total = 1;
int32 succeeded = 2;
int32 failed = 3;
repeated BulkOperationError errors = 4;
}
// Category Product Item (for drag-drop UI)
message CategoryProductItem
{
int64 id = 1;
string title = 2;
bool selected = 3;
}
// Get Products for Category
message GetProductsForCategoryRequest
{
int64 category_id = 1;
}
message GetProductsForCategoryResponse
{
repeated CategoryProductItem items = 1;
}
// Category Item (for product categories drag-drop)
message CategoryItem
{
int64 id = 1;
string title = 2;
bool selected = 3;
}
// Get Categories for Product
message GetCategoriesRequest
{
int64 product_id = 1;
}
message GetCategoriesResponse
{
repeated CategoryItem items = 1;
}
// Update Product Categories
message UpdateProductCategoriesRequest
{
int64 product_id = 1;
repeated int64 category_ids = 2;
}
// Update Category Products
message UpdateCategoryProductsRequest
{
int64 category_id = 1;
repeated int64 product_ids = 2;
}
// Image File Model
message ImageFileModel
{
bytes file = 1;
string mime = 2;
string file_name = 3;
}
// Get Product Gallery
message GetProductGalleryRequest
{
int64 product_id = 1;
}
message ProductGalleryItem
{
int64 product_gallery_id = 1;
int64 product_image_id = 2;
string title = 3;
string image_path = 4;
string image_thumbnail_path = 5;
}
message GetProductGalleryResponse
{
repeated ProductGalleryItem items = 1;
}
// Add Product Image
message AddProductImageRequest
{
int64 product_id = 1;
string title = 2;
ImageFileModel image_file = 3;
}
message AddProductImageResponse
{
int64 product_gallery_id = 1;
int64 product_image_id = 2;
string title = 3;
string image_path = 4;
string image_thumbnail_path = 5;
}
// Remove Product Image
message RemoveProductImageRequest
{
int64 product_gallery_id = 1;
}