Init project

This commit is contained in:
2025-08-27 12:47:23 +04:00
commit 9ee249de29
24 changed files with 2449 additions and 0 deletions

197
proto/core.proto Normal file
View File

@@ -0,0 +1,197 @@
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;
}

161
proto/document.proto Normal file
View File

@@ -0,0 +1,161 @@
syntax = "proto3";
package erp.document;
option go_package = "erp-mvp/core-service/proto/document";
import "google/protobuf/timestamp.proto";
// Сервис для генерации документов
service DocumentService {
rpc GenerateQRCode(QRCodeRequest) returns (QRCodeResponse);
rpc GenerateReport(ReportRequest) returns (ReportResponse);
rpc GetDocumentStatus(StatusRequest) returns (StatusResponse);
rpc GetDocumentDownload(DownloadRequest) returns (DownloadResponse);
}
// Сервис для работы с шаблонами
service TemplateService {
rpc GetTemplate(TemplateRequest) returns (TemplateResponse);
rpc ListTemplates(ListTemplatesRequest) returns (ListTemplatesResponse);
rpc CreateTemplate(CreateTemplateRequest) returns (TemplateResponse);
rpc UpdateTemplate(UpdateTemplateRequest) returns (TemplateResponse);
rpc DeleteTemplate(DeleteTemplateRequest) returns (DeleteTemplateResponse);
}
// Запросы для QR-кодов
message QRCodeRequest {
string location_id = 1;
string location_address = 2;
string organization_id = 3;
int32 size = 4;
int32 border = 5;
}
message QRCodeResponse {
string document_id = 1;
string qr_code_url = 2;
string qr_code_data = 3;
google.protobuf.Timestamp expires_at = 4;
}
// Запросы для отчетов
message ReportRequest {
string report_type = 1;
string organization_id = 2;
map<string, string> filters = 3;
DocumentFormat format = 4;
}
message ReportResponse {
string document_id = 1;
string download_url = 2;
int64 file_size = 3;
google.protobuf.Timestamp expires_at = 4;
}
// Запросы для статуса документа
message StatusRequest {
string document_id = 1;
}
message StatusResponse {
string document_id = 1;
DocumentStatus status = 2;
int32 progress = 3;
string error_message = 4;
google.protobuf.Timestamp created_at = 5;
google.protobuf.Timestamp updated_at = 6;
}
// Запросы для скачивания
message DownloadRequest {
string document_id = 1;
}
message DownloadResponse {
string document_id = 1;
string download_url = 2;
int64 file_size = 3;
string filename = 4;
DocumentFormat format = 5;
}
// Запросы для шаблонов
message TemplateRequest {
string template_name = 1;
}
message TemplateResponse {
string name = 1;
string description = 2;
repeated string variables = 3;
string content = 4;
google.protobuf.Timestamp created_at = 5;
google.protobuf.Timestamp updated_at = 6;
}
message ListTemplatesRequest {
string category = 1;
int32 page = 2;
int32 page_size = 3;
}
message ListTemplatesResponse {
repeated TemplateInfo templates = 1;
int32 total_count = 2;
int32 page = 3;
int32 page_size = 4;
}
message CreateTemplateRequest {
string name = 1;
string description = 2;
string content = 3;
string category = 4;
repeated string variables = 5;
}
message UpdateTemplateRequest {
string name = 1;
optional string description = 2;
optional string content = 3;
optional string category = 4;
repeated string variables = 5;
}
message DeleteTemplateRequest {
string name = 1;
}
message DeleteTemplateResponse {
bool success = 1;
string message = 2;
}
// Информация о шаблоне
message TemplateInfo {
string name = 1;
string description = 2;
string category = 3;
repeated string variables = 4;
google.protobuf.Timestamp created_at = 5;
google.protobuf.Timestamp updated_at = 6;
}
// Перечисления
enum DocumentFormat {
DOCUMENT_FORMAT_UNSPECIFIED = 0;
DOCUMENT_FORMAT_PDF = 1;
DOCUMENT_FORMAT_EXCEL = 2;
DOCUMENT_FORMAT_WORD = 3;
DOCUMENT_FORMAT_QR_CODE = 4;
}
enum DocumentStatus {
DOCUMENT_STATUS_UNSPECIFIED = 0;
DOCUMENT_STATUS_PENDING = 1;
DOCUMENT_STATUS_PROCESSING = 2;
DOCUMENT_STATUS_COMPLETED = 3;
DOCUMENT_STATUS_FAILED = 4;
}