198 lines
4.6 KiB
Protocol Buffer
198 lines
4.6 KiB
Protocol Buffer
syntax = "proto3";
|
||
|
||
package erp.core;
|
||
|
||
option go_package = "erp-mvp/core-service/proto/core";
|
||
|
||
import "google/protobuf/timestamp.proto";
|
||
|
||
// Сервис для работы с местами хранения
|
||
service LocationService {
|
||
rpc GetLocation(GetLocationRequest) returns (LocationResponse);
|
||
rpc CreateLocation(CreateLocationRequest) returns (LocationResponse);
|
||
rpc UpdateLocation(UpdateLocationRequest) returns (LocationResponse);
|
||
rpc DeleteLocation(DeleteLocationRequest) returns (DeleteLocationResponse);
|
||
rpc ListLocations(ListLocationsRequest) returns (ListLocationsResponse);
|
||
}
|
||
|
||
// Сервис для работы с товарами
|
||
service ItemService {
|
||
rpc GetItem(GetItemRequest) returns (ItemResponse);
|
||
rpc CreateItem(CreateItemRequest) returns (ItemResponse);
|
||
rpc UpdateItem(UpdateItemRequest) returns (ItemResponse);
|
||
rpc DeleteItem(DeleteItemRequest) returns (DeleteItemResponse);
|
||
rpc ListItems(ListItemsRequest) returns (ListItemsResponse);
|
||
}
|
||
|
||
// Сервис для операций
|
||
service OperationService {
|
||
rpc PlaceItem(PlaceItemRequest) returns (OperationResponse);
|
||
rpc MoveItem(MoveItemRequest) returns (OperationResponse);
|
||
rpc SearchItems(SearchItemsRequest) returns (SearchItemsResponse);
|
||
}
|
||
|
||
// Запросы для мест хранения
|
||
message GetLocationRequest {
|
||
string location_id = 1;
|
||
string organization_id = 2;
|
||
}
|
||
|
||
message CreateLocationRequest {
|
||
string organization_id = 1;
|
||
string name = 2;
|
||
string address = 3;
|
||
string type = 4;
|
||
optional string parent_id = 5;
|
||
map<string, string> coordinates = 6;
|
||
}
|
||
|
||
message UpdateLocationRequest {
|
||
string location_id = 1;
|
||
string organization_id = 2;
|
||
optional string name = 3;
|
||
optional string address = 4;
|
||
optional string type = 5;
|
||
optional string parent_id = 6;
|
||
map<string, string> coordinates = 7;
|
||
}
|
||
|
||
message DeleteLocationRequest {
|
||
string location_id = 1;
|
||
string organization_id = 2;
|
||
}
|
||
|
||
message ListLocationsRequest {
|
||
string organization_id = 1;
|
||
optional string parent_id = 2;
|
||
optional string type = 3;
|
||
int32 page = 4;
|
||
int32 page_size = 5;
|
||
}
|
||
|
||
// Запросы для товаров
|
||
message GetItemRequest {
|
||
string item_id = 1;
|
||
string organization_id = 2;
|
||
}
|
||
|
||
message CreateItemRequest {
|
||
string organization_id = 1;
|
||
string name = 2;
|
||
string description = 3;
|
||
string category = 4;
|
||
}
|
||
|
||
message UpdateItemRequest {
|
||
string item_id = 1;
|
||
string organization_id = 2;
|
||
optional string name = 3;
|
||
optional string description = 4;
|
||
optional string category = 5;
|
||
}
|
||
|
||
message DeleteItemRequest {
|
||
string item_id = 1;
|
||
string organization_id = 2;
|
||
}
|
||
|
||
message ListItemsRequest {
|
||
string organization_id = 1;
|
||
optional string category = 2;
|
||
optional string search_query = 3;
|
||
int32 page = 4;
|
||
int32 page_size = 5;
|
||
}
|
||
|
||
// Запросы для операций
|
||
message PlaceItemRequest {
|
||
string organization_id = 1;
|
||
string item_id = 2;
|
||
string location_id = 3;
|
||
int32 quantity = 4;
|
||
}
|
||
|
||
message MoveItemRequest {
|
||
string organization_id = 1;
|
||
string item_id = 2;
|
||
string from_location_id = 3;
|
||
string to_location_id = 4;
|
||
int32 quantity = 5;
|
||
}
|
||
|
||
message SearchItemsRequest {
|
||
string organization_id = 1;
|
||
string query = 2;
|
||
optional string category = 3;
|
||
optional string location_id = 4;
|
||
int32 page = 5;
|
||
int32 page_size = 6;
|
||
}
|
||
|
||
// Ответы
|
||
message LocationResponse {
|
||
string id = 1;
|
||
string organization_id = 2;
|
||
optional string parent_id = 3;
|
||
string name = 4;
|
||
string address = 5;
|
||
string type = 6;
|
||
map<string, string> coordinates = 7;
|
||
string qr_code = 8;
|
||
google.protobuf.Timestamp created_at = 9;
|
||
google.protobuf.Timestamp updated_at = 10;
|
||
}
|
||
|
||
message ListLocationsResponse {
|
||
repeated LocationResponse locations = 1;
|
||
int32 total_count = 2;
|
||
int32 page = 3;
|
||
int32 page_size = 4;
|
||
}
|
||
|
||
message DeleteLocationResponse {
|
||
bool success = 1;
|
||
string message = 2;
|
||
}
|
||
|
||
message ItemResponse {
|
||
string id = 1;
|
||
string organization_id = 2;
|
||
string name = 3;
|
||
string description = 4;
|
||
string category = 5;
|
||
google.protobuf.Timestamp created_at = 6;
|
||
google.protobuf.Timestamp updated_at = 7;
|
||
}
|
||
|
||
message ListItemsResponse {
|
||
repeated ItemResponse items = 1;
|
||
int32 total_count = 2;
|
||
int32 page = 3;
|
||
int32 page_size = 4;
|
||
}
|
||
|
||
message DeleteItemResponse {
|
||
bool success = 1;
|
||
string message = 2;
|
||
}
|
||
|
||
message OperationResponse {
|
||
bool success = 1;
|
||
string message = 2;
|
||
string operation_id = 3;
|
||
google.protobuf.Timestamp created_at = 4;
|
||
}
|
||
|
||
message SearchItemsResponse {
|
||
repeated ItemWithLocation items = 1;
|
||
int32 total_count = 2;
|
||
int32 page = 3;
|
||
int32 page_size = 4;
|
||
}
|
||
|
||
message ItemWithLocation {
|
||
ItemResponse item = 1;
|
||
LocationResponse location = 2;
|
||
int32 quantity = 3;
|
||
}
|