linted protobufs via buf

This commit is contained in:
Priec
2025-12-20 20:57:11 +01:00
parent 1cedd58708
commit a506cd8f08
13 changed files with 185 additions and 206 deletions

64
Cargo.lock generated
View File

@@ -1959,11 +1959,11 @@ checksum = "08ab2867e3eeeca90e844d1940eab391c9dc5228783db2ed999acbc0a9ed375a"
[[package]] [[package]]
name = "matchers" name = "matchers"
version = "0.1.0" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9"
dependencies = [ dependencies = [
"regex-automata 0.1.10", "regex-automata",
] ]
[[package]] [[package]]
@@ -2080,12 +2080,11 @@ dependencies = [
[[package]] [[package]]
name = "nu-ansi-term" name = "nu-ansi-term"
version = "0.46.0" version = "0.50.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
dependencies = [ dependencies = [
"overload", "windows-sys 0.60.2",
"winapi",
] ]
[[package]] [[package]]
@@ -2243,12 +2242,6 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
name = "overload"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
[[package]] [[package]]
name = "ownedbytes" name = "ownedbytes"
version = "0.9.0" version = "0.9.0"
@@ -2810,17 +2803,8 @@ checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
"regex-automata 0.4.9", "regex-automata",
"regex-syntax 0.8.5", "regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
dependencies = [
"regex-syntax 0.6.29",
] ]
[[package]] [[package]]
@@ -2831,15 +2815,9 @@ checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
"regex-syntax 0.8.5", "regex-syntax",
] ]
[[package]]
name = "regex-syntax"
version = "0.6.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
[[package]] [[package]]
name = "regex-syntax" name = "regex-syntax"
version = "0.8.5" version = "0.8.5"
@@ -3210,6 +3188,7 @@ dependencies = [
"futures", "futures",
"jsonwebtoken", "jsonwebtoken",
"lazy_static", "lazy_static",
"once_cell",
"prost 0.13.5", "prost 0.13.5",
"prost-build 0.14.1", "prost-build 0.14.1",
"prost-types 0.13.5", "prost-types 0.13.5",
@@ -3234,6 +3213,7 @@ dependencies = [
"tonic", "tonic",
"tonic-reflection", "tonic-reflection",
"tracing", "tracing",
"tracing-subscriber",
"uuid", "uuid",
"validator", "validator",
] ]
@@ -3830,7 +3810,7 @@ dependencies = [
"fnv", "fnv",
"once_cell", "once_cell",
"plist", "plist",
"regex-syntax 0.8.5", "regex-syntax",
"serde", "serde",
"serde_derive", "serde_derive",
"serde_json", "serde_json",
@@ -3936,7 +3916,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d60769b80ad7953d8a7b2c70cdfe722bbcdcac6bccc8ac934c40c034d866fc18" checksum = "d60769b80ad7953d8a7b2c70cdfe722bbcdcac6bccc8ac934c40c034d866fc18"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"regex-syntax 0.8.5", "regex-syntax",
"utf8-ranges", "utf8-ranges",
] ]
@@ -4318,9 +4298,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
[[package]] [[package]]
name = "tracing" name = "tracing"
version = "0.1.41" version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
dependencies = [ dependencies = [
"log", "log",
"pin-project-lite", "pin-project-lite",
@@ -4330,9 +4310,9 @@ dependencies = [
[[package]] [[package]]
name = "tracing-attributes" name = "tracing-attributes"
version = "0.1.30" version = "0.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -4341,9 +4321,9 @@ dependencies = [
[[package]] [[package]]
name = "tracing-core" name = "tracing-core"
version = "0.1.34" version = "0.1.36"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
dependencies = [ dependencies = [
"once_cell", "once_cell",
"valuable", "valuable",
@@ -4362,14 +4342,14 @@ dependencies = [
[[package]] [[package]]
name = "tracing-subscriber" name = "tracing-subscriber"
version = "0.3.19" version = "0.3.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e"
dependencies = [ dependencies = [
"matchers", "matchers",
"nu-ansi-term", "nu-ansi-term",
"once_cell", "once_cell",
"regex", "regex-automata",
"sharded-slab", "sharded-slab",
"smallvec", "smallvec",
"thread_local", "thread_local",

View File

@@ -6,78 +6,78 @@ import "common.proto";
// import "table_structure.proto"; // import "table_structure.proto";
service Adresar { service Adresar {
rpc PostAdresar (PostAdresarRequest) returns (AdresarResponse); rpc PostAdresar(PostAdresarRequest) returns (AdresarResponse);
rpc GetAdresar (GetAdresarRequest) returns (AdresarResponse); rpc GetAdresar(GetAdresarRequest) returns (AdresarResponse);
rpc PutAdresar (PutAdresarRequest) returns (AdresarResponse); rpc PutAdresar(PutAdresarRequest) returns (AdresarResponse);
rpc DeleteAdresar (DeleteAdresarRequest) returns (DeleteAdresarResponse); rpc DeleteAdresar(DeleteAdresarRequest) returns (DeleteAdresarResponse);
rpc GetAdresarCount (common.Empty) returns (common.CountResponse); rpc GetAdresarCount(common.Empty) returns (common.CountResponse);
rpc GetAdresarByPosition (common.PositionRequest) returns (AdresarResponse); rpc GetAdresarByPosition(common.PositionRequest) returns (AdresarResponse);
} }
message GetAdresarRequest { message GetAdresarRequest {
int64 id = 1; int64 id = 1;
} }
message DeleteAdresarRequest { message DeleteAdresarRequest {
int64 id = 1; int64 id = 1;
} }
message PostAdresarRequest { message PostAdresarRequest {
string firma = 1; string firma = 1;
string kz = 2; string kz = 2;
string drc = 3; string drc = 3;
string ulica = 4; string ulica = 4;
string psc = 5; string psc = 5;
string mesto = 6; string mesto = 6;
string stat = 7; string stat = 7;
string banka = 8; string banka = 8;
string ucet = 9; string ucet = 9;
string skladm = 10; string skladm = 10;
string ico = 11; string ico = 11;
string kontakt = 12; string kontakt = 12;
string telefon = 13; string telefon = 13;
string skladu = 14; string skladu = 14;
string fax = 15; string fax = 15;
} }
message AdresarResponse { message AdresarResponse {
int64 id = 1; int64 id = 1;
string firma = 2; string firma = 2;
string kz = 3; string kz = 3;
string drc = 4; string drc = 4;
string ulica = 5; string ulica = 5;
string psc = 6; string psc = 6;
string mesto = 7; string mesto = 7;
string stat = 8; string stat = 8;
string banka = 9; string banka = 9;
string ucet = 10; string ucet = 10;
string skladm = 11; string skladm = 11;
string ico = 12; string ico = 12;
string kontakt = 13; string kontakt = 13;
string telefon = 14; string telefon = 14;
string skladu = 15; string skladu = 15;
string fax = 16; string fax = 16;
} }
message PutAdresarRequest { message PutAdresarRequest {
int64 id = 1; int64 id = 1;
string firma = 2; string firma = 2;
string kz = 3; string kz = 3;
string drc = 4; string drc = 4;
string ulica = 5; string ulica = 5;
string psc = 6; string psc = 6;
string mesto = 7; string mesto = 7;
string stat = 8; string stat = 8;
string banka = 9; string banka = 9;
string ucet = 10; string ucet = 10;
string skladm = 11; string skladm = 11;
string ico = 12; string ico = 12;
string kontakt = 13; string kontakt = 13;
string telefon = 14; string telefon = 14;
string skladu = 15; string skladu = 15;
string fax = 16; string fax = 16;
} }
message DeleteAdresarResponse { message DeleteAdresarResponse {
bool success = 1; bool success = 1;
} }

View File

@@ -5,35 +5,35 @@ package komp_ac.auth;
import "common.proto"; import "common.proto";
service AuthService { service AuthService {
rpc Register(RegisterRequest) returns (AuthResponse); rpc Register(RegisterRequest) returns (AuthResponse);
rpc Login(LoginRequest) returns (LoginResponse); rpc Login(LoginRequest) returns (LoginResponse);
} }
message RegisterRequest { message RegisterRequest {
string username = 1; string username = 1;
string email = 2; string email = 2;
string password = 3; string password = 3;
string password_confirmation = 4; string password_confirmation = 4;
string role = 5; string role = 5;
} }
message AuthResponse { message AuthResponse {
string id = 1; // UUID in string format string id = 1; // UUID in string format
string username = 2; // Registered username string username = 2; // Registered username
string email = 3; // Registered email (if provided) string email = 3; // Registered email (if provided)
string role = 4; // Default role: 'accountant' string role = 4; // Default role: 'accountant'
} }
message LoginRequest { message LoginRequest {
string identifier = 1; // Can be username or email string identifier = 1; // Can be username or email
string password = 2; string password = 2;
} }
message LoginResponse { message LoginResponse {
string access_token = 1; // JWT token string access_token = 1; // JWT token
string token_type = 2; // Usually "Bearer" string token_type = 2; // Usually "Bearer"
int32 expires_in = 3; // Expiration in seconds (86400 for 24 hours) int32 expires_in = 3; // Expiration in seconds (86400 for 24 hours)
string user_id = 4; // User's UUID in string format string user_id = 4; // User's UUID in string format
string role = 5; // User's role string role = 5; // User's role
string username = 6; string username = 6;
} }

View File

@@ -3,5 +3,9 @@ syntax = "proto3";
package komp_ac.common; package komp_ac.common;
message Empty {} message Empty {}
message CountResponse { int64 count = 1; } message CountResponse {
message PositionRequest { int64 position = 1; } int64 count = 1;
}
message PositionRequest {
int64 position = 1;
}

View File

@@ -3,18 +3,18 @@ syntax = "proto3";
package komp_ac.search; package komp_ac.search;
service Searcher { service Searcher {
rpc SearchTable(SearchRequest) returns (SearchResponse); rpc SearchTable(SearchRequest) returns (SearchResponse);
} }
message SearchRequest { message SearchRequest {
string table_name = 1; string table_name = 1;
string query = 2; string query = 2;
} }
message SearchResponse { message SearchResponse {
message Hit { message Hit {
int64 id = 1; // PostgreSQL row ID int64 id = 1; // PostgreSQL row ID
float score = 2; float score = 2;
string content_json = 3; string content_json = 3;
} }
repeated Hit hits = 1; repeated Hit hits = 1;
} }

View File

@@ -3,44 +3,44 @@ syntax = "proto3";
package komp_ac.search2; package komp_ac.search2;
service Search2 { service Search2 {
rpc SearchTable(Search2Request) returns (Search2Response); rpc SearchTable(Search2Request) returns (Search2Response);
} }
message Search2Request { message Search2Request {
string profile_name = 1; string profile_name = 1;
string table_name = 2; string table_name = 2;
repeated ColumnFilter column_filters = 3; repeated ColumnFilter column_filters = 3;
optional string text_query = 4; // Optional fallback text search optional string text_query = 4; // Optional fallback text search
optional int32 limit = 5; optional int32 limit = 5;
optional string order_by = 6; optional string order_by = 6;
optional bool order_desc = 7; optional bool order_desc = 7;
} }
message ColumnFilter { message ColumnFilter {
string column_name = 1; string column_name = 1;
FilterType filter_type = 2; FilterType filter_type = 2;
string value = 3; string value = 3;
optional string value2 = 4; // For range queries optional string value2 = 4; // For range queries
} }
enum FilterType { enum FilterType {
EQUALS = 0; EQUALS = 0;
CONTAINS = 1; CONTAINS = 1;
STARTS_WITH = 2; STARTS_WITH = 2;
ENDS_WITH = 3; ENDS_WITH = 3;
RANGE = 4; RANGE = 4;
GREATER_THAN = 5; GREATER_THAN = 5;
LESS_THAN = 6; LESS_THAN = 6;
IS_NULL = 7; IS_NULL = 7;
IS_NOT_NULL = 8; IS_NOT_NULL = 8;
} }
message Search2Response { message Search2Response {
message Hit { message Hit {
int64 id = 1; int64 id = 1;
string content_json = 2; // No score - this is SQL-based string content_json = 2; // No score - this is SQL-based
optional string match_info = 3; // Info about which columns matched optional string match_info = 3; // Info about which columns matched
} }
repeated Hit hits = 1; repeated Hit hits = 1;
int32 total_count = 2; // Total matching records (for pagination) int32 total_count = 2; // Total matching records (for pagination)
} }

View File

@@ -12,17 +12,14 @@ service TableDefinition {
// Creates a new table (and schema if missing) with system columns, // Creates a new table (and schema if missing) with system columns,
// linked-table foreign keys, user-defined columns, and optional indexes. // linked-table foreign keys, user-defined columns, and optional indexes.
// Also inserts metadata and default validation rules. Entirely transactional. // Also inserts metadata and default validation rules. Entirely transactional.
rpc PostTableDefinition(PostTableDefinitionRequest) rpc PostTableDefinition(PostTableDefinitionRequest) returns (TableDefinitionResponse);
returns (TableDefinitionResponse);
// Lists all profiles (schemas) and their tables with declared dependencies. // Lists all profiles (schemas) and their tables with declared dependencies.
// This provides a tree-like overview of table relationships. // This provides a tree-like overview of table relationships.
rpc GetProfileTree(komp_ac.common.Empty) rpc GetProfileTree(komp_ac.common.Empty) returns (ProfileTreeResponse);
returns (ProfileTreeResponse);
// Drops a table and its metadata, then deletes the profile if it becomes empty. // Drops a table and its metadata, then deletes the profile if it becomes empty.
rpc DeleteTable(DeleteTableRequest) rpc DeleteTable(DeleteTableRequest) returns (DeleteTableResponse);
returns (DeleteTableResponse);
} }
// A single link to another table within the same profile (schema). // A single link to another table within the same profile (schema).

View File

@@ -23,8 +23,7 @@ service TableStructureService {
// - Normalizes data_type text (details under TableColumn.data_type) // - Normalizes data_type text (details under TableColumn.data_type)
// - Returns an empty list if the table is validated but has no visible // - Returns an empty list if the table is validated but has no visible
// columns in information_schema (e.g., physical table missing) // columns in information_schema (e.g., physical table missing)
rpc GetTableStructure(GetTableStructureRequest) rpc GetTableStructure(GetTableStructureRequest) returns (TableStructureResponse);
returns (TableStructureResponse);
} }
// Request identifying the profile (schema) and table to inspect. // Request identifying the profile (schema) and table to inspect.

View File

@@ -53,8 +53,8 @@ message CharacterLimits {
// Mask for pretty display // Mask for pretty display
message DisplayMask { message DisplayMask {
string pattern = 1; // e.g., "(###) ###-####" or "####-##-##" string pattern = 1; // e.g., "(###) ###-####" or "####-##-##"
string input_char = 2; // e.g., "#" string input_char = 2; // e.g., "#"
optional string template_char = 3; // e.g., "_" optional string template_char = 3; // e.g., "_"
} }
@@ -94,11 +94,9 @@ message PatternRules {
// Service to fetch validations for a table // Service to fetch validations for a table
service TableValidationService { service TableValidationService {
rpc GetTableValidation(GetTableValidationRequest) rpc GetTableValidation(GetTableValidationRequest) returns (TableValidationResponse);
returns (TableValidationResponse);
rpc UpdateFieldValidation(UpdateFieldValidationRequest) rpc UpdateFieldValidation(UpdateFieldValidationRequest) returns (UpdateFieldValidationResponse);
returns (UpdateFieldValidationResponse);
} }
message UpdateFieldValidationRequest { message UpdateFieldValidationRequest {

View File

@@ -5,57 +5,57 @@ package komp_ac.uctovnictvo;
import "common.proto"; import "common.proto";
service Uctovnictvo { service Uctovnictvo {
rpc PostUctovnictvo (PostUctovnictvoRequest) returns (UctovnictvoResponse); rpc PostUctovnictvo(PostUctovnictvoRequest) returns (UctovnictvoResponse);
rpc GetUctovnictvo (GetUctovnictvoRequest) returns (UctovnictvoResponse); rpc GetUctovnictvo(GetUctovnictvoRequest) returns (UctovnictvoResponse);
rpc GetUctovnictvoCount (common.Empty) returns (common.CountResponse); rpc GetUctovnictvoCount(common.Empty) returns (common.CountResponse);
rpc GetUctovnictvoByPosition (common.PositionRequest) returns (UctovnictvoResponse); rpc GetUctovnictvoByPosition(common.PositionRequest) returns (UctovnictvoResponse);
rpc PutUctovnictvo (PutUctovnictvoRequest) returns (UctovnictvoResponse); rpc PutUctovnictvo(PutUctovnictvoRequest) returns (UctovnictvoResponse);
} }
message PostUctovnictvoRequest { message PostUctovnictvoRequest {
int64 adresar_id = 1; int64 adresar_id = 1;
string c_dokladu = 2; string c_dokladu = 2;
string datum = 3; // Use string for simplicity, or use google.protobuf.Timestamp for better date handling string datum = 3; // Use string for simplicity, or use google.protobuf.Timestamp for better date handling
string c_faktury = 4; string c_faktury = 4;
string obsah = 5; string obsah = 5;
string stredisko = 6; string stredisko = 6;
string c_uctu = 7; string c_uctu = 7;
string md = 8; string md = 8;
string identif = 9; string identif = 9;
string poznanka = 10; string poznanka = 10;
string firma = 11; string firma = 11;
} }
message UctovnictvoResponse { message UctovnictvoResponse {
int64 id = 1; int64 id = 1;
int64 adresar_id = 2; int64 adresar_id = 2;
string c_dokladu = 3; string c_dokladu = 3;
string datum = 4; string datum = 4;
string c_faktury = 5; string c_faktury = 5;
string obsah = 6; string obsah = 6;
string stredisko = 7; string stredisko = 7;
string c_uctu = 8; string c_uctu = 8;
string md = 9; string md = 9;
string identif = 10; string identif = 10;
string poznanka = 11; string poznanka = 11;
string firma = 12; string firma = 12;
} }
message PutUctovnictvoRequest { message PutUctovnictvoRequest {
int64 id = 1; int64 id = 1;
int64 adresar_id = 2; int64 adresar_id = 2;
string c_dokladu = 3; string c_dokladu = 3;
string datum = 4; string datum = 4;
string c_faktury = 5; string c_faktury = 5;
string obsah = 6; string obsah = 6;
string stredisko = 7; string stredisko = 7;
string c_uctu = 8; string c_uctu = 8;
string md = 9; string md = 9;
string identif = 10; string identif = 10;
string poznanka = 11; string poznanka = 11;
string firma = 12; string firma = 12;
} }
message GetUctovnictvoRequest { message GetUctovnictvoRequest {
int64 id = 1; int64 id = 1;
} }

Binary file not shown.

View File

@@ -38,6 +38,7 @@
# Protocol Buffers compiler for gRPC # Protocol Buffers compiler for gRPC
protobuf protobuf
protoc-gen-doc protoc-gen-doc
buf
]; ];
shellHook = '' shellHook = ''

2
server

Submodule server updated: e497676789...a398d72145