Files
Mini-ERP-app/proto/document.proto
2025-08-27 12:47:23 +04:00

162 lines
3.8 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 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;
}